ESOS32
ESOSOn32-bitProcessors
|
Files | |
file | esos_hwxxxx_ecan.c |
Template for creating hardware-specific support for the ESOS32 Controller Area Network (CAN) service. | |
file | esos_ecan.h |
file | esos_hwxxx_ecan.h |
This file contains routines which define, configure and allow use of Controller Area Network (CAN) service on the target hardware (hwxxxx) | |
Data Structures | |
struct | client_t |
Macros | |
#define | MAX_CANFACTORY_CLIENTS 32 |
#define | DEFAULT_MSG_ID 0x7a0 |
#define | DEBUG_MODE ESOS_USER_FLAG_F |
#define | ENABLE_DEBUG_MODE() esos_SetUserFlag(DEBUG_MODE) |
#define | DISABLE_DEBUG_MODE() esos_ClearUserFlag(DEBUG_MODE) |
#define | CHECK_DEBUG_MODE_ENABLED() esos_IsUserFlagSet(DEBUG_MODE) |
#define | TRUE 1 |
#define | FALSE 0 |
#define | ESOS_ECAN_SEND(u16_can_id, pu8_msg, u8_len) |
#define | __ESOS_ECAN_HW_NUM_TX_BUFS 1 |
#define | __ESOS_ECAN_HW_NUM_BUFS 8 |
#define | __ESOS_ECAN_HW_ARE_MESSAGES_WAITING() ( _DMA1IF ) |
#define | __ESOS_ECAN_HW_GET_BUFFER_ID() ( C1FIFO & 0x1F ) |
#define | __ESOS_ECAN_HW_TX_IN_PROGRESS() ( C1TR01CONbits.TXREQ0 ) |
Enumerations | |
enum | maskcontrol_t { MASKCONTROL_FIELD_NONZERO, MASKCONTROL_EQUAL } |
Functions | |
__eds__ ECANMSG __esos_ecan_msgBuf[__ESOS_ECAN_HW_NUM_BUFS] | __attribute__ ((space(dma), aligned(__ESOS_ECAN_HW_NUM_BUFS *16), eds)) |
void | __esos_ecan_hw_config_ecan (void) |
void | __esos_ecan_hw_config_dma_tx (void) |
void | __esos_ecan_hw_config_dma_rx (void) |
void | __esos_ecan_hw_mark_message_received (uint16_t u16_rx_buff_id) |
void | __esos_ecan_hw_format_and_send (ECANMSG *p_temp_Msg, uint16_t u16_can_id, uint8_t u8_payload_len) |
void | esos_ecan_canfactory_subscribe (ESOS_TASK_HANDLE pst_Task, uint16_t u16_can_id, uint16_t u16_mask, maskcontrol_t m_mask_control) |
void | esos_ecan_canfactory_unsubscribe (uint8_t(*pst_Task)(ESOS_TASK_HANDLE), uint16_t u16_can_id, uint16_t u16_mask, maskcontrol_t m_mask_control) |
BOOL | esos_ecan_mask_check (uint16_t u16_subscribed, uint16_t u16_recieved, uint16_t u16_mask) |
ESOS_USER_TASK (CANFactory) | |
void | __esos_ecan_hw_config_baud (void) |
void | __esos_ecan_hw_config_rxFilter () |
Variables | |
uint16_t | client_t::u16_canID |
uint16_t | client_t::u16_idMask |
maskcontrol_t | client_t::m_idMaskControl |
uint8_t(* | client_t::pf_task )(ESOS_TASK_HANDLE pst_Task) |
#define ESOS_ECAN_SEND | ( | u16_can_id, | |
pu8_msg, | |||
u8_len | |||
) |
esos_ecan_send():
Send a message using the CANFactory user task.
u16_can_id: CAN ID to be attached to the message. This should follow the assumed convention of your system. For embedded systems at MSU, this should be populated with the appropriate data from the supplied header file. pu8_msg: Pointer to the byte that is the beginning of u8_len bytes of sequential data to be sent. u8_len: Length of message pointed to by pu8_msg in bytes.
Definition at line 86 of file esos_ecan.h.
void esos_ecan_canfactory_subscribe | ( | ESOS_TASK_HANDLE | pst_Task, |
uint16_t | u16_can_id, | ||
uint16_t | u16_mask, | ||
maskcontrol_t | m_mask_control | ||
) |
esos_ecan_canfactory_subscribe():
Enroll a task/mask combination in the CANFactory system.
pst_Task: ESOS user task to be subscribed in the CANFactory. This is the task that is responsible for receiving relevant messages through the ESOS mail system. u16_can_id: CAN ID of the specified task pointed to by pst_Task. u16_mask: Mask to be used in accordance to the convention specified by m_mask_control. m_mask_control: Can be either value of the enumeration maskcontrol_t as shown below. MASKCONTROL_FIELD_NONZERO: u16_mask represents a mask that covers all message headers to which pst_Task should listen. If a message header has a bit lifted underneath the mask, the message will be sent to the pst_Task mailbox. MASKCONTROL_EQUAL: u16_mask represents a mask that is the exact message header to which pst_Task should listen. If a message header does not match this mask exactly, it will not be sent to the pst_Task mailbox.
void esos_ecan_canfactory_unsubscribe | ( | uint8_t(*)(ESOS_TASK_HANDLE) | pst_Task, |
uint16_t | u16_can_id, | ||
uint16_t | u16_mask, | ||
maskcontrol_t | m_mask_control | ||
) |
esos_ecan_canfactory_unsubscribe():
Unsubscribe a task/mask combination in the CANFactory system.
pst_Task: Task handle of the task that should be removed from CANFactory's data structure. u16_can_id: CAN ID of the task that should be removed from CANFactory's data structure. u16_mask: Mask of the task/mask combination that should be removed from the CANFactory's data structure. m_mask_control: Mask control specifier of the task/mask combination that should be removed from the CANFactory's data structure.
BOOL esos_ecan_mask_check | ( | uint16_t | u16_subscribed, |
uint16_t | u16_recieved, | ||
uint16_t | u16_mask | ||
) |
Check subscribed messages against recieved messages according to the mask.
u16_subscribed: ID of the subscribed task.
u16_recieved: CAN ID of the message recieved.
u16_mask: Mask ID to be checked against.
ESOS_USER_TASK | ( | CANFactory | ) |
CANFactory user task:
Handles the management of the ECAN peripheral so that the API can be used.
Note: the user should register this task from user_init in addition to using the API in this file.