ISF  2.2 rev 5
Intelligent Sensing Framework for Kinetis with Processor Expert
isf_ci_stream.h File Reference

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

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

Go to the source code of this file.

Macros

#define CI_STATUS_STREAM_SPECIFIC_STATUS   (0xBF)
 These are the CI stream protocol errors provided to the host. More...
 
#define CI_STATUS_STREAM_SPECIFIC_ERROR   (0x40)
 
#define STREAM_CRC_ENABLED   (1)
 Stream control: enable/disable CRC generation/checking. More...
 
#define STREAM_CRC_DISABLED   (0)
 

Enumerations

enum  ci_commands_stream_enum {
  CI_CMD_STREAM_RESET = 0, CI_CMD_STREAM_ENABLE_DATA_UPDATE = 1, CI_CMD_STREAM_DISABLE_DATA_UPDATE = 2, CI_CMD_STREAM_CREATE_STREAM = 3,
  CI_CMD_STREAM_DELETE_STREAM = 4, CI_CMD_STREAM_RESET_TRIGGER = 5, CI_CMD_STREAM_ENABLE_CRC = 6, CI_CMD_STREAM_DISABLE_CRC = 7,
  CI_CMD_STREAM_GETINFO_NUMBER_STREAMS = 8, CI_CMD_STREAM_GETINFO_TRIGGER_STATE = 9, CI_CMD_STREAM_GETINFO_STREAM_CONFIG = 10, CI_CMD_STREAM_GETINFO_GET_FIRST_STREAMID = 11,
  CI_CMD_STREAM_GETINFO_GET_NEXT_STREAMID = 12, CI_CMD_STREAM_MAX = 12
}
 CI host stream command. More...
 
enum  ci_response_stream_enum {
  CI_STATUS_STREAM_SUCCESS = ISF_SUCCESS, CI_STATUS_STREAM_ERR = 1, CI_STATUS_STREAM_DATA_UPDATE = (2 & CI_STATUS_STREAM_SPECIFIC_STATUS), CI_STATUS_STREAM_DATASETID_NOTUSED = (3 & CI_STATUS_STREAM_SPECIFIC_STATUS),
  CI_STATUS_STREAM_STREAM_END_OF_LIST = (4 & CI_STATUS_STREAM_SPECIFIC_STATUS), CI_STATUS_STREAM_ERR_INVALID_CMD = (0 | CI_STATUS_STREAM_SPECIFIC_ERROR), CI_STATUS_STREAM_ERR_INVALID_PARM = (1 | CI_STATUS_STREAM_SPECIFIC_ERROR), CI_STATUS_STREAM_ERR_INVALID_NUM_PARM = (2 | CI_STATUS_STREAM_SPECIFIC_ERROR),
  CI_STATUS_STREAM_ERR_STREAM_NOEXISTS = (3 | CI_STATUS_STREAM_SPECIFIC_ERROR), CI_STATUS_STREAM_ERR_NULL_POINTER = (4 | CI_STATUS_STREAM_SPECIFIC_ERROR), CI_STATUS_STREAM_ERR_STREAMID_NOEXISTS = (5 | CI_STATUS_STREAM_SPECIFIC_ERROR), CI_STATUS_STREAM_ERR_STREAMID_EXISTS = (6 | CI_STATUS_STREAM_SPECIFIC_ERROR),
  CI_STATUS_STREAM_ERR_DATASETID_NOEXISTS = (7 | CI_STATUS_STREAM_SPECIFIC_ERROR), CI_STATUS_STREAM_ERR_DATASETID_EXISTS = (8 | CI_STATUS_STREAM_SPECIFIC_ERROR), CI_STATUS_STREAM_ERR_DATASET_LENGTH_INVALID = (9 | CI_STATUS_STREAM_SPECIFIC_ERROR), CI_STATUS_STREAM_ERR_NUMELEMENTS_INVALID = (10 | CI_STATUS_STREAM_SPECIFIC_ERROR),
  CI_STATUS_STREAM_ERR_OUT_OF_MEMORY = (11 | CI_STATUS_STREAM_SPECIFIC_ERROR), CI_STATUS_STREAM_ERR_SENDDATA_TO_HOST = (12 | CI_STATUS_STREAM_SPECIFIC_ERROR), CI_STATUS_STREAM_ERR_CRC = (13 | CI_STATUS_STREAM_SPECIFIC_ERROR), CI_STATUS_STREAM_MAX = 0x7F
}
 

Functions

struct __attribute__ ((__packed__)) _ci_stream_element
 This structure contains the stream element information. More...
 
isf_status_t isf_ci_stream_create (uint8 aStreamID, uint8 aNumElements, uint8 *apTriggerMask, ci_stream_element_t *apElementList)
 This API creates a stream. More...
 
isf_status_t isf_ci_stream_update_data (uint8 aDataSetID, uint16 aLength, uint16 aOffset, uint8 *apSrc)
 This API updates the data of a dataset. More...
 
isf_status_t isf_ci_stream_delete (uint8 aStreamID)
 This API deletes the given stream ID. More...
 
isf_status_t isf_ci_stream_reset_trigger (uint8 aStreamID)
 This API resets the trigger bits of the the given stream ID. More...
 
ci_stream_config_tisf_ci_stream_get_config (uint8 aStreamID)
 This API gets the stream configuration of the specified stream ID. More...
 
isf_status_t isf_ci_stream_get_trigger (uint8 aStreamID, uint8 *apTrigger)
 This API returns the trigger state of the given stream ID. More...
 
uint8 isf_ci_stream_get_num_streams (void)
 This API returns the number of streams. More...
 
ci_stream_config_tisf_ci_stream_get_first (void)
 This API returns the configuration of the first stream in the linked list. More...
 
ci_stream_config_tisf_ci_stream_get_next (void)
 This API returns the configuration of the next stream in the linked list. More...
 
void isf_ci_stream_set_CRC (boolean acrcEnable)
 This API sets the cyclic redundancy check (CRC) code generation to the requested state. More...
 
isf_status_t ci_stream_init (uint8 aprotocolID, void *apInitData)
 This is a CI stream protocol intialization callback function pointer. More...
 
isf_status_t ci_protocol_CB_stream (uint32 anumBytes, uint8 *apSrc, uint32 *apnumDestBytes, uint8 *apDest)
 This is a CI stream protocol callback function pointer. More...
 
void isf_ci_stream_set_stream_enable ()
 This API enables data stream. More...
 
void isf_ci_stream_set_stream_disable ()
 This API disables data stream. More...
 

Variables

 ci_stream_element_t
 
 ci_stream_config_t
 

Detailed Description

ISF Command Interpreter (CI) stream protocol header file.

Definition in file isf_ci_stream.h.

Macro Definition Documentation

#define CI_STATUS_STREAM_SPECIFIC_ERROR   (0x40)

Definition at line 93 of file isf_ci_stream.h.

#define CI_STATUS_STREAM_SPECIFIC_STATUS   (0xBF)

These are the CI stream protocol errors provided to the host.

Any errors identified by the stream protocol are returned to the host. These errors may be passed back to the host from the application. There are 7 bits allocated to contain error status resulting in 128 possible different status values.

Bit6 of the status byte is used to indicate error condition. If bit6 = 1, then the value in bit0-5 contains the specific error condition. If bit6 = 0, then the value in bit0-5 contains the specific status.

Definition at line 92 of file isf_ci_stream.h.

#define STREAM_CRC_DISABLED   (0)

Definition at line 178 of file isf_ci_stream.h.

Referenced by ci_protocol_CB_stream(), and isf_ci_stream_set_CRC().

#define STREAM_CRC_ENABLED   (1)

Stream control: enable/disable CRC generation/checking.

Definition at line 177 of file isf_ci_stream.h.

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

Enumeration Type Documentation

CI host stream command.

The host indicates which command the stream protocol runs. ci_commands_stream_enum is used to identify this command. The maximum number of possible commands is 128 represented by 7 bits.

Enumerator
CI_CMD_STREAM_RESET 

The host resets the stream protocol which deletes all instances.

CI_CMD_STREAM_ENABLE_DATA_UPDATE 

The host enables stream data updates.

CI_CMD_STREAM_DISABLE_DATA_UPDATE 

The host enables stream data updates.

CI_CMD_STREAM_CREATE_STREAM 

The host creates a stream.

CI_CMD_STREAM_DELETE_STREAM 

The host deletes a stream.

CI_CMD_STREAM_RESET_TRIGGER 

The host resets a stream trigger.

CI_CMD_STREAM_ENABLE_CRC 

The host enables CRC generation in the stream packet.

CI_CMD_STREAM_DISABLE_CRC 

The host disables CRC generation in the stream packet.

CI_CMD_STREAM_GETINFO_NUMBER_STREAMS 

The host requests to get the current number of streams.

CI_CMD_STREAM_GETINFO_TRIGGER_STATE 

The host requests the trigger state of a given stream ID.

CI_CMD_STREAM_GETINFO_STREAM_CONFIG 

The host requests to get the stream configuration of a given stream ID.

CI_CMD_STREAM_GETINFO_GET_FIRST_STREAMID 

The host requests to get the first stream ID.

CI_CMD_STREAM_GETINFO_GET_NEXT_STREAMID 

The host requests to get the next stream ID.

CI_CMD_STREAM_MAX 

Maximum currently defined CI stream commands.

Definition at line 29 of file isf_ci_stream.h.

Enumerator
CI_STATUS_STREAM_SUCCESS 

This status indicates a success.

CI_STATUS_STREAM_ERR 

This error indicates a general error.

CI_STATUS_STREAM_DATA_UPDATE 

This status indicates data was sent to the host.

CI_STATUS_STREAM_DATASETID_NOTUSED 

This indicates the dataset ID does not exists.

CI_STATUS_STREAM_STREAM_END_OF_LIST 

This indicates end of the stream list has been reached.

CI_STATUS_STREAM_ERR_INVALID_CMD 

This error indicates an invalid host command.

CI_STATUS_STREAM_ERR_INVALID_PARM 

This error indicates one or more invalid parameters.

CI_STATUS_STREAM_ERR_INVALID_NUM_PARM 

This error indicates invalid number of parameters.

CI_STATUS_STREAM_ERR_STREAM_NOEXISTS 

This error indicates no streams exists.

CI_STATUS_STREAM_ERR_NULL_POINTER 

This error indicates a given pointer is NULL.

CI_STATUS_STREAM_ERR_STREAMID_NOEXISTS 

This error indicates the stream ID does not exists.

CI_STATUS_STREAM_ERR_STREAMID_EXISTS 

This error indicates the stream ID already exists.

CI_STATUS_STREAM_ERR_DATASETID_NOEXISTS 

This error indicates the dataset ID does not exists.

CI_STATUS_STREAM_ERR_DATASETID_EXISTS 

This error indicates the dataset ID already exists.

CI_STATUS_STREAM_ERR_DATASET_LENGTH_INVALID 

This error indicates the dataset length is invalid (zero).

CI_STATUS_STREAM_ERR_NUMELEMENTS_INVALID 

This error indicates the number of elements is invalid (zero).

CI_STATUS_STREAM_ERR_OUT_OF_MEMORY 

This error indicates out of memory condition.

CI_STATUS_STREAM_ERR_SENDDATA_TO_HOST 

This error indicates an error in sending data to the host.

CI_STATUS_STREAM_ERR_CRC 

This error indicates the CRC check failed.

CI_STATUS_STREAM_MAX 

The maximum possible status value.

Definition at line 95 of file isf_ci_stream.h.

Function Documentation

struct __attribute__ ( (__packed__)  )

This structure contains the stream element information.

This structure contains the stream configuration information.

The stream element structure contains information of a dataset that includes an ID, the byte length, and the byte offset. Stream elements are part of the stream configuration structure.

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

Dataset ID

Length in bytes of the dataset

Offset n bytes of the dataset

Stream ID

Number of elements

Buffer containing the trigger mask bytes

Buffer containing the element list

Definition at line 190 of file isf_ci_stream.h.

isf_status_t ci_protocol_CB_stream ( uint32  anumBytes,
uint8 apSrc,
uint32 apnumDestBytes,
uint8 apDest 
)

This is a CI stream protocol callback function pointer.

A callback that implements the CI stream protocol. This callback is invoked if a packet is received with a protocol ID matching the ID that was assigned to this protocol during initialization.

Parameters
[in]anumBytesThe number of bytes that the host has sent to the protocol. The data resides in the apSrc buffer.
[in]apSrcPointer to the received data from the host.
[in,out]apnumDestBytesAs an input, this parameter specifies maxinum size of the destination buffer apDest. As an output this parameter specifies the actual size of the number of bytes used in the buffer apDest.
[out]apDestPointer to the processed data.
Return values
Thecallback function returns the protocol ID value of the next protocol to be invoked. If no more protocols are to be called, the callback function returns a zero to notify the CI to sends the destination buffer to the host.
Constraints:
The following constraints must be observed when using this function. If these constraints are not met, this API returns an error.
  • anumSrcBytes must be equal to or greater than the minimum number of bytes the specific protocol may require. This requirement is protocol dependent.
Reentrant: No
Link Libraries:
libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
See also
isf_status_t

Definition at line 1010 of file ci_protocol_stream.c.

isf_status_t ci_stream_init ( uint8  aprotocolID,
void *  apInitData 
)

This is a CI stream protocol intialization callback function pointer.

A callback that implements the initialization for the CI stream protocol.

Parameters
[in]aprotocolIDThe protocol ID assigned to the protocol. The protocol initialization function is required to save the ID and include the ID in data packets sent back to the host.
[in]apInitDataPointer to the user defined data.
Return values
ISF_SUCCESSThe initialization callback completed successfully.
ISF_ERR_LIB_INITThe initialization callback failed to initialize.
Constraints:
None
Reentrant: No
Link Libraries:
libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
See also
isf_status_t

Definition at line 85 of file ci_protocol_stream.c.

isf_status_t isf_ci_stream_create ( uint8  aStreamID,
uint8  aNumElements,
uint8 apTriggerMask,
ci_stream_element_t apElementList 
)

This API creates a stream.

This API creates a stream with the given parameters. It dynamically allocates memory to create a buffer to store all the information required to operation the stream.

Parameters
[in]aStreamIDStream ID value.
[in]aNumElementsThe number of elements or datasets in the stream.
[in]apTriggerMaskPointer to the trigger mask buffer. This buffer consists if an array of byte(s) with each bit corresponding a dataset in the element list. Bit 0 of the first trigger byte corresponds to the first dataset in apElementList. Bit 1 of the first trigger byte corresponds to the second dataset in apElementList and so on. Each trigger byte can respresent up to 8 datasets in apElementList.

During the creation process, the data from this buffer is copied over to the stream being created.

Parameters
[in]apElementListPointer to a buffer containing a list of datasets. Each dataset is defined in the list as follows:

Offset Size Description 0 1 byte Dataset ID 1 2 bytes Length, msb first 3 2 bytes Offset, msb first

During the creation process, the data from this buffer is copied over to the stream being created.

