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

Command interpreter task header file. This file is internal ISF code. More...

#include <IO_Map.h>
#include "isf.h"
#include "isf_ci_protocol.h"
Include dependency graph for task_ci.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ci_tx_packet_t
 This structure holds information to send a packet of data to the host. A task will fill the structure with the information and enable transmit buffer empty. The ISR will send the data byte by byte until all data is sent. More...
 
struct  ci_rx_packet_t
 This structure holds information to receive a packet of data to the host. CI will fill the structure with the information as it receives it from the ISR and will notify the CI task when a packet has been fully received. More...
 

Macros

#define CI_PACKET_MARKER   (0x7E)
 Packet maker. Each packet is delineated by this character. More...
 
#define CI_ALLOC_MEM_ZERO(x)   _lwmem_alloc_system_zero(x)
 Memory allocation abstraction. More...
 
#define CI_FREE_MEM(x)   _lwmem_free(x)
 
#define CI_COPY_MEM(src, dest, size)   isf_mem_copy(src, dest, size)
 
#define ci_get_protocol_id()   ((uint8)ci_rx_packet.pRxbuf[CI_PROTOCOL_ID_INDEX])
 Retrieve the protocol ID. More...
 

Enumerations

enum  ci_recv_state_t { CI_RX_STATE_NULL = 0, CI_RX_STATE_WAITFORPACKETMARKER1, CI_RX_STATE_GETTINGPACKETDATA2 }
 States for receiving a packet. More...
 
enum  ci_tx_state_t { CI_TX_STATE_NULL = 0, CI_TX_STATE_SEND_STARTMARKER1, CI_TX_STATE_SEND_PACKETDATA2, CI_TX_STATE_SEND_ENDMARKER4 }
 States for sending a packet. More...
 
enum  ci_escape_state_enum { CI_ESCAPE_STATE_WAIT_1ST_CHAR = 0, CI_ESCAPE_STATE_WAIT_2ND_CHAR }
 States for encoding/decoding escape characters. More...
 
enum  ci_packet_recv_status_t { CI_PACKET_RECV_STATUS_NO = 0, CI_PACKET_RECV_STATUS_YES }
 Packet received status. More...
 

Functions

void task_ci (uint32 initial_data)
 Command Interpreter Task - main task to handle communication
via mailboxes with the host. More...
 
isf_status_t ci_send_packet (uint32 anumBytes, uint8 *apSrc)
 CI send packet - main function to send data to host. More...
 

Detailed Description

Command interpreter task header file. This file is internal ISF code.

Definition in file task_ci.h.

Macro Definition Documentation

#define CI_ALLOC_MEM_ZERO (   x)    _lwmem_alloc_system_zero(x)

Memory allocation abstraction.

Definition at line 108 of file task_ci.h.

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

#define CI_COPY_MEM (   src,
  dest,
  size 
)    isf_mem_copy(src, dest, size)
#define CI_FREE_MEM (   x)    _lwmem_free(x)

Definition at line 109 of file task_ci.h.

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

#define ci_get_protocol_id ( )    ((uint8)ci_rx_packet.pRxbuf[CI_PROTOCOL_ID_INDEX])

Retrieve the protocol ID.

Definition at line 115 of file task_ci.h.

Referenced by task_ci().

#define CI_PACKET_MARKER   (0x7E)

Packet maker. Each packet is delineated by this character.

Definition at line 25 of file task_ci.h.

Referenced by ci_send_packet(), and process_recv_byte().

Enumeration Type Documentation

States for encoding/decoding escape characters.

Enumerator
CI_ESCAPE_STATE_WAIT_1ST_CHAR 
CI_ESCAPE_STATE_WAIT_2ND_CHAR 

Definition at line 87 of file task_ci.h.

Packet received status.

Enumerator
CI_PACKET_RECV_STATUS_NO 
CI_PACKET_RECV_STATUS_YES 

Definition at line 98 of file task_ci.h.

States for receiving a packet.

Enumerator
CI_RX_STATE_NULL 
CI_RX_STATE_WAITFORPACKETMARKER1 

Receiver state: Waiting for a packet marker.

CI_RX_STATE_GETTINGPACKETDATA2 

Receiver state: Receiving data payload.

Definition at line 29 of file task_ci.h.

States for sending a packet.

Enumerator
CI_TX_STATE_NULL 
CI_TX_STATE_SEND_STARTMARKER1 

Transmitter state: Send packet marker.

CI_TX_STATE_SEND_PACKETDATA2 

Transmitter state: Send packet data.

CI_TX_STATE_SEND_ENDMARKER4 

Transmitter state: Send end marker.

Definition at line 40 of file task_ci.h.

Function Documentation

isf_status_t ci_send_packet ( uint32  anumBytes,
uint8 apSrc 
)

CI send packet - main function to send data to host.

Parameters
anumBytes- number of bytes to transmit.
apSrc- pointer to source of data to transmit.
Returns
See ci_response_enum type for possible return values
Errors:
None
Constraints:
Only one caller can have access to the transmit operation. Other callers will be blocked by a semaphore until the current transmit operation has completed.
Reentrant: Yes.
Link Libraries:

See also

Definition at line 342 of file task_ci.c.

References ci_tx_packet_t::bytesLeft, CI_ESCAPE_STATE_WAIT_1ST_CHAR, CI_ESCAPE_STATE_WAIT_2ND_CHAR, CI_PACKET_MARKER, CI_TX_STATE_NULL, CI_TX_STATE_SEND_ENDMARKER4, CI_TX_STATE_SEND_PACKETDATA2, CI_TX_STATE_SEND_STARTMARKER1, dm_device_write(), FALSE, ISF_CI_FAILURE, ISF_SUCCESS, packet_marker, ci_tx_packet_t::pTxbuf, TRUE, and ci_tx_packet_t::txState.

Referenced by ci_protocol_CB_mbox(), ci_protocol_CB_stream(), isf_ci_qr_update(), and isf_ci_stream_update_data().

Here is the call graph for this function:

Here is the caller graph for this function:

void task_ci ( uint32  initial_data)

Command Interpreter Task - main task to handle communication
via mailboxes with the host.

Parameters
initial_data- value passed in when task is created, not used.
Returns
None
Errors:

Constraints:

Reentrant: No.
Link Libraries:

See also
main.c/MQX_template_list[]

Definition at line 499 of file task_ci.c.

Referenced by CI_task().

Here is the caller graph for this function: