![]() |
ISSDK
1.8
IoT Sensing Software Development Kit
|
The host_io_uart.h file contains the Host Protocol interface definitions and configuration. More...
#include "Driver_USART.h"
Go to the source code of this file.
Data Structures | |
struct | host_channel_params_t |
This structure holds information regarding the Encoding and RLI interface parameters. More... | |
struct | host_rx_packet_t |
This structure holds information to receive a packet of data to the host. More... | |
Macros | |
#define | STREAMING_HEADER_LEN (4) /* ISSDK Host Protocol defined Iso Cmd Header Length + Stream ID. */ |
#define | HOST_RX_BUF_LEN (64) /* MAX size of Rx Host CMDs. */ |
#define | HOST_RSP_HDR_LEN (4) /* Size of Host response message header. */ |
#define | HOST_DEV_RSP_LEN (128) /* MAX size of Host Dev Info Response. */ |
#define | HOST_CMD_RSP_LEN (64) /* MAX size of Host Command Response. */ |
#define | MAX_HOST_STREAMS (4) /* Max Streams that can be defined by the user Application. */ |
#define | HOST_CMD_RESP_ACK (0x80) /* HOST CMD Ack code. */ |
#define | HOST_CMD_RESP_NACK (0xC6) /* HOST CMD Nack code. */ |
#define | EVENT_STREAM_ID (0xFF) /* Stream ID in ISO Message for posting Events (such as freefall) */ |
#define | HOST_PRO_INT_CMD_TAG (0x20) /* 1 */ |
Bit aligned values for Host Protocol Interface IDs (Bits 5-6). More... | |
#define | HOST_PRO_INT_ISO_TAG (0x40) /* 2 */ |
#define | HOST_PRO_INT_DEV_TAG (0x60) /* 3 */ |
#define | HOST_PRO_CMD_X_RES_TAG (0x00) /* 0 (Reserved) */ |
Bit aligned values for Host Protocol Command Interface Type IDs (Bits 0-4). More... | |
#define | HOST_PRO_CMD_W_CFG_TAG (0x01) /* 1 */ |
#define | HOST_PRO_CMD_R_CFG_TAG (0x02) /* 2 */ |
#define | HOST_PRO_CMD_W_REG_TAG (0x03) /* 3 */ |
#define | HOST_PRO_CMD_R_REG_TAG (0x04) /* 4 */ |
#define | HOST_PRO_CMD_WR_NAK_TAG (0x7F) /* 0 */ |
Bit aligned values for Host Protocol Command Interface Status IDs (Bit 7). More... | |
#define | HOST_PRO_CMD_WR_ACK_TAG (0x80) /* 1 */ |
Typedefs | |
typedef 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, [IN/OUT]MessageSize, [IN]BufferSize) More... | |
Enumerations | |
enum | { HOST_FORMAT_HDLC = 0, HOST_FORMAT_JSON, HOST_FORMAT_PLAIN } |
enum | { HOST_MSG_HDR_TAG_OFFSET = 0, HOST_MSG_HDR_SEQ_OFFSET = 1, HOST_MSG_LEN_MSB_OFFSET = 2, HOST_MSG_LEN_LSB_OFFSET = 3, HOST_MSG_CMD_OPC_OFFSET = 4, HOST_MSG_CMD_ACT_OFFSET = 5, HOST_DEV_HDR_VER_OFFSET = 1, HOST_DEV_LEN_STR_OFFSET = 2, HOST_ISO_LEN_MSB_OFFSET = 1, HOST_ISO_LEN_LSB_OFFSET = 2, HOST_ISO_PAYLOAD_OFFSET = 3, HOST_MSG_CMD_SLAVE_ADDR_OFFSET = 4, HOST_MSG_CMD_REGIS_ADDR_OFFSET = 5, HOST_MSG_CMD_VALUE_OFFSET = 6, HOST_MSG_CMD_LENGTH_OFFSET = 6 } |
enum | { HOST_CMD_NOP = 0, HOST_CMD_START, HOST_CMD_STOP, HOST_CMD_FLASH_START, HOST_CMD_FLASH_BYTES, HOST_CMD_FLASH_STOP } |
This enum lists the Configuration Command Operation Codes. More... | |
Functions | |
void | HOST_SignalEvent_t (uint32_t event) |
Defines the HOST UART signal event handler. More... | |
void | Host_IO_Add_ISO_Header (uint8_t streamID, uint8_t *pStreamingPacket, size_t sizePayload) |
uint8_t | Host_IO_Init (ARM_DRIVER_USART *pDrv, void *pBus, void *pDevInfo, void *spiSlaveParams, uint16_t slaveAddress) |
void | Host_IO_Send (uint8_t *pMsg, size_t size, uint8_t encoding) |
void | Host_IO_Receive (host_cmd_proc_fn_t process_host_command, uint8_t encoding) |
The host_io_uart.h file contains the Host Protocol interface definitions and configuration.
Definition in file host_io_uart.h.
#define EVENT_STREAM_ID (0xFF) /* Stream ID in ISO Message for posting Events (such as freefall) */ |
Definition at line 33 of file host_io_uart.h.
Referenced by main().
#define HOST_CMD_RESP_ACK (0x80) /* HOST CMD Ack code. */ |
Definition at line 31 of file host_io_uart.h.
#define HOST_CMD_RESP_NACK (0xC6) /* HOST CMD Nack code. */ |
Definition at line 32 of file host_io_uart.h.
#define HOST_CMD_RSP_LEN (64) /* MAX size of Host Command Response. */ |
Definition at line 29 of file host_io_uart.h.
Referenced by Host_IO_Receive().
#define HOST_DEV_RSP_LEN (128) /* MAX size of Host Dev Info Response. */ |
Definition at line 28 of file host_io_uart.h.
Referenced by Host_IO_Receive().
#define HOST_PRO_CMD_R_CFG_TAG (0x02) /* 2 */ |
Definition at line 64 of file host_io_uart.h.
#define HOST_PRO_CMD_R_REG_TAG (0x04) /* 4 */ |
Definition at line 66 of file host_io_uart.h.
Referenced by Host_IO_Receive(), and process_host_command().
#define HOST_PRO_CMD_W_CFG_TAG (0x01) /* 1 */ |
Definition at line 63 of file host_io_uart.h.
Referenced by process_host_command().
#define HOST_PRO_CMD_W_REG_TAG (0x03) /* 3 */ |
Definition at line 65 of file host_io_uart.h.
Referenced by Host_IO_Receive(), and process_host_command().
#define HOST_PRO_CMD_WR_ACK_TAG (0x80) /* 1 */ |
Definition at line 70 of file host_io_uart.h.
Referenced by Host_IO_Receive().
#define HOST_PRO_CMD_WR_NAK_TAG (0x7F) /* 0 */ |
Bit aligned values for Host Protocol Command Interface Status IDs (Bit 7).
Definition at line 69 of file host_io_uart.h.
Referenced by Host_IO_Receive().
#define HOST_PRO_CMD_X_RES_TAG (0x00) /* 0 (Reserved) */ |
Bit aligned values for Host Protocol Command Interface Type IDs (Bits 0-4).
Definition at line 62 of file host_io_uart.h.
#define HOST_PRO_INT_CMD_TAG (0x20) /* 1 */ |
Bit aligned values for Host Protocol Interface IDs (Bits 5-6).
Definition at line 57 of file host_io_uart.h.
Referenced by Host_IO_Receive(), and process_host_command().
#define HOST_PRO_INT_DEV_TAG (0x60) /* 3 */ |
Definition at line 59 of file host_io_uart.h.
Referenced by Host_IO_Receive(), and process_host_command().
#define HOST_PRO_INT_ISO_TAG (0x40) /* 2 */ |
Definition at line 58 of file host_io_uart.h.
Referenced by Host_IO_Add_ISO_Header(), and Host_IO_Receive().
#define HOST_RSP_HDR_LEN (4) /* Size of Host response message header. */ |
Definition at line 27 of file host_io_uart.h.
Referenced by Host_IO_Receive().
#define HOST_RX_BUF_LEN (64) /* MAX size of Rx Host CMDs. */ |
Definition at line 26 of file host_io_uart.h.
#define MAX_HOST_STREAMS (4) /* Max Streams that can be defined by the user Application. */ |
Definition at line 30 of file host_io_uart.h.
Referenced by getSlaveIndex(), and Host_IO_Init().
#define STREAMING_HEADER_LEN (4) /* ISSDK Host Protocol defined Iso Cmd Header Length + Stream ID. */ |
Definition at line 25 of file host_io_uart.h.
Referenced by main(), and process_host_command().
typedef 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, [IN/OUT]MessageSize, [IN]BufferSize)
Definition at line 46 of file host_io_uart.h.
anonymous enum |
Enumerator | |
---|---|
HOST_FORMAT_HDLC | |
HOST_FORMAT_JSON | |
HOST_FORMAT_PLAIN |
Definition at line 72 of file host_io_uart.h.
anonymous enum |
Definition at line 79 of file host_io_uart.h.
anonymous enum |
This enum lists the Configuration Command Operation Codes.
Enumerator | |
---|---|
HOST_CMD_NOP | |
HOST_CMD_START | |
HOST_CMD_STOP | |
HOST_CMD_FLASH_START | |
HOST_CMD_FLASH_BYTES | |
HOST_CMD_FLASH_STOP |
Definition at line 99 of file host_io_uart.h.
void Host_IO_Add_ISO_Header | ( | uint8_t | streamID, |
uint8_t * | pStreamingPacket, | ||
size_t | sizePayload | ||
) |
Definition at line 86 of file host_io_uart.c.
References HOST_ISO_LEN_LSB_OFFSET, HOST_ISO_LEN_MSB_OFFSET, HOST_ISO_PAYLOAD_OFFSET, HOST_MSG_HDR_TAG_OFFSET, and HOST_PRO_INT_ISO_TAG.
Referenced by main().
uint8_t Host_IO_Init | ( | ARM_DRIVER_USART * | pDrv, |
void * | pBus, | ||
void * | pDevInfo, | ||
void * | spiSlaveParams, | ||
uint16_t | slaveAddress | ||
) |
Definition at line 100 of file host_io_uart.c.
References bUartErrorMsg, bUartRxPendingMsg, bUartTxComplete, COMM_NONBLOCKING, COMM_UART, _host_interface_handle_::commHandle, host_channel_params_t::deviceInfo, gUartRxBuff, HOST_Initialize(), HOST_Receive(), HOST_SignalEvent_t(), MAX_HOST_STREAMS, _comm_handle_::pComm, host_channel_params_t::pCommDrv, _host_interface_handle_::pCommInterface, host_channel_params_t::pSPIparams, and host_channel_params_t::slaveAddress.
Referenced by main().
void Host_IO_Receive | ( | host_cmd_proc_fn_t | process_host_command, |
uint8_t | encoding | ||
) |
Definition at line 207 of file host_io_uart.c.
References bUartErrorMsg, bUartRxPendingMsg, _comm_control_::control, getSlaveIndex(), gHostRxBuff, gUartRxBuff, HDLC_Process_Rx_Byte(), HOST_CMD_RSP_LEN, HOST_Configure(), HOST_DEV_HDR_VER_OFFSET, HOST_DEV_LEN_STR_OFFSET, HOST_DEV_RSP_LEN, HOST_FORMAT_HDLC, HOST_FORMAT_JSON, HOST_INTERFACE_VERSION, Host_IO_Send(), HOST_ISO_LEN_LSB_OFFSET, HOST_ISO_LEN_MSB_OFFSET, HOST_ISO_PAYLOAD_OFFSET, HOST_MSG_CMD_LENGTH_OFFSET, HOST_MSG_CMD_OPC_OFFSET, HOST_MSG_CMD_REGIS_ADDR_OFFSET, HOST_MSG_CMD_SLAVE_ADDR_OFFSET, HOST_MSG_CMD_VALUE_OFFSET, HOST_MSG_HDR_SEQ_OFFSET, HOST_MSG_HDR_TAG_OFFSET, HOST_MSG_LEN_LSB_OFFSET, HOST_MSG_LEN_MSB_OFFSET, HOST_PRO_CMD_R_REG_TAG, HOST_PRO_CMD_W_REG_TAG, HOST_PRO_CMD_WR_ACK_TAG, HOST_PRO_CMD_WR_NAK_TAG, HOST_PRO_INT_CMD_TAG, HOST_PRO_INT_DEV_TAG, HOST_PRO_INT_ISO_TAG, HOST_Receive(), HOST_RSP_HDR_LEN, int32_t(), JSON_Process_Rx_Byte(), host_rx_packet_t::mIndex, process_host_command(), Register_I2C_BlockWrite(), Register_I2C_Read(), Register_SPI_BlockWrite(), Register_SPI_Read(), and status.
Referenced by main().
void Host_IO_Send | ( | uint8_t * | pMsg, |
size_t | size, | ||
uint8_t | encoding | ||
) |
Definition at line 136 of file host_io_uart.c.
References bUartTxComplete, HDLC_Process_Tx_Msg(), HOST_FORMAT_HDLC, HOST_FORMAT_JSON, HOST_FORMAT_PLAIN, HOST_Send(), and JSON_Process_Tx_Msg().
Referenced by Host_IO_Receive(), main(), and process_host_command().
void HOST_SignalEvent_t | ( | uint32_t | event | ) |
Defines the HOST UART signal event handler.
The Signal Event Handler function required by host_io_uart.c.
[in] | event | The UART event that occured. |
Definition at line 47 of file host_io_uart.c.
References bUartErrorMsg, bUartRxPendingMsg, and bUartTxComplete.
Referenced by Host_IO_Init().