ISF  2.1
Intelligent Sensing Framework for Kinetis with Processor Expert
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ci_protocol_stream.h File Reference

Command Interpreter (CI) stream protocol header file. More...

#include "isf_target.h"
#include "isf.h"
#include "isf_ci_stream.h"
Include dependency graph for ci_protocol_stream.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ci_stream_ctrl_reg1_t
 Stream protocol control register 1 Structure. More...
 
struct  ci_stream_regs_t
 Stream protocol registers Structure. Contains stream protocol control registers. More...
 

Macros

#define CI_STREAM_PROTOCOL_ID_BYTESIZE   (sizeof(uint8))
 Defines the number of bytes to store the protocol ID. More...
 
#define CI_STREAM_OUTPUTPACKET_STREAMID_BYTESIZE   (sizeof(uint8))
 Defines the number of bytes to store the stream ID. More...
 
#define CI_STREAM_DATASET_ID_BYTESIZE   (sizeof(uint8))
 Defines the number of bytes to store the data set ID. More...
 
#define CI_STREAM_OUTPUTPACKET_LENGTH_BYTESIZE   (sizeof(uint16))
 Defines the number of bytes to store the length of the output packet data. More...
 
#define CI_STREAM_NUMELEMENTS_BYTESIZE   (sizeof(uint8))
 Defines the number of bytes to specify the number of elements. More...
 
#define STREAM_CRC_BYTESIZE   (sizeof(uint16))
 Defines the number of bytes for 16-bit CRC value. More...
 
#define STREAM_PROTOCOL_CMD_BYTESIZE   (1)
 Defines the number of bytes for host command. More...
 
#define STREAM_PROTOCOL_CMD_STATUS_BYTESIZE   (1)
 Defines the number of bytes for command status. More...
 
#define STREAM_PROTOCOL_RECV_MIN_BYTESIZE   (STREAM_PROTOCOL_CMD_BYTESIZE)
 Defines the minimum number of bytes of a received host packet. More...
 
#define STREAM_PROTOCOL_SUBCMD_BYTESIZE   (1)
 Defines the number of bytes for host subcommand. More...
 
#define STREAM_PROTOCOL_RESP_MIN_BYTESIZE   (3)
 Defines the minimum number of response bytes to the host not including CRC. Do not add CRC bytes into this number as CRC byte number is added dynamically dedpending on whether host has enabled CRC or not. More...
 
#define STREAM_PROTOCOL_RESP_RESPDATALENGTH_BYTESIZE   (2)
 Defines the number of bytes to store the length of the response data. If there are no response data, then the data length bytes are not included in the response packet. More...
 
#define STREAM_PROTOCOL_RESP_DEFAULT_ARRAY_BYTESIZE
 Defines the fixed array size of the response buffer array. The size specified is sufficient for most commands. If a larger size is required, a dynamically allocated buffer is used. More...
 
#define STREAM_PROTOCOL_RESP_INDEX_PROTOCOLID   (0)
 Defines the indexes of the command response array to the host. More...
 
#define STREAM_PROTOCOL_RESP_INDEX_COCO_STAT   (1)
 
#define STREAM_PROTOCOL_RESP_INDEX_CMD_ECHO   (2)
 
#define STREAM_PROTOCOL_RESP_INDEX_NUMDATA_MSB   (3)
 
#define STREAM_PROTOCOL_RESP_INDEX_NUMDATA_LSB   (4)
 
#define STREAM_PROTOCOL_RESP_INDEX_DATASTART   (5)
 
#define STREAM_PROTOCOL_OUTPUTPACKET_INDEX_PROTOCOLID   (0)
 Defines the indexes of the stream data update buffer (output packet). More...
 
#define STREAM_PROTOCOL_OUTPUTPACKET_INDEX_COCO_STAT   (1)
 
#define STREAM_PROTOCOL_OUTPUTPACKET_INDEX_STREAMID   (2)
 
#define STREAM_PROTOCOL_OUTPUTPACKET_INDEX_LENGTH_MSB   (3)
 
#define STREAM_PROTOCOL_OUTPUTPACKET_INDEX_LENGTH_LSB   (4)
 
#define STREAM_COCO_BIT   (7)
 STREAM COCO bit position and mask. More...
 
#define STREAM_COCO_BIT_MASK   (1 << STREAM_COCO_BIT)
 
#define STREAM_PROTOCOL_DATA_ENABLED   (1)
 Stream protocol control: enable/disable data update. More...
 
#define STREAM_PROTOCOL_DATA_DISABLED   (0)
 