Returns
isf_ci_stream_create() returns a value of type isf_status_t providing the status of the stream creation operation.
Return values
ISF_SUCCESSThe stream was created successfully.
CI_STATUS_STREAM_ERR_NULL_POINTERThe apTriggerMask and/or the apElementList pointers are NULL.
CI_STATUS_STREAM_ERR_INVALID_NUM_PARMThe number of parameter bytes provided to create the stream is not sufficient.
CI_STATUS_STREAM_ERR_NUMELEMENTS_INVALIDThe aNumElements value is zero.
CI_STATUS_STREAM_ERR_STREAMID_EXISTSThe aStreamID value specifies a stream ID that already exists.
CI_STATUS_STREAM_ERR_OUT_OF_MEMORYThe system is out of memory and the stream cannot be created.
Constraints:
The following constraints must be observed when using this function. If these constraints are not met, this API returns an error.
  • aStreamID must refer to a stream that does NOT exists.
  • apTriggerMask and apElementList must not be NULL.
  • aNumElements must not be zero.
Reentrant: Yes.
Link Libraries:
libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a

Definition at line 243 of file ci_protocol_stream.c.

References CI_ALLOC_MEM_ZERO, CI_COPY_MEM, CI_FREE_MEM, CI_STATUS_STREAM_DATA_UPDATE, CI_STATUS_STREAM_ERR_NULL_POINTER, CI_STATUS_STREAM_ERR_NUMELEMENTS_INVALID, CI_STATUS_STREAM_ERR_OUT_OF_MEMORY, CI_STATUS_STREAM_ERR_STREAMID_EXISTS, ci_stream_config_t, ci_stream_element_t, ci_stream_get_num_element_bytes(), ci_stream_get_num_trig_bytes(), ci_stream_instance_t, ISF_SUCCESS, STREAM_COCO_BIT_MASK, STREAM_CRC_BYTESIZE, STREAM_PROTOCOL_OUTPUTPACKET_INDEX_COCO_STAT, STREAM_PROTOCOL_OUTPUTPACKET_INDEX_LENGTH_LSB, STREAM_PROTOCOL_OUTPUTPACKET_INDEX_LENGTH_MSB, STREAM_PROTOCOL_OUTPUTPACKET_INDEX_PROTOCOLID, STREAM_PROTOCOL_OUTPUTPACKET_INDEX_STREAMID, and TRUE.

Referenced by ci_protocol_CB_stream(), and rli_ci_app_callback().

Here is the call graph for this function:

Here is the caller graph for this function:

isf_status_t isf_ci_stream_delete ( uint8  aStreamID)

This API deletes the given stream ID.

This API deletes the given stream ID. Its memory is deallocated and the stream linked list is reordered.

Parameters
[in]aStreamIDStream ID value of the stream to delete.
Returns
isf_ci_stream_delete() returns a value of type isf_status_t providing the status of the stream creation operation.
Return values
ISF_SUCCESSThe stream ID was found and the stream deleted.
CI_STATUS_STREAM_ERR_STREAM_NOEXISTSThe aStreamID value specifies a stream ID that does not exists.
Constraints:
The following constraints must be observed when using this function. If these constraints are not met, this API returns an error.
  • aStreamID must refer to a stream that exists.
Reentrant: Yes.
Link Libraries:
libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a

Definition at line 168 of file ci_protocol_stream.c.

References CI_FREE_MEM, CI_STATUS_STREAM_ERR_STREAM_NOEXISTS, CI_STATUS_STREAM_ERR_STREAMID_NOEXISTS, and ISF_SUCCESS.

Referenced by ci_protocol_CB_stream(), and rli_ci_app_callback().

Here is the caller graph for this function:

ci_stream_config_t* isf_ci_stream_get_config ( uint8  aStreamID)

This API gets the stream configuration of the specified stream ID.

Parameters
[in]aStreamIDStream ID value of the configuration to retrieve.
Returns
isf_ci_stream_get_config() returns a pointer of the type ci_stream_config_t of the configuration associated with the given stream ID. The pointer value is NULL if the configuration does not exists.
Constraints:
The following constraints must be observed when using this function. If these constraints are not met, this API returns an error.
  • aStreamID must refer to a stream that exists. If the stream does not exists, a NULL value is returned.
Reentrant: Yes.
Link Libraries:
libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
ci_stream_config_t* isf_ci_stream_get_first ( void  )

This API returns the configuration of the first stream in the linked list.

This API returns a pointer to the configuration of the first stream in the linked list. If no stream exists, NULL is returned.

Returns
isf_ci_stream_get_first() returns a pointer to the configuration of the first stream.
Constraints:
None
Reentrant: Yes.
Link Libraries:
libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
See also
isf_ci_stream_get_next()

Definition at line 118 of file ci_protocol_stream.c.

References ci_stream_config_t.

Referenced by ci_protocol_CB_stream().

Here is the caller graph for this function:

ci_stream_config_t* isf_ci_stream_get_next ( void  )

This API returns the configuration of the next stream in the linked list.

This API returns a pointer to the configuration of the next stream in the linked list. The stream returned is the next stream in the list from the previous isf_ci_stream_get_first() or isf_ci_stream_get_next() call. If no stream exists, NULL is returned.

Returns
isf_ci_stream_get_next() returns a pointer to the configuration of the next stream in the linked list.
Constraints:
None
Reentrant: Yes.
Link Libraries:
libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
See also
isf_ci_stream_get_next()

Definition at line 133 of file ci_protocol_stream.c.

References ci_stream_config_t.

Referenced by ci_protocol_CB_stream().

Here is the caller graph for this function:

uint8 isf_ci_stream_get_num_streams ( void  )

This API returns the number of streams.

This API returns the number of streams that currently exists.

Returns
isf_ci_stream_get_num_streams() returns the number of streams that currently exists.
Constraints:
None
Reentrant: Yes.
Link Libraries:
libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a

Definition at line 639 of file ci_protocol_stream.c.

Referenced by ci_protocol_CB_stream().

Here is the caller graph for this function:

isf_status_t isf_ci_stream_get_trigger ( uint8  aStreamID,
uint8 apTrigger 
)

This API returns the trigger state of the given stream ID.

This API returns the trigger state bytes of the given stream ID. The trigger state is copied to the trigger buffer provided by the caller.

Parameters
[in]aStreamIDStream ID value of the stream to get the trigger state.
[in,out]apTriggerPointer to the trigger byte array. The trigger state of the stream is copied to this byte array. This value is NULL if the stream ID does not exists. The caller must provide an array large enough to hold all of the trigger bytes.

Each bit in the trigger byte corresponds to a dataset.

Returns
isf_ci_stream_get_trigger() returns a value of type isf_status_t providing the status of the stream creation operation.
Return values
ISF_SUCCESSThe stream ID was found and its trigger state reset to the trigger mask.
CI_STATUS_STREAM_ERRapTrigger is NULL.
CI_STATUS_STREAM_ERR_STREAM_NOEXISTSThe aStreamID value specifies a stream ID that does not exists.
Constraints:
The following constraints must be observed when using this function. If these constraints are not met, this API returns an error.
  • aStreamID must refer to a stream that exists.
  • apTrigger must not be NULL.
Reentrant: Yes.
Link Libraries:
libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a

Definition at line 656 of file ci_protocol_stream.c.

References CI_STATUS_STREAM_ERR, CI_STATUS_STREAM_ERR_STREAMID_NOEXISTS, ci_stream_get_num_trig_bytes(), and ISF_SUCCESS.

Here is the call graph for this function:

isf_status_t isf_ci_stream_reset_trigger ( uint8  aStreamID)

This API resets the trigger bits of the the given stream ID.

This API resets the trigger state of the given stream ID. The trigger state is set to the trigger mask that was provided during stream creation.

Parameters
aStreamIDStream ID value of the stream to reset the trigger state.
Returns
isf_ci_stream_reset_trigger() returns a value of type isf_status_t providing the status of the stream creation operation.
Return values
ISF_SUCCESSThe stream ID was found and its trigger state reset to the trigger mask.
CI_STATUS_STREAM_ERR_STREAM_NOEXISTSThe aStreamID value specifies a stream ID that does not exists.
Constraints:
The following constraints must be observed when using this function. If these constraints are not met, this API returns an error.
  • aStreamID must refer to a stream that exists.
Reentrant: Yes.
Link Libraries:
libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a

Definition at line 693 of file ci_protocol_stream.c.

References CI_STATUS_STREAM_ERR_STREAMID_NOEXISTS, ci_stream_get_num_trig_bytes(), and ISF_SUCCESS.

Referenced by ci_protocol_CB_stream().

Here is the call graph for this function:

Here is the caller graph for this function:

void isf_ci_stream_set_CRC ( boolean  acrcEnable)

This API sets the cyclic redundancy check (CRC) code generation to the requested state.

This API is used to enable or disable the CRC state. If enabled, CRC code is generated and sent as part of any data packets going to the host for the stream protocol. Also, any packet received from the host is expected to have a CRC bytes that are checked against the received data. If disabled, no CRC data is generated for packets going to the host and no CRC check is performed for packets received from the host.

The CRC used by the stream protocol is the CCITT CRC16. This method uses two bytes (16-bit). If CRC bytes are generated for a data packet destined for the host, the bytes are placed at the end of the packet but before the end marker byte (0x7E). The same CRC byte placement is expected of data packets from the host to the stream protocol.

If CRC is enabled by the host using the CI_CMD_STREAM_ENABLE_CRC command, the response packet to the host for this command will have the CRC bytes as part of the packet.

If CRC is disabled by the host using the CI_CMD_STREAM_DISABLE_CRC command, the response packet to the host for this command will NOT have the CRC bytes as part of the packet.

Parameters
[in]acrcEnableRequested state of CRC. STREAM_CRC_ENABLED to enable CRC generation and checking. STREAM_CRC_DISABLED to disabke CRC generation and checking.
Returns
None
Constraints:
None
Reentrant: Yes.
Link Libraries:
libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
See also
isf_ci_stream_get_next()

Definition at line 725 of file ci_protocol_stream.c.

References ci_stream_ctrl_reg1_t::Bits, ci_stream_ctrl_reg1_t::enable_crc, STREAM_CRC_DISABLED, STREAM_CRC_ENABLED, and ci_stream_regs_t::StreamCtrlReg1.

Referenced by ci_protocol_CB_stream().

Here is the caller graph for this function:

void isf_ci_stream_set_stream_disable ( )

This API disables data stream.

This API is used to enable data stream state. Data streaming is enabled by setting gStreamReg.StreamCtrlReg1.Bits.enable_stream_data = STREAM_PROTOCOL_DATA_DISABLED.

Parameters
[in]None
Returns
None
Constraints:
None
Reentrant: Yes.
See also
ci_protocol_CB_stream()

Definition at line 1833 of file ci_protocol_stream.c.

References ci_stream_ctrl_reg1_t::Bits, ci_stream_ctrl_reg1_t::enable_stream_data, STREAM_PROTOCOL_DATA_DISABLED, and ci_stream_regs_t::StreamCtrlReg1.

void isf_ci_stream_set_stream_enable ( )

This API enables data stream.

This API is used to enable data stream state. Data streaming is enabled by setting gStreamReg.StreamCtrlReg1.Bits.enable_stream_data = STREAM_PROTOCOL_DATA_ENABLED.

Parameters
[in]None
Returns
None
Constraints:
None
Reentrant: Yes.
See also
ci_protocol_CB_stream()

Definition at line 1821 of file ci_protocol_stream.c.

