AVED InBand Telemetry Application¶
Overview¶
The In-Band Telemetry application handles the events and communication between the Host and the Sensors.
Application External APIs¶
Initialize the application.¶
The initialization function takes two parameters:
The shared memory address, which is used to populate the sensor responses.
The number of sensors in the profile, used internally to dynamically allocate some structures.
iIN_BAND_TELEMETRY_Initialise
/**
* @brief Initialise the in band telemetry application layer
* used to handle events and communication between the host
* and the sensors
*
* @param sharedMemBaseAddr The base address of the shared memory
* @param ucNumSensors Number of sensors in the profile
*
* @return OK Success
* ERROR Failure
*/
int iIN_BAND_TELEMETRY_Initialise( uint64_t sharedMemBaseAddr,
uint8_t ucNumSensors );
Print internal ASDM data¶
API function to print out the internal ASDM repo data.
iIN_BAND_TELEMETRY_PrintAsdmRepoData
/**
* @brief Print out the internal ASDM repo data
*
* @param iRepoIndex The repo index
*
* @return OK Stats retrieved from proxy driver successfully
* ERROR Stats not retrieved successfully
*
*/
int iIN_BAND_TELEMETRY_PrintAsdmRepoData( int iRepoIndex );
Print Statistics¶
Debug function used to display the statistic counters and errors.
iIN_BAND_TELEMETRY_PrintStatistics
/**
* @brief Print all the stats gathered by the application
*
* @return OK Stats retrieved from proxy driver successfully
* ERROR Stats not retrieved successfully
*
*/
int iIN_BAND_TELEMETRY_PrintStatistics( void );
Clear Statistics¶
Debug function used to clear the all statistics counters back to zero.
iIN_BAND_TELEMETRY_ClearStatistics
/**
* @brief Clear all the stats in the application
*
* @return OK Stats cleared successfully
* ERROR Stats not cleared successfully
*
*/
int iIN_BAND_TELEMETRY_ClearStatistics( void );
Internal Design¶
Enums¶
The list of repo types supported within the in band application.
/*
* @enum AMC_IN_BAND_SUPPORTED_REPO
* @brief the repo type
*/
typedef enum AMC_IN_BAND_SUPPORTED_REPO
{
AMC_IN_BAND_SUPPORTED_REPO_TEMP = 0,
AMC_IN_BAND_SUPPORTED_REPO_VOLTAGE,
AMC_IN_BAND_SUPPORTED_REPO_CURRENT,
AMC_IN_BAND_SUPPORTED_REPO_POWER,
AMC_IN_BAND_SUPPORTED_REPO_BOARD_INFO,
AMC_IN_BAND_SUPPORTED_REPO_MAX
} AMC_IN_BAND_SUPPORTED_REPO;
Structures¶
Used to internally store a list of sensors id’s per repo type and associated index into the pxAscData.
/*
* @struct IN_BAND_SENSOR_LIST
* @brief List of sensors id's stored per repo type
*/
typedef struct IN_BAND_SENSOR_LIST
{
uint8_t ucNumFound;
uint8_t *pucSensorIndex;
uint8_t *pucSensorId;
} IN_BAND_SENSOR_LIST;
Internal Context¶
The global data used to store a copy of the ASC data, an internal sensors list per repo and the ASDM table used to form up response back to the AMI proxy.
Parameter | Description |
---|---|
ASC_PROXY_DRIVER_SENSOR_DATA *pxAscData | A dynamically allocated list of sensors received from the ASC, initially populated during the iIn_BandTelemetryInitialise( ) function |
uint8_t ucAscNumSensors | The number of sensors returned from the ASC, again populated during init |
IN_BAND_SENSOR_LIST xSensorList[ AMC_IN_BAND_SUPPORTED_REPO_MAX ] | The internal sensor list stored per repo type, contains a list of sensor ids as well as a total per repo |
ASDM_SDR *pxAsdmSdrInfo | The dynamically created ASDM table, generated during iInitASDM( ) |
uint64_t ullSharedMemBaseAddr | The shared memory base address passed into the init |
uint32_t ulStatCounters[ IN_BAND_STATS_MAX ] | The debug stat counters |
uint32_t ulErrorCounters[ IN_BAND_ERRORS_MAX ] | The debug error counters |
int iInitialised | A flag used once initialization has completed successfully |
iIn_BandTelemetryInitialise Function¶
This function:
Creates a mutex to protect access to the internally stored ASDM.
Dynamically allocates memory to store data obtained from the ASC Proxy.
Calls the ASC proxy to get a list of sensors to build up the initial ASDM table.
Builds up the internal ASDM.
Binds into the ASC to get sensor events.
Binds into the AMI to get sensor requests from the host.
iInitAsdm Function¶
This function dynamically creates and populates the pxAsdmSdrInfo which is stored within the global context.
The ASDM (Alveo Sensor Data Model) consists of:
Header
Number of SDR’s
End of Record
iAscCallback Function¶
This function is bound into the callback from the ASC Proxy to listen for the ‘ASC_PROXY_DRIVER_E_SENSOR_UPDATE_COMPLETE’ event.
Once received it calls back into the ASC to get the latest sensor values and uses this to update the internal ASDM calling iUpdateAsdmValues( ).
iAmiCallback Function¶
This function is the bound in callback from the AMI Proxy to listen for the ‘AMI_PROXY_DRIVER_E_SENSOR_READ’ event.
When received, the application will call back into the AMI proxy to get the data associated with the request.
The request type (below) is then used to form up the response back from the internal ASDM table.
AMI Proxy Request Type | In Band handling function | Description |
---|---|---|
AMI_PROXY_CMD_SENSOR_REQUEST_GET_SIZE | iPopulateAsdmGetSizeResponse( ) | Return the size of the SDR, including Header, Sensor Records and End of Repo marker |
AMI_PROXY_CMD_SENSOR_REQUEST_GET_SDR | iPopulateAsdmGetSdrResponse( ) | Return the entire SDR – Header, Sensor Records and End of Repo marker |
AMI_PROXY_CMD_SENSOR_REQUEST_GET_SINGLE_SDR | iPopulateAsdmGetSingleSensorResponse( ) | Return the instantaneous sensor data based on the input sensor ID |
AMI_PROXY_CMD_SENSOR_REQUEST_ALL_SDR | iPopulateAsdmGetAllSensorDataResponse( ) | Return the instantaneous sensor data for all sensors in a given SDR |
iUpdateAsdmValues Function¶
The function is called from within the ASC callback whenever a sensor update complete event is received.
Within mutex protection it loops around the internal sensor list and updates the sensor value to the latest based on the data received from the ASC proxy.
Page Revision: v. 24