ISSDK  1.7
IoT Sensing Software Development Kit
Data Structures | Macros | Typedefs | Enumerations | Functions
host_io_uart.h File Reference

The host_io_uart.h file contains the Host Protocol interface definitions and configuration. More...

#include "Driver_USART.h"
Include dependency graph for host_io_uart.h:
This graph shows which files directly or indirectly include this file:

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)
 

Detailed Description

The host_io_uart.h file contains the Host Protocol interface definitions and configuration.

Definition in file host_io_uart.h.

Macro Definition Documentation

◆ EVENT_STREAM_ID

#define EVENT_STREAM_ID   (0xFF) /* Stream ID in ISO Message for posting Events (such as freefall) */

Definition at line 59 of file host_io_uart.h.

Referenced by main().

◆ HOST_CMD_RESP_ACK

#define HOST_CMD_RESP_ACK   (0x80) /* HOST CMD Ack code. */

Definition at line 57 of file host_io_uart.h.

◆ HOST_CMD_RESP_NACK

#define HOST_CMD_RESP_NACK   (0xC6) /* HOST CMD Nack code. */

Definition at line 58 of file host_io_uart.h.

◆ HOST_CMD_RSP_LEN

#define HOST_CMD_RSP_LEN   (64) /* MAX size of Host Command Response. */

Definition at line 55 of file host_io_uart.h.

Referenced by Host_IO_Receive().

◆ HOST_DEV_RSP_LEN

#define HOST_DEV_RSP_LEN   (128) /* MAX size of Host Dev Info Response. */

Definition at line 54 of file host_io_uart.h.

Referenced by Host_IO_Receive().

◆ HOST_PRO_CMD_R_CFG_TAG

#define HOST_PRO_CMD_R_CFG_TAG   (0x02) /* 2 */

Definition at line 90 of file host_io_uart.h.

◆ HOST_PRO_CMD_R_REG_TAG

#define HOST_PRO_CMD_R_REG_TAG   (0x04) /* 4 */

Definition at line 92 of file host_io_uart.h.

Referenced by Host_IO_Receive(), and process_host_command().

◆ HOST_PRO_CMD_W_CFG_TAG

#define HOST_PRO_CMD_W_CFG_TAG   (0x01) /* 1 */

Definition at line 89 of file host_io_uart.h.

Referenced by process_host_command().

◆ HOST_PRO_CMD_W_REG_TAG

#define HOST_PRO_CMD_W_REG_TAG   (0x03) /* 3 */

Definition at line 91 of file host_io_uart.h.

Referenced by Host_IO_Receive(), and process_host_command().

◆ HOST_PRO_CMD_WR_ACK_TAG

#define HOST_PRO_CMD_WR_ACK_TAG   (0x80) /* 1 */

Definition at line 96 of file host_io_uart.h.

Referenced by Host_IO_Receive().

◆ HOST_PRO_CMD_WR_NAK_TAG

#define HOST_PRO_CMD_WR_NAK_TAG   (0x7F) /* 0 */

Bit aligned values for Host Protocol Command Interface Status IDs (Bit 7).

Definition at line 95 of file host_io_uart.h.

Referenced by Host_IO_Receive().

◆ HOST_PRO_CMD_X_RES_TAG

#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 88 of file host_io_uart.h.

◆ HOST_PRO_INT_CMD_TAG

#define HOST_PRO_INT_CMD_TAG   (0x20) /* 1 */

Bit aligned values for Host Protocol Interface IDs (Bits 5-6).

Definition at line 83 of file host_io_uart.h.

Referenced by Host_IO_Receive(), and process_host_command().

◆ HOST_PRO_INT_DEV_TAG

#define HOST_PRO_INT_DEV_TAG   (0x60) /* 3 */

Definition at line 85 of file host_io_uart.h.

Referenced by Host_IO_Receive(), and process_host_command().

◆ HOST_PRO_INT_ISO_TAG

#define HOST_PRO_INT_ISO_TAG   (0x40) /* 2 */

Definition at line 84 of file host_io_uart.h.

Referenced by Host_IO_Add_ISO_Header(), and Host_IO_Receive().

◆ HOST_RSP_HDR_LEN

#define HOST_RSP_HDR_LEN   (4) /* Size of Host response message header. */

Definition at line 53 of file host_io_uart.h.

Referenced by Host_IO_Receive().

◆ HOST_RX_BUF_LEN

#define HOST_RX_BUF_LEN   (64) /* MAX size of Rx Host CMDs. */

Definition at line 52 of file host_io_uart.h.

◆ MAX_HOST_STREAMS

#define MAX_HOST_STREAMS   (4) /* Max Streams that can be defined by the user Application. */

Definition at line 56 of file host_io_uart.h.

Referenced by getSlaveIndex(), and Host_IO_Init().

◆ STREAMING_HEADER_LEN

#define STREAMING_HEADER_LEN   (4) /* ISSDK Host Protocol defined Iso Cmd Header Length + Stream ID. */

Definition at line 51 of file host_io_uart.h.

Referenced by main(), and process_host_command().

Typedef Documentation

◆ host_cmd_proc_fn_t

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 72 of file host_io_uart.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
HOST_FORMAT_HDLC 
HOST_FORMAT_JSON 
HOST_FORMAT_PLAIN 

Definition at line 98 of file host_io_uart.h.

◆ anonymous enum

anonymous enum
Enumerator
HOST_MSG_HDR_TAG_OFFSET 
HOST_MSG_HDR_SEQ_OFFSET 
HOST_MSG_LEN_MSB_OFFSET 
HOST_MSG_LEN_LSB_OFFSET 
HOST_MSG_CMD_OPC_OFFSET 
HOST_MSG_CMD_ACT_OFFSET 
HOST_DEV_HDR_VER_OFFSET 
HOST_DEV_LEN_STR_OFFSET 
HOST_ISO_LEN_MSB_OFFSET 
HOST_ISO_LEN_LSB_OFFSET 
HOST_ISO_PAYLOAD_OFFSET 
HOST_MSG_CMD_SLAVE_ADDR_OFFSET 
HOST_MSG_CMD_REGIS_ADDR_OFFSET 
HOST_MSG_CMD_VALUE_OFFSET 
HOST_MSG_CMD_LENGTH_OFFSET 

Definition at line 105 of file host_io_uart.h.

◆ anonymous enum

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 125 of file host_io_uart.h.

Function Documentation

◆ Host_IO_Add_ISO_Header()

void Host_IO_Add_ISO_Header ( uint8_t  streamID,
uint8_t *  pStreamingPacket,
size_t  sizePayload 
)

Definition at line 112 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().

Here is the caller graph for this function:

◆ Host_IO_Init()

uint8_t Host_IO_Init ( ARM_DRIVER_USART *  pDrv,
void *  pBus,
void *  pDevInfo,
void *  spiSlaveParams,
uint16_t  slaveAddress 
)

◆ Host_IO_Receive()

void Host_IO_Receive ( host_cmd_proc_fn_t  process_host_command,
uint8_t  encoding 
)

◆ Host_IO_Send()

void Host_IO_Send ( uint8_t *  pMsg,
size_t  size,
uint8_t  encoding 
)

Definition at line 162 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HOST_SignalEvent_t()

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.

Parameters
[in]eventThe UART event that occured.
Constraints:
None
Reentrant: Yes
Returns
void

Definition at line 73 of file host_io_uart.c.

References bUartErrorMsg, bUartRxPendingMsg, and bUartTxComplete.

Referenced by Host_IO_Init().

Here is the caller graph for this function: