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.c File Reference

Command Interpreter (CI) task source file that implements the top level CI protocol features and functionality. This file is internal ISF code. More...

#include "isf_target.h"
#include "isf.h"
#include "lwevent.h"
#include "lwsem.h"
#include "mutex.h"
#include "lwmem.h"
#include "isf_ci.h"
#include "task_ci.h"
#include "isf_ci_protocol.h"
#include "cortex.h"
#include "isf_devmsg.h"
#include "isf_ci_stream.h"
Include dependency graph for task_ci.c:

Go to the source code of this file.

Functions

uint32 get_ci_comm (void)
 
ci_packet_recv_status_t process_recv_byte (uint8 c)
 Process data received over comm port. Perform CI packet processing and return to caller status. More...
 
uint32 isf_ci_get_recv_size (void)
 CI Receive buffer size. More...
 
isf_status_t ci_send_packet (uint32 anumBytes, uint8 *apSrc)
 CI send packet - main function to send data to host. More...
 
void task_ci (uint32 initial_data)
 Command Interpreter Task - main task to handle communication
via mailboxes with the host. More...
 
isf_status_t ci_init (void)
 This API initializes the Command Interpreter. More...
 

Variables

const uint8 packet_marker = CI_PACKET_MARKER
 
dm_ChannelDescriptor_t dm_channel_desc
 
dm_DeviceDescriptor_t dm_dev_desc
 
const ci_protocol_t ci_protocol_table []
 CI protocol routing table. More...
 
ci_protocol_initdata_ptr_t ci_protocol_initptr_table []
 CI protocol user defined initialization data pointer table. More...
 

Detailed Description

Command Interpreter (CI) task source file that implements the top level CI protocol features and functionality. This file is internal ISF code.

Definition in file task_ci.c.

Function Documentation

isf_status_t ci_init ( void  )

This API initializes the Command Interpreter.

The Command Interpreter requires a one time initialization at system startup performed by this API call. It creates and initializes internal variables. In addition, it installs an interrupt service routine for the slave-port interrupt.

Returns
ci_init() returns a value of type isf_status_t providing the status of the initialization operation.
Return values
ISF_SUCCESSThe initialization completed successfully.
ISF_ERR_LIB_INITThe interrupt service routine for the uart channel used by the Command Interpereter could not installed.
Constraints:
The following constraints must be observed when using this function. If these constraints are not met, this API returns an error.
  • An interrupt routine for the uart channel used by the Command Interpereter has not been installed.
Reentrant: No
Link Libraries:
isf_core.lib
See also
ci_status_t

Definition at line 584 of file task_ci.c.

References CI_ALLOC_MEM_ZERO, CI_MAX_PROTOCOL, ci_protocol_initptr_table, COMM_STATE_OK, dm_channel_desc, dm_channel_get_state(), dm_channel_init(), dm_channel_start(), dm_device_open(), get_ci_comm(), isf_ci_get_recv_size(), ISF_ERR_LIB_INIT, ISF_SUCCESS, ci_protocol_t::protcolID, and ci_rx_packet_t::pRxbuf.

Referenced by isf_lib_init().

Here is the call graph for this function:

Here is the caller graph for this function:

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:

uint32 get_ci_comm ( void  )

Definition at line 128 of file isf_sysconf_comms.c.

Referenced by ci_init().

Here is the caller graph for this function:

uint32 isf_ci_get_recv_size ( void  )

CI Receive buffer size.

Definition at line 31 of file isf_ci_protocol.c.

Referenced by ci_init().

Here is the caller graph for this function:

ci_packet_recv_status_t process_recv_byte ( uint8  c)

Process data received over comm port. Perform CI packet processing and return to caller status.

Parameters
(in)c - character to process
Returns
process_recv_byte() returns a value of type ci_packet_recv_status_t indicating the status of the packet received status.
Return values
CI_PACKET_RECV_STATUS_NOindicating no packet has been received.
CI_PACKET_RECV_STATUS_YESindicating a packet has been received.
See also
task_ci()

Definition at line 141 of file task_ci.c.

References CI_MIN_RX_BYTES, CI_PACKET_MARKER, CI_PACKET_RECV_STATUS_NO, CI_PACKET_RECV_STATUS_YES, CI_RX_STATE_GETTINGPACKETDATA2, CI_RX_STATE_WAITFORPACKETMARKER1, FALSE, ci_rx_packet_t::mbIndex, ci_rx_packet_t::packetSize, ci_rx_packet_t::pRxbuf, ci_rx_packet_t::rxState, and TRUE.

Referenced by task_ci().

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.

References ci_get_protocol_id, CI_PACKET_RECV_STATUS_YES, CI_PROTOCOL_DATA_OFFSET, CI_PROTOCOL_ID_MAX, CI_PROTOCOL_ID_NULL, CI_PROTOCOL_ID_SIZE, dm_device_read(), ISF_CI_FAILURE, ISF_SUCCESS, ci_rx_packet_t::mbIndex, process_recv_byte(), and ci_rx_packet_t::pRxbuf.

Referenced by CI_task().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

ci_protocol_initdata_ptr_t ci_protocol_initptr_table[]

CI protocol user defined initialization data pointer table.

Definition at line 42 of file isf_ci_protocol.c.

Referenced by ci_init().

const ci_protocol_t ci_protocol_table[]

CI protocol routing table.

Definition at line 53 of file isf_ci_protocol.c.

dm_ChannelDescriptor_t dm_channel_desc

Definition at line 43 of file task_ci.c.

Referenced by ci_init().

dm_DeviceDescriptor_t dm_dev_desc

Definition at line 44 of file task_ci.c.

const uint8 packet_marker = CI_PACKET_MARKER

Definition at line 40 of file task_ci.c.

Referenced by ci_send_packet().