49 #include "fsl_common.h"    77         case ARM_USART_EVENT_RECEIVE_COMPLETE:
    80         case ARM_USART_EVENT_SEND_COMPLETE:
    94         if (gHostChannelParams[stream].slaveAddress == slaveAddress)
   114     if (pStreamingPacket == NULL)
   126 uint8_t 
Host_IO_Init(ARM_DRIVER_USART *pDrv, 
void *pBus, 
void *pDevInfo, 
void *spiSlaveParams, uint16_t slaveAddress)
   128     static uint8_t streamID = 0;
   151     gHostChannelParams[streamID].
pCommDrv = pBus;
   152     gHostChannelParams[streamID].
deviceInfo = pDevInfo;
   153     gHostChannelParams[streamID].
slaveAddress = slaveAddress;
   156     gHostChannelParams[streamID].
pSPIparams = spiSlaveParams;
   164     size_t encodedSize = 0;
   165     static uint8_t *pMsgEncoded = NULL;
   176             pMsgEncoded = malloc(size * 2); 
   180             pMsgEncoded = malloc(size * 4); 
   185             pMsgEncoded = malloc(size);
   186             memcpy(pMsgEncoded, pMsg, size);
   193     HOST_Send(&gHostHandle, pMsgEncoded, encodedSize);
   238     bool bCmdSuccess = 
false, bMessageReceived = 
false;
   239     uint8_t *pMsgResponse = NULL;
   269     if (bMessageReceived)
   273             dataLength = gHostRxPkt.
mIndex;
   279                 if (process_host_command)
   285                 if (bCmdSuccess == 
false)
   313             pMsgResponse = malloc(responseSize);
   323                 if (process_host_command)
   326                                          gHostRxBuff + HOST_MSG_CMD_SLAVE_ADDR_OFFSET, NULL, &dataLength, 0);
   329                 if (gHostChannelParams[deviceID].pCommDrv &&
   330                     gHostRxPkt.
mIndex - HOST_MSG_CMD_SLAVE_ADDR_OFFSET >= dataLength)
   332                     if (gHostChannelParams[deviceID].pSPIparams)
   335                             gHostChannelParams[deviceID].pCommDrv, gHostChannelParams[deviceID].deviceInfo,
   342                             gHostChannelParams[deviceID].pCommDrv, gHostChannelParams[deviceID].deviceInfo,
   347                 if (ARM_DRIVER_OK == status)
   364                 if (gHostChannelParams[deviceID].pCommDrv)
   366                     if (gHostChannelParams[deviceID].pSPIparams)
   369                             gHostChannelParams[deviceID].pCommDrv, gHostChannelParams[deviceID].deviceInfo,
   371                             gHostRxBuff[HOST_MSG_CMD_LENGTH_OFFSET], pMsgResponse + responseSize);
   376                             gHostChannelParams[deviceID].pCommDrv, gHostChannelParams[deviceID].deviceInfo,
   378                             gHostRxBuff[HOST_MSG_CMD_LENGTH_OFFSET], pMsgResponse + responseSize);
   381                 if (process_host_command)
   384                                          gHostRxBuff + HOST_MSG_CMD_SLAVE_ADDR_OFFSET, pMsgResponse + responseSize,
   385                                          &dataLength, 
gHostRxBuff[HOST_MSG_CMD_LENGTH_OFFSET]);
   387                 if (ARM_DRIVER_OK == status)
   400                 if (process_host_command)
 
The register_io_i2c.h file declares low-level interface functions for reading and writing sensor regi...
 
void HOST_SignalEvent_t(uint32_t event)
Defines the HOST UART signal event handler. 
 
This structure holds information regarding the Encoding and RLI interface parameters. 
 
void Host_IO_Receive(host_cmd_proc_fn_t process_host_command, uint8_t encoding)
 
#define HOST_PRO_CMD_W_REG_TAG
 
int32_t HOST_Configure(host_interface_handle_t *pHandle, void *pConfigData)
The function to Configure the Host. 
 
int32_t Register_SPI_BlockWrite(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pWriteParams, uint8_t offset, const uint8_t *pBuffer, uint8_t bytesToWrite)
The interface function to block write to a sensor register. 
 
volatile bool bUartErrorMsg
 
int32_t HOST_Initialize(host_interface_handle_t *pHandle, comm_type_t type, void *pCommInstance, comm_instance_type_t inType, Host_Event_t event, void *pInData)
The function to Initialize the Host. 
 
#define HOST_PRO_INT_DEV_TAG
 
int32_t HOST_Receive(host_interface_handle_t *pHandle, uint8_t *pData, uint32_t *pRecvSize, uint32_t size, BlockRead_t process)
The function to receive data from the host. 
 
#define HOST_PRO_INT_CMD_TAG
Bit aligned values for Host Protocol Interface IDs (Bits 5-6). 
 
bool process_host_command(uint8_t tag, uint8_t *hostCommand, uint8_t *hostResponse, size_t *hostMsgSize, size_t respBufferSize)
 
host_channel_params_t gHostChannelParams[MAX_HOST_STREAMS]
 
#define HOST_PRO_CMD_WR_ACK_TAG
 
bool(* host_cmd_proc_fn_t)(uint8_t, uint8_t *, uint8_t *, size_t *, size_t)
The Host Command Process Function ([IN]Command TAG, [IN]Commad Buffer, [OUT]Response Buffer...
 
host_interface_handle_t gHostHandle
 
volatile bool bUartRxPendingMsg
 
host_rx_packet_t gHostRxPkt
 
This structure holds information to receive a packet of data to the host. 
 
#define HOST_INTERFACE_VERSION
 
comm_interface_t * pCommInterface
 
int32_t Register_I2C_BlockWrite(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, uint8_t offset, const uint8_t *pBuffer, uint8_t bytesToWrite)
The interface function to write a sensor register. 
 
void Host_IO_Add_ISO_Header(uint8_t streamID, uint8_t *pStreamingPacket, size_t sizePayload)
 
#define HOST_PRO_CMD_WR_NAK_TAG
Bit aligned values for Host Protocol Command Interface Status IDs (Bit 7). 
 
void Host_IO_Send(uint8_t *pMsg, size_t size, uint8_t encoding)
 
#define HOST_PRO_CMD_R_REG_TAG
 
volatile bool bUartTxComplete
 
#define HOST_PRO_INT_ISO_TAG
 
uint8_t getSlaveIndex(uint8_t slaveAddress)
 
int32_t Register_SPI_Read(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pReadParams, uint8_t offset, uint8_t length, uint8_t *pOutBuffer)
The interface function to read a sensor register. 
 
int32_t Register_I2C_Read(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, uint8_t offset, uint8_t length, uint8_t *pOutBuffer)
The interface function to read a sensor register. 
 
uint8_t Host_IO_Init(ARM_DRIVER_USART *pDrv, void *pBus, void *pDevInfo, void *spiSlaveParams, uint16_t slaveAddress)
 
The host_io_uart.h file contains the Host Protocol interface definitions and configuration. 
 
uint8_t gHostRxBuff[HOST_RX_BUF_LEN]
 
int32_t HOST_Send(host_interface_handle_t *pHandle, uint8_t *pData, uint32_t size)
The function to Send the data to the host. 
 
The register_io_spi.h file declares low-level interface functions for reading and writing sensor regi...