#define ci_stream_get_host_cmd(pSrc)   (pSrc[0] & 0xFF)
 Macros to access buffer received from host. More...
 
#define ci_stream_get_host_data(pSrc)   (pSrc[1])
 
#define cmd_createstream_get_streamID(pSrc)   (pSrc[0])
 
#define cmd_createstream_get_numelements(pSrc)   (pSrc[1])
 
#define cmd_createstream_get_trigmask_ptr(pSrc)   (&pSrc[2])
 

Functions

struct __attribute__ ((__packed__)) _ci_stream_instance
 This structure contains the stream configuration information. More...
 

Variables

 ci_stream_instance_t
 

Detailed Description

Command Interpreter (CI) stream protocol header file.

Definition in file ci_protocol_stream.h.

Macro Definition Documentation

#define CI_STREAM_DATASET_ID_BYTESIZE   (sizeof(uint8))

Defines the number of bytes to store the data set ID.

Definition at line 30 of file ci_protocol_stream.h.

Referenced by isf_ci_stream_update_data().

#define ci_stream_get_host_cmd (   pSrc)    (pSrc[0] & 0xFF)

Macros to access buffer received from host.

Definition at line 163 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define ci_stream_get_host_data (   pSrc)    (pSrc[1])

Definition at line 164 of file ci_protocol_stream.h.

#define CI_STREAM_NUMELEMENTS_BYTESIZE   (sizeof(uint8))

Defines the number of bytes to specify the number of elements.

Definition at line 36 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define CI_STREAM_OUTPUTPACKET_LENGTH_BYTESIZE   (sizeof(uint16))

Defines the number of bytes to store the length of the output packet data.

Definition at line 33 of file ci_protocol_stream.h.

Referenced by isf_ci_stream_update_data().

#define CI_STREAM_OUTPUTPACKET_STREAMID_BYTESIZE   (sizeof(uint8))

Defines the number of bytes to store the stream ID.

Definition at line 27 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream(), and isf_ci_stream_update_data().

#define CI_STREAM_PROTOCOL_ID_BYTESIZE   (sizeof(uint8))

Defines the number of bytes to store the protocol ID.

Definition at line 24 of file ci_protocol_stream.h.

Referenced by isf_ci_stream_update_data().

#define cmd_createstream_get_numelements (   pSrc)    (pSrc[1])

Definition at line 171 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define cmd_createstream_get_streamID (   pSrc)    (pSrc[0])

@ brief Macros to access parameters for: CI_CMD_STREAM_CREATE_STREAM

Definition at line 170 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define cmd_createstream_get_trigmask_ptr (   pSrc)    (&pSrc[2])

Definition at line 172 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define STREAM_COCO_BIT   (7)

STREAM COCO bit position and mask.

Definition at line 153 of file ci_protocol_stream.h.

#define STREAM_COCO_BIT_MASK   (1 << STREAM_COCO_BIT)

Definition at line 154 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream(), and isf_ci_stream_create().

#define STREAM_CRC_BYTESIZE   (sizeof(uint16))

Defines the number of bytes for 16-bit CRC value.

Definition at line 39 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream(), isf_ci_stream_create(), and isf_ci_stream_update_data().

#define STREAM_PROTOCOL_CMD_BYTESIZE   (1)

Defines the number of bytes for host command.

Definition at line 48 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define STREAM_PROTOCOL_CMD_STATUS_BYTESIZE   (1)

Defines the number of bytes for command status.

Definition at line 51 of file ci_protocol_stream.h.

Referenced by isf_ci_stream_update_data().

#define STREAM_PROTOCOL_DATA_DISABLED   (0)

Definition at line 159 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define STREAM_PROTOCOL_DATA_ENABLED   (1)

Stream protocol control: enable/disable data update.

Definition at line 158 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream(), and isf_ci_stream_update_data().

#define STREAM_PROTOCOL_OUTPUTPACKET_INDEX_COCO_STAT   (1)

Definition at line 145 of file ci_protocol_stream.h.

Referenced by isf_ci_stream_create().

#define STREAM_PROTOCOL_OUTPUTPACKET_INDEX_LENGTH_LSB   (4)

Definition at line 148 of file ci_protocol_stream.h.

Referenced by isf_ci_stream_create(), and isf_ci_stream_update_data().

#define STREAM_PROTOCOL_OUTPUTPACKET_INDEX_LENGTH_MSB   (3)

Definition at line 147 of file ci_protocol_stream.h.

Referenced by isf_ci_stream_create(), and isf_ci_stream_update_data().

#define STREAM_PROTOCOL_OUTPUTPACKET_INDEX_PROTOCOLID   (0)