References ci_stream_ctrl_reg1_t::Bits, ci_stream_ctrl_reg1_t::enable_stream_data, STREAM_PROTOCOL_DATA_ENABLED, and ci_stream_regs_t::StreamCtrlReg1.

isf_status_t isf_ci_stream_update_data ( uint8  aDataSetID,
uint16  aLength,
uint16  aOffset,
uint8 apSrc 
)

This API updates the data of a dataset.

This API updates the data of the given dataset ID. The data is updated under two conditions that must exist:

  • The dataset ID exists in a stream. Streams can contain multiple datasets with the same ID and these datasets may have lengths and offsets that are the same or different.
  • The dataset region as defined in the stream overlaps with the given region provided in the parameters.

If a dataset in any streams meet these conditions, the overlapped region of the dataset data is updated and the trigger state bit associated with the dataset ID is cleared. If all trigger state bits of the stream is cleared, the data is sent to the host if stream update is enabled.

Parameters
[in]aDataSetIDID of the dataset to update
[in]aLengthThe byte length of data to update.
[in]aOffsetThe offset of the data to update. It references the offset of the data buffer that the application makes available to the host.
[in]apSrcPointer to the source of the data to perform the update. If the dataset ID matches and the data region overlaps, the source data is copied to the stream buffer.
Returns
isf_ci_stream_update_data() returns a value of type isf_status_t providing the status of the data update operation.
Return values
ISF_SUCCESSDataset(s) data were updated. No data was sent to the host because not all trigger state bits are cleared.
CI_STATUS_STREAM_ERR_NULL_POINTERThe apSrc is NULL.
CI_STATUS_STREAM_ERR_DATASET_LENGTH_INVALIDThe aLength value is zero.
CI_STATUS_STREAM_ERR_SENDDATA_TO_HOSTAn error was encountered in sending data to the host.
CI_STATUS_STREAM_DATASETID_NOTUSEDThe dataset ID was not found in any streams. No data was updated.
CI_STATUS_STREAM_DATA_UPDATEAn update data packet was sent to the host.
Constraints:
The following constraints must be observed when using this function. If these constraints are not met, this API returns an error.
  • aDataSetID must refer to a dataset that exists.
  • aLength must not be zero.
  • apSrc must not be NULL.
Reentrant: Yes.
Link Libraries:
libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a

Definition at line 449 of file ci_protocol_stream.c.

References ci_stream_ctrl_reg1_t::Bits, ccitt_crc16_cal(), CI_COPY_MEM, ci_send_packet(), CI_STATUS_STREAM_DATA_UPDATE, CI_STATUS_STREAM_DATASETID_NOTUSED, CI_STATUS_STREAM_ERR_DATASET_LENGTH_INVALID, CI_STATUS_STREAM_ERR_NULL_POINTER, CI_STATUS_STREAM_ERR_SENDDATA_TO_HOST, CI_STREAM_DATASET_ID_BYTESIZE, ci_stream_element_t, ci_stream_get_num_trig_bytes(), CI_STREAM_OUTPUTPACKET_LENGTH_BYTESIZE, CI_STREAM_OUTPUTPACKET_STREAMID_BYTESIZE, CI_STREAM_PROTOCOL_ID_BYTESIZE, ci_stream_ctrl_reg1_t::enable_crc, ci_stream_ctrl_reg1_t::enable_stream_data, FALSE, ISF_SUCCESS, STREAM_CRC_BYTESIZE, STREAM_CRC_ENABLED, STREAM_PROTOCOL_CMD_STATUS_BYTESIZE, STREAM_PROTOCOL_DATA_ENABLED, STREAM_PROTOCOL_OUTPUTPACKET_INDEX_LENGTH_LSB, STREAM_PROTOCOL_OUTPUTPACKET_INDEX_LENGTH_MSB, ci_stream_regs_t::StreamCtrlReg1, and TRUE.

Referenced by App1_MainTask(), BasicApp1_MainTask(), and rli_PeriodicCallback().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation