MCU Communication Coordinator for IST Client

The IST client MCU communication coordinator (ist_client_mcc) provides APIs enabling the IST client to communicate with IST manager.

Functionalities

  • Provide an interface for communication between the IST client running on NVIDIA DRIVE Orin™ SoC and IST manager running on MCU.
  • Communication frame format and protocol to pass messages between MCU and IST client are defined in this module.

APIs

The following APIs must be implemented and exported in libist_client_mcc.so:
/**
 * Allocate and initialize MCC lib instance
 *
 * @param [in] argc: argc param passed to ist_client
 * @param [in] argv: argv param passed to ist_client - mcc lib opts follow '--mcc' param
 * @returns void * : On success, mcc_handle : On error, NULL
 */
extern void *ISTClient_mcc_init(int argc, char *argv[]);
          	
/**
 * Deinitialize and cleanup MCC lib instance
 *
 * @param [in] mcc_handle: handle returned by ISTClient_mcc_init()
 * @returns 0 on success
 */
extern int ISTClient_mcc_deinit(void *mcc_handle);
			
/**
 * Register ISTClient callback functions
 *
 * @param [in] mcc_handle: handle returned by ISTClient_mcc_init()
 * @param [in] mcc_client: ist_client callbacks and context to be registered with mcc
 * @returns 0 on success
 */
extern int ISTClient_mcc_register(void *mcc_handle,
                                  ISTClient_mcc_client_t *mcc_client);
			
/**
 * Start ISTClient/ISTManager communication and process IST requests
 *
 * @param [in] mcc_handle: handle returned by ISTClient_mcc_init()
 * @returns 0 on success
 */
extern int ISTClient_mcc_start(void *mcc_handle);

Types

Types defined in ist_client_mcc.h:
/**
 * IST diagnostic result structure
 */
typedef struct ist_client_result {
	uint8_t hw_result;        /**< hw_result value (opaque to mcc) */
	uint8_t reserved_0;       /**< reserved_0 value (opaque to mcc) */
	uint8_t sw_rpl_status;    /**< sw_rpl_status value (opaque to mcc) */
	uint8_t sw_preist_status; /**< sw_preist_status value (opaque to mcc) */
} ist_client_result_t;
			
/**
 * ISTClient GetResult function type
 *
 * @returns 0 on success
 */
typedef int (*ISTClient_GetResult_fn_t)(
		void *ctx,                  /**< [in] ISTClient_mcc_client_t::ctx */
		ist_client_result_t *result /**< [out] IST diagnostic result */
	);
			
/**
 * Structure containing ISTClient callback functions which gets registered with MCC lib
 */
typedef struct {
	ISTClient_GetResult_fn_t ISTClient_GetResult; /**<  GetResult callback */
	void *ctx; /**< (optional) Context that is passed when calling ISTClient callbacks */
} ISTClient_mcc_client_t;

Usage

The following pseudo code is provided to illustrate how the ist_client uses the APIs provided by the ist_client_mcc library.
/* ISTClient_GetResult() should be called when IST manager requests IST results */
ISTClient_GetResult(void *ctx, ist_client_result_t *rlt) {...}

int ist_client_main(int argc, char *argv[])
{
  void *mcc_handle = NULL;
  ISTClient_mcc_client_t mcc_client = {0};

  /* Initialize the MCC lib passing along argc/argv so MCC can consume MCC specific opts */
  mcc_handle = ISTClient_mcc_init(argc, argv);

  /* Register with MCC lib */
  mcc_client.ISTClient_GetResult = ISTClient_GetResult;
  ISTClient_mcc_register(mcc_handle, &mcc_client);

  /* Start processing requests from IST manager running on MCU */
  ISTClient_mcc_start(mcc_handle);
  /* ... MCC message processing loop is now running on ist_client main thread */

  /* Cleanup MCC */
  ISTClient_mcc_deinit(mcc_handle);
  mcc_handle = NULL;

  return 0;
}