Defines the indexes of the stream data update buffer (output packet).

The stream data update packet contains the following:

  • 1 byte, stream protocol ID (not to be confused with the stream ID)

1 byte, COCO/status byte

  • 1 byte, stream ID
  • 2 bytes, data length (dataset ID / data)

Note that the data length specifies the number of bytes of the output format which contains the dataset ID followed by the number of bytes for that dataset. There could be multiple number of datasets per stream.

Definition at line 144 of file ci_protocol_stream.h.

Referenced by isf_ci_stream_create().

#define STREAM_PROTOCOL_OUTPUTPACKET_INDEX_STREAMID   (2)

Definition at line 146 of file ci_protocol_stream.h.

Referenced by isf_ci_stream_create().

#define STREAM_PROTOCOL_RECV_MIN_BYTESIZE   (STREAM_PROTOCOL_CMD_BYTESIZE)

Defines the minimum number of bytes of a received host packet.

Definition at line 54 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define STREAM_PROTOCOL_RESP_DEFAULT_ARRAY_BYTESIZE
Value:
( \
+ 16)
#define STREAM_PROTOCOL_RESP_RESPDATALENGTH_BYTESIZE
Defines the number of bytes to store the length of the response data. If there are no response data...
#define STREAM_PROTOCOL_RESP_MIN_BYTESIZE
Defines the minimum number of response bytes to the host not including CRC. Do not add CRC bytes into...

Defines the fixed array size of the response buffer array. The size specified is sufficient for most commands. If a larger size is required, a dynamically allocated buffer is used.

The typical size of the default response array needs to be set to accommodate:

STREAM_PROTOCOL_RESP_MIN_BYTESIZE - minimum response data size STREAM_PROTOCOL_RESP_RESPDATALENGTH_BYTESIZE - needed if there is response data Response data - in most cases one byte. The host command to get trigger bytes uses the default buffer. In this case the number of trigger bytes will be no more than several bytes.

Currently, the only command that requires a dynamically allocated buffer is the CI_CMD_STREAM_GETINFO_STREAM_CONFIG command.

Definition at line 98 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define STREAM_PROTOCOL_RESP_INDEX_CMD_ECHO   (2)

Definition at line 121 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define STREAM_PROTOCOL_RESP_INDEX_COCO_STAT   (1)

Definition at line 120 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define STREAM_PROTOCOL_RESP_INDEX_DATASTART   (5)

Definition at line 124 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define STREAM_PROTOCOL_RESP_INDEX_NUMDATA_LSB   (4)

Definition at line 123 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define STREAM_PROTOCOL_RESP_INDEX_NUMDATA_MSB   (3)

Definition at line 122 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define STREAM_PROTOCOL_RESP_INDEX_PROTOCOLID   (0)

Defines the indexes of the command response array to the host.

The minimum command response packet contains the following:

  • 1 byte, stream protocol ID (not to be confused with the stream ID)
  • 1 byte, COCO/status byte
  • 1 byte, echo of the command that this response corresponds to.

If the response contains returning data, the response packet contains the data bytes following:

  • 2 bytes, length of the data in bytes, msb first
  • X bytes, the data bytes

Definition at line 119 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define STREAM_PROTOCOL_RESP_MIN_BYTESIZE   (3)

Defines the minimum number of response bytes to the host not including CRC. Do not add CRC bytes into this number as CRC byte number is added dynamically dedpending on whether host has enabled CRC or not.

The minimum response data are:

1 byte: Stream protocol ID 1 byte: Status byte, Command Complete (COCO) bit and 7-bit status 1 byte: Echo of host command

Definition at line 72 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define STREAM_PROTOCOL_RESP_RESPDATALENGTH_BYTESIZE   (2)

Defines the number of bytes to store the length of the response data. If there are no response data, then the data length bytes are not included in the response packet.

Definition at line 79 of file ci_protocol_stream.h.

Referenced by ci_protocol_CB_stream().

#define STREAM_PROTOCOL_SUBCMD_BYTESIZE   (1)

Defines the number of bytes for host subcommand.

Definition at line 57 of file ci_protocol_stream.h.

Function Documentation

struct __attribute__ ( (__packed__)  )

This structure contains the stream configuration information.

The stream configuration structure contains information about the stream that includes the stream ID, number of elements, trigger masks, and element list.

Stream ID

Number of elements

Buffer containing the trigger mask bytes

Buffer containing the element list

Definition at line 219 of file ci_protocol_stream.h.

References ci_stream_config_t.

Variable Documentation

Definition at line 243 of file ci_protocol_stream.h.

Referenced by isf_ci_stream_create().