| ISF 2.1 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Macros | Functions
ci_protocol_mbox.h File Reference

Command interpreter header file for the legacy mailbox protocol. More...

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

Go to the source code of this file.

## Data Structures
struct | qr_config_t
| This structure holds the quick read configuration for all applicable mailboxes. The first 4 mailboxes are used for the command packet read/write. All other mailboxes can be configured as quick read. More...
struct | ci_ctrl_reg_t
| Command Interpreter Control Register Structure. . More...
struct | ci_regs_t
| Command Interpreter Registers Structure. Contains all CI registers. . More...

## Macros
#define | MBOX_CRC_BYTE_SIZE (0)
| Define to enable CRC check. When enabled, CRC calculation is performed and CRC bytes are included in packets sent to the host. Also, CRC check is performed on receiving packets. More...
#define | SP_MB0 (0)
#define | SP_MB1 (1)
#define | SP_MB2 (2)
#define | SP_MB3 (3)
#define | SP_MB4 (4)
#define | ISF_APP_ID_NULL (0)
#define | MB_HOST_APP_ID pciMailboxes[0]
| Mailbox designation for host command packet for read/write. More...
#define | MB_HOST_CMD pciMailboxes[1]
#define | MB_HOST_OFFSET pciMailboxes[2]
#define | MB_HOST_COUNT pciMailboxes[3]
#define | MB_HOST_CMD_SIZE(x) (GET_EXTENSION_BIT(x) == 0) ? 4 : 5
#define | MB_HOST_OFFSET_EXT (uint16)((pciMailboxes[2] << 8) | pciMailboxes[3])
#define | MB_HOST_COUNT_EXT pciMailboxes[4]
#define | MB_HOST_WR_DATA_START (4)
#define | MB_RESP_APP_ID pciMailboxes[0]
#define | MB_RESP_STATUS_CC pciMailboxes[1]
#define | MB_RESP_BYTES_XFER pciMailboxes[2]
#define | MB_RESP_COUNT pciMailboxes[3]
#define | MB_RESP_INDEX_APP_ID (0)
#define | MB_RESP_INDEX_STATUS_CC (1)
#define | MB_RESP_INDEX_BYTES_XFER (2)
#define | MB_RESP_INDEX_COUNT (3)
#define | MB_APP_RESP_SIZE (4)
#define | MB_APP_RESP_DATA_START (4)
#define | CI_STREAMING_MODE (1)
#define | CI_NON_STREAMING_MODE (0)
#define | CMD_PACKET_BITS (0x0000000f)
| Mailboxes write bit. Bit setting for the 4 byte command packet from host. Bit position has same meaning as the SP_WSTS0 register. More...
#define | COCO_BIT (7)
| Mailbox COCO bit position and mask. More...
#define | COCO_BIT_MASK (1 << COCO_BIT)
#define | EXTENSION_LENGTH_BIT (1)
| Extension for length and offset. More...
#define | EXTENSION_LENGTH_BIT_BIT_MASK (1 << 7)
#define | GET_EXTENSION_BIT(x) (((x) & EXTENSION_LENGTH_BIT_BIT_MASK )>> 7)
#define | WR_CMD_RSHIFT (0)
| Command byte partition. Command byte contains instruction value in all bits. This command is written by host to MB0. More...
#define | WR_CMD_MASK (0xff)
#define | WR_CMD_ID_MASK (0x7f)
#define | MAX_NUM_MAILBOXES (32)
| Number of mailboxes available on this sytem. More...
#define | FIRST_DATA_MAILBOX_NUM (4)
| First mailbox number for data transfer at powerup. Note that the actual first mailbox available for data transfer depends on how the host configures the mailboxes for quick read. More...
#define | NUM_DATA_MAILBOXES (MAX_NUM_MAILBOXES-FIRST_DATA_MAILBOX_NUM)
| Maximum number of mailboxes available on this system for data from/to host. Note that not all mailboxes designated for data payload may be available since the host could configure them for quick read. More...
#define | FIRST_QR_MAILBOX_NUM (4)
| First mailbox number that can be configured for quick read data. Quick read data can be written to this mailbox mailbox number up 31. More...
#define | QR_MAILBOX_MASK ((uint32)0xffffffff << FIRST_QR_MAILBOX_NUM)
| Quick read mask that is applied to mailboxes read by host to mask out mailboxes read by the host but not configured for quick read. More...
#define | NUM_QR_MAILBOXES (MAX_NUM_MAILBOXES-FIRST_QR_MAILBOX_NUM)
| Maximum number of mailboxes available on this system for quick read. Note that not all mailboxes designated for data payload may be available since the host could configure them for quick read. More...
#define | CI_CMD_DEBUG_LOOPBACK (120)
| Debug commands. More...
#define | ci_get_wr_appid() ((uint8)MB_HOST_APP_ID)
#define | ci_get_wr_cmd() ((uint8)((MB_HOST_CMD & WR_CMD_MASK) >> WR_CMD_RSHIFT))
#define | ci_get_wr_cmdId() ((uint8)((MB_HOST_CMD & WR_CMD_ID_MASK) >> WR_CMD_RSHIFT))
#define | ci_get_wr_offset(x) (GET_EXTENSION_BIT(x) == 0)? (uint16)(MB_HOST_OFFSET) : (uint16)(MB_HOST_OFFSET_EXT)
#define | ci_get_wr_cnt(x) (GET_EXTENSION_BIT(x) == 0)? (uint16)(MB_HOST_COUNT) : (uint16)(MB_HOST_COUNT_EXT)
#define | ci_get_first_mailbox(x) (GET_EXTENSION_BIT(x) == 0)? 4 : 5
#define | qr_config_clear()
#define | ci_insert_crc(insert_offset, crc16_value, pBuf)

## Functions
isf_status_t | ci_mbox_init (uint8 aprotocolID, void *apInitData)
isf_status_t | ci_protocol_CB_mbox (uint32 anumBytes, uint8 *apSrc, uint32 *apnumDestBytes, uint8 *apDest)

## Detailed Description

Command interpreter header file for the legacy mailbox protocol.

Definition in file ci_protocol_mbox.h.

## Macro Definition Documentation

#define CI_CMD_DEBUG_LOOPBACK (120)

Debug commands.

Definition at line 225 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox().

#define ci_get_first_mailbox | ( |  | x | ) | (GET_EXTENSION_BIT(x) == 0)? 4 : 5

Definition at line 238 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox().

#define ci_get_wr_appid | ( |  | ) | ((uint8)MB_HOST_APP_ID)

Definition at line 233 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox().

#define ci_get_wr_appid | ( |  | ) | ((uint8)MB_HOST_APP_ID)

Definition at line 233 of file ci_protocol_mbox.h.

#define ci_get_wr_cmd | ( |  | ) | ((uint8)((MB_HOST_CMD & WR_CMD_MASK) >> WR_CMD_RSHIFT))

Definition at line 234 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox().

#define ci_get_wr_cmdId | ( |  | ) | ((uint8)((MB_HOST_CMD & WR_CMD_ID_MASK) >> WR_CMD_RSHIFT))

Definition at line 235 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox().

#define ci_get_wr_cnt | ( |  | x | ) | (GET_EXTENSION_BIT(x) == 0)? (uint16)(MB_HOST_COUNT) : (uint16)(MB_HOST_COUNT_EXT)

Definition at line 237 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox().

#define ci_get_wr_offset | ( |  | x | ) | (GET_EXTENSION_BIT(x) == 0)? (uint16)(MB_HOST_OFFSET) : (uint16)(MB_HOST_OFFSET_EXT)

Definition at line 236 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox().

#define ci_insert_crc | ( |  | insert_offset,
|  |  | crc16_value,
|  |  | pBuf
| ) |  |

Value:
{ \
pBuf[insert_offset + 0] = (uint8)((uint16)(crc16_value & 0xff00) >> 8);\
pBuf[insert_offset + 1] = (uint8)(crc16_value & 0xff);\
}
uint8
unsigned char uint8
This defines uint8 as unsigned char.
Definition: isf_types.h:18
uint16
unsigned short uint16
This defines uint16 as unsigned short.
Definition: isf_types.h:27

Definition at line 254 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox(), and isf_ci_qr_update().

#define CI_NON_STREAMING_MODE (0)

Definition at line 77 of file ci_protocol_mbox.h.

#define CI_STREAMING_MODE (1)

Definition at line 76 of file ci_protocol_mbox.h.

Referenced by isf_ci_qr_update().

#define CMD_PACKET_BITS (0x0000000f)

Mailboxes write bit. Bit setting for the 4 byte
command packet from host. Bit position has same meaning
as the SP_WSTS0 register.

Definition at line 88 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox().

#define COCO_BIT (7)

Mailbox COCO bit position and mask.

Definition at line 95 of file ci_protocol_mbox.h.

#define COCO_BIT_MASK (1 << COCO_BIT)

Definition at line 96 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox().

#define EXTENSION_LENGTH_BIT (1)

Extension for length and offset.

Definition at line 101 of file ci_protocol_mbox.h.

#define EXTENSION_LENGTH_BIT_BIT_MASK (1 << 7)

Definition at line 102 of file ci_protocol_mbox.h.

#define FIRST_DATA_MAILBOX_NUM (4)

First mailbox number for data transfer at powerup.
Note that the actual first mailbox available for data transfer
depends on how the host configures the mailboxes for quick
read.

Definition at line 128 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox(), and ci_update_first_data_mb().

#define FIRST_QR_MAILBOX_NUM (4)

First mailbox number that can be configured for quick
read data. Quick read data can be written to this mailbox
mailbox number up 31.

Definition at line 144 of file ci_protocol_mbox.h.

Referenced by ci_qr_update(), ci_update_first_data_mb(), and isf_ci_qr_update().

#define GET_EXTENSION_BIT | ( |  | x | ) | (((x) & EXTENSION_LENGTH_BIT_BIT_MASK )>> 7)

Definition at line 103 of file ci_protocol_mbox.h.

#define ISF_APP_ID_NULL (0)

Definition at line 44 of file ci_protocol_mbox.h.

Referenced by ci_qr_update().

#define MAX_NUM_MAILBOXES (32)

Number of mailboxes available on this sytem.

Definition at line 119 of file ci_protocol_mbox.h.

Referenced by ci_mbox_init(), ci_protocol_CB_mbox(), and isf_ci_qr_update().

#define MB_APP_RESP_DATA_START (4)

Definition at line 74 of file ci_protocol_mbox.h.

#define MB_APP_RESP_SIZE (4)

Definition at line 73 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox(), and isf_ci_qr_update().

#define MB_HOST_APP_ID pciMailboxes[0]

Mailbox designation for host command packet for read/write.

Definition at line 54 of file ci_protocol_mbox.h.

#define MB_HOST_CMD pciMailboxes[1]

Definition at line 55 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox().

#define MB_HOST_CMD_SIZE | ( |  | x | ) | (GET_EXTENSION_BIT(x) == 0) ? 4 : 5

Definition at line 58 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox().

#define MB_HOST_COUNT pciMailboxes[3]

Definition at line 57 of file ci_protocol_mbox.h.

#define MB_HOST_COUNT_EXT pciMailboxes[4]

Definition at line 60 of file ci_protocol_mbox.h.

#define MB_HOST_OFFSET pciMailboxes[2]

Definition at line 56 of file ci_protocol_mbox.h.

#define MB_HOST_OFFSET_EXT (uint16)((pciMailboxes[2] << 8) | pciMailboxes[3])

Definition at line 59 of file ci_protocol_mbox.h.

#define MB_HOST_WR_DATA_START (4)

Definition at line 61 of file ci_protocol_mbox.h.

#define MB_RESP_APP_ID pciMailboxes[0]

Definition at line 64 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox().

#define MB_RESP_BYTES_XFER pciMailboxes[2]

Definition at line 66 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox().

#define MB_RESP_COUNT pciMailboxes[3]

Definition at line 67 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox().

#define MB_RESP_INDEX_APP_ID (0)

Definition at line 68 of file ci_protocol_mbox.h.

Referenced by isf_ci_qr_update().

#define MB_RESP_INDEX_BYTES_XFER (2)

Definition at line 70 of file ci_protocol_mbox.h.

Referenced by isf_ci_qr_update().

#define MB_RESP_INDEX_COUNT (3)

Definition at line 71 of file ci_protocol_mbox.h.

Referenced by isf_ci_qr_update().

#define MB_RESP_INDEX_STATUS_CC (1)

Definition at line 69 of file ci_protocol_mbox.h.

Referenced by isf_ci_qr_update().

#define MB_RESP_STATUS_CC pciMailboxes[1]

Definition at line 65 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox().

#define MBOX_CRC_BYTE_SIZE (0)

Define to enable CRC check. When enabled, CRC calculation is performed and CRC bytes are included in packets sent to the host. Also, CRC check is performed on receiving packets.

Definition at line 35 of file ci_protocol_mbox.h.

Referenced by ci_protocol_CB_mbox(), and isf_ci_qr_update().

#define NUM_DATA_MAILBOXES (MAX_NUM_MAILBOXES-FIRST_DATA_MAILBOX_NUM)

Maximum number of mailboxes available on this system for
data from/to host. Note that not all mailboxes designated for
data payload may be available since the host could configure them for quick read.

Definition at line 136 of file ci_protocol_mbox.h.

#define NUM_QR_MAILBOXES (MAX_NUM_MAILBOXES-FIRST_QR_MAILBOX_NUM)

Maximum number of mailboxes available on this system for
quick read. Note that not all mailboxes designated for
data payload may be available since the host could configure them for quick read.

Definition at line 160 of file ci_protocol_mbox.h.

Referenced by ci_update_first_data_mb(), and isf_ci_qr_update().

#define qr_config_clear | ( |  | ) |

Value:
{ \
int iii = MAX_NUM_MAILBOXES-1; \
do \
{ \
ciRegisters.qr_config[iii].appId = 0; \
ciRegisters.qr_config[iii].byte_id = 0; \
} while(--iii >= 0); \
}
MAX_NUM_MAILBOXES
#define MAX_NUM_MAILBOXES
Number of mailboxes available on this sytem.
Definition: ci_protocol_mbox.h:119

Definition at line 243 of file ci_protocol_mbox.h.

Referenced by isf_app_callback_mbox().

#define QR_MAILBOX_MASK ((uint32)0xffffffff << FIRST_QR_MAILBOX_NUM)

Quick read mask that is applied to mailboxes read by host
to mask out mailboxes read by the host but not configured for
quick read.

Definition at line 151 of file ci_protocol_mbox.h.

#define SP_MB0 (0)

Definition at line 39 of file ci_protocol_mbox.h.

#define SP_MB1 (1)

Definition at line 40 of file ci_protocol_mbox.h.

#define SP_MB2 (2)

Definition at line 41 of file ci_protocol_mbox.h.

#define SP_MB3 (3)

Definition at line 42 of file ci_protocol_mbox.h.

#define SP_MB4 (4)

Definition at line 43 of file ci_protocol_mbox.h.

#define WR_CMD_ID_MASK (0x7f)

Definition at line 112 of file ci_protocol_mbox.h.

#define WR_CMD_MASK (0xff)

Definition at line 111 of file ci_protocol_mbox.h.

#define WR_CMD_RSHIFT (0)

Command byte partition. Command byte contains instruction
value in all bits. This
command is written by host to MB0.

Definition at line 110 of file ci_protocol_mbox.h.

## Function Documentation

isf_status_t ci_mbox_init | ( | uint8 | aprotocolID,
|  | void * | apInitData
| ) |  |

Definition at line 531 of file ci_protocol_mbox.c.

isf_status_t ci_protocol_CB_mbox | ( | uint32 | anumBytes,
|  | uint8 * | apSrc,
|  | uint32 * | apnumDestBytes,
|  | uint8 * | apDest
| ) |  |

Definition at line 795 of file ci_protocol_mbox.c.

- © Freescale Semiconductor, Inc. 2015. All Rights Reserved.