RZT Flexible Software Package Documentation
Release v2.2.0
|
|
Interface for CAN peripheral.
The CAN interface provides common APIs for CAN HAL drivers. CAN interface supports following features.
Data Structures | |
struct | can_info_t |
struct | can_bit_timing_cfg_t |
struct | can_frame_t |
struct | can_callback_args_t |
struct | can_cfg_t |
struct | can_api_t |
struct | can_instance_t |
Typedefs | |
typedef void | can_ctrl_t |
Enumerations | |
enum | can_event_t |
enum | can_operation_mode_t |
enum | can_test_mode_t |
enum | can_id_mode_t |
enum | can_frame_type_t |
struct can_info_t |
CAN status info
struct can_bit_timing_cfg_t |
struct can_frame_t |
CAN data Frame
Data Fields | ||
---|---|---|
uint32_t | id | CAN ID. |
can_id_mode_t | id_mode | Standard or Extended ID (IDE). |
can_frame_type_t | type | Frame type (RTR). |
uint8_t | data_length_code | CAN Data Length Code (DLC). |
uint32_t | options | Implementation-specific options. |
uint8_t | data[CAN_DATA_BUFFER_LENGTH] | CAN data. |
struct can_callback_args_t |
CAN callback parameter definition
Data Fields | ||
---|---|---|
uint32_t | channel | Device channel number. |
can_event_t | event | Event code. |
uint32_t | error | Error code. |
union can_callback_args_t | __unnamed__ | |
void const * | p_context | Context provided to user during callback. |
can_frame_t | frame | Received frame data. |
struct can_cfg_t |
CAN Configuration
Data Fields | |
uint32_t | channel |
CAN channel. | |
can_bit_timing_cfg_t * | p_bit_timing |
CAN bit timing. | |
void(* | p_callback )(can_callback_args_t *p_args) |
Pointer to callback function. | |
void const * | p_context |
User defined callback context. | |
void const * | p_extend |
CAN hardware dependent configuration. | |
uint8_t | ipl |
Error/Transmit/Receive interrupt priority. | |
IRQn_Type | error_irq |
Error IRQ number. | |
IRQn_Type | rx_irq |
Receive IRQ number. | |
IRQn_Type | tx_irq |
Transmit IRQ number. | |
struct can_api_t |
Shared Interface definition for CAN
Data Fields | |
fsp_err_t(* | open )(can_ctrl_t *const p_ctrl, can_cfg_t const *const p_cfg) |
fsp_err_t(* | write )(can_ctrl_t *const p_ctrl, uint32_t buffer_number, can_frame_t *const p_frame) |
fsp_err_t(* | read )(can_ctrl_t *const p_ctrl, uint32_t buffer_number, can_frame_t *const p_frame) |
fsp_err_t(* | close )(can_ctrl_t *const p_ctrl) |
fsp_err_t(* | modeTransition )(can_ctrl_t *const p_ctrl, can_operation_mode_t operation_mode, can_test_mode_t test_mode) |
fsp_err_t(* | infoGet )(can_ctrl_t *const p_ctrl, can_info_t *const p_info) |
fsp_err_t(* | callbackSet )(can_ctrl_t *const p_ctrl, void(*p_callback)(can_callback_args_t *), void const *const p_context, can_callback_args_t *const p_callback_memory) |
fsp_err_t(* can_api_t::open) (can_ctrl_t *const p_ctrl, can_cfg_t const *const p_cfg) |
Open function for CAN device
[in,out] | p_ctrl | Pointer to the CAN control block. Must be declared by user. Value set here. |
[in] | p_cfg | Pointer to CAN configuration structure. All elements of this structure must be set by user. |
fsp_err_t(* can_api_t::write) (can_ctrl_t *const p_ctrl, uint32_t buffer_number, can_frame_t *const p_frame) |
Write function for CAN device
[in] | p_ctrl | Pointer to the CAN control block. |
[in] | buffer | Buffer number (mailbox or message buffer) to write to. |
[in] | p_frame | Pointer for frame of CAN ID, DLC, data and frame type to write. |
fsp_err_t(* can_api_t::read) (can_ctrl_t *const p_ctrl, uint32_t buffer_number, can_frame_t *const p_frame) |
Read function for CAN device
[in] | p_ctrl | Pointer to the CAN control block. |
[in] | buffer | Message buffer (number) to read from. |
[in] | p_frame | Pointer to store the CAN ID, DLC, data and frame type. |
fsp_err_t(* can_api_t::close) (can_ctrl_t *const p_ctrl) |
Close function for CAN device
[in] | p_ctrl | Pointer to the CAN control block. |
fsp_err_t(* can_api_t::modeTransition) (can_ctrl_t *const p_ctrl, can_operation_mode_t operation_mode, can_test_mode_t test_mode) |
Mode Transition function for CAN device
[in] | p_ctrl | Pointer to the CAN control block. |
[in] | operation_mode | Destination CAN operation state. |
[in] | test_mode | Destination CAN test state. |
fsp_err_t(* can_api_t::infoGet) (can_ctrl_t *const p_ctrl, can_info_t *const p_info) |
Get CAN channel info.
[in] | p_ctrl | Handle for channel (pointer to channel control block) |
[out] | p_info | Memory address to return channel specific data to. |
fsp_err_t(* can_api_t::callbackSet) (can_ctrl_t *const p_ctrl, void(*p_callback)(can_callback_args_t *), void const *const p_context, can_callback_args_t *const p_callback_memory) |
Specify callback function and optional context pointer and working memory pointer.
[in] | p_ctrl | Control block set in can_api_t::open call. |
[in] | p_callback | Callback function to register |
[in] | p_context | Pointer to send to callback function |
[in] | p_working_memory | Pointer to volatile memory where callback structure can be allocated. Callback arguments allocated here are only valid during the callback. |
struct can_instance_t |
This structure encompasses everything that is needed to use an instance of this interface.
Data Fields | ||
---|---|---|
can_ctrl_t * | p_ctrl | Pointer to the control structure for this instance. |
can_cfg_t const * | p_cfg | Pointer to the configuration structure for this instance. |
can_api_t const * | p_api | Pointer to the API structure for this instance. |
typedef void can_ctrl_t |
CAN control block. Allocate an instance specific control block to pass into the CAN API calls.
enum can_event_t |
CAN event codes
enum can_operation_mode_t |
enum can_test_mode_t |
CAN Test modes
enum can_id_mode_t |
enum can_frame_type_t |