CAN software stack for 32-bit AVR that supports initializing the CAN bus and sending/receiving data.
Modules | |
Related Project(s) | |
In this section you can find all the projects related to the CAN software stack. | |
Data Structures | |
struct | can_mob_t |
Macros | |
#define | CAN_CMD_ACCEPTED 0x00 |
This constant is used as return value for "can_cmd" function. More... | |
#define | CAN_CMD_REFUSED 0xFF |
This constant is used as return value for "can_cmd" function. More... | |
#define | CAN_DATA_FRAME 0 |
This constant is used for MOB Initialization request. More... | |
#define | CAN_MOB_NOT_ALLOCATED 0xFF |
This constant is used for MOB Allocation status. More... | |
#define | CAN_REMOTE_FRAME 1 |
This constant is used for MOB Initialization request. More... | |
#define | CAN_STATUS_BUSOFF 0x04 |
This constant is used as return value for "can_get_status" function. More... | |
#define | CAN_STATUS_COMPLETED 0x00 |
This constant is used as return value for "can_get_status" function. More... | |
#define | CAN_STATUS_ERROR 0x02 |
This constant is used as return value for "can_get_status" function. More... | |
#define | CAN_STATUS_NOT_COMPLETED 0x01 |
This constant is used as return value for "can_get_status" function. More... | |
#define | CAN_STATUS_WAKEUP 0x03 |
This constant is used as return value for "can_get_status" function. More... | |
Functions | |
void | can_clear_status (U8 ch, U8 mob) |
Clear All Status on CAN Channel for a selected MOB. More... | |
U8 | can_enable_interrupt (U8 ch) |
Enable interrupt on CAN Channel. More... | |
Union64 | can_get_mob_data (U8 ch, U8 handle) |
Get Mob data from a selected MOB. More... | |
U8 | can_get_mob_dlc (U8 ch, U8 handle) |
Get Mob dlc from a selected MOB. More... | |
U32 | can_get_mob_id (U8 ch, U8 handle) |
Get Mob ID from a selected MOB. More... | |
U8 | can_init (U8 ch, U32 can_msg_ram_add, U8 operating_mode, void(*can_msg_callback)(U8, U8)) |
Initialize CAN channel. More... | |
U8 | can_mob_alloc (U8 ch) |
Allocate one MOB in a specific CAN Channel. More... | |
U8 | can_mob_free (U8 ch, U8 handle) |
Free one specific MOB in a specific CAN Channel. More... | |
U8 | can_mob_get_status (U8 ch, U8 handle) |
Get Mob status from a selected MOB. More... | |
U8 | can_rx (U8 ch, U8 handle, U8 req_type, const can_msg_t *can_msg) |
Start Reception. More... | |
U8 | can_tx (U8 ch, U8 handle, U8 dlc, U8 req_type, const can_msg_t *can_msg) |
Start Transmission. More... | |
#define CAN_CMD_ACCEPTED 0x00 |
This constant is used as return value for "can_cmd" function.
Referenced by can_enable_interrupt(), can_init(), can_mob_free(), can_rx(), and can_tx().
#define CAN_CMD_REFUSED 0xFF |
This constant is used as return value for "can_cmd" function.
Referenced by can_enable_interrupt(), can_example_prepare_data(), can_example_prepare_data_to_send(), can_init(), can_mob_alloc(), can_mob_free(), can_mob_get_status(), can_rx(), and can_tx().
#define CAN_DATA_FRAME 0 |
This constant is used for MOB Initialization request.
#define CAN_MOB_NOT_ALLOCATED 0xFF |
This constant is used for MOB Allocation status.
#define CAN_REMOTE_FRAME 1 |
#define CAN_STATUS_BUSOFF 0x04 |
This constant is used as return value for "can_get_status" function.
Referenced by can0_int_busoff_handler(), can1_int_busoff_handler(), and main().
#define CAN_STATUS_COMPLETED 0x00 |
This constant is used as return value for "can_get_status" function.
Referenced by can0_int_rx_handler(), can0_int_tx_handler(), can1_int_rx_handler(), can1_int_tx_handler(), can_mob_get_status(), and main().
#define CAN_STATUS_ERROR 0x02 |
This constant is used as return value for "can_get_status" function.
Referenced by can0_int_cerr_handler(), can1_int_cerr_handler(), can_mob_get_status(), and main().
#define CAN_STATUS_NOT_COMPLETED 0x01 |
This constant is used as return value for "can_get_status" function.
Referenced by can_mob_get_status().
#define CAN_STATUS_WAKEUP 0x03 |
This constant is used as return value for "can_get_status" function.
Referenced by can0_int_wakeup_handler(), and can1_int_wakeup_handler().
Clear All Status on CAN Channel for a selected MOB.
ch | CAN channel selected 0 (CAN Channel 0) 1 (CAN Channel 1) |
mob | CAN MOB number |
References CANIF_mob_clear_status.
Enable interrupt on CAN Channel.
ch | CAN channel selected 0 (CAN Channel 0) 1 (CAN Channel 1) |
References CAN0_INT_BOFF_LEVEL, can0_int_busoff_handler(), can0_int_cerr_handler(), CAN0_INT_ERR_LEVEL, can0_int_rx_handler(), CAN0_INT_RX_LEVEL, can0_int_tx_handler(), CAN0_INT_TX_LEVEL, CAN0_INT_WAKE_UP_LEVEL, can0_int_wakeup_handler(), CAN1_INT_BOFF_LEVEL, can1_int_busoff_handler(), can1_int_cerr_handler(), CAN1_INT_ERR_LEVEL, can1_int_rx_handler(), CAN1_INT_RX_LEVEL, can1_int_tx_handler(), CAN1_INT_TX_LEVEL, CAN1_INT_WAKE_UP_LEVEL, can1_int_wakeup_handler(), CAN_CMD_ACCEPTED, CAN_CMD_REFUSED, CANIF_enable_interrupt, and INTC_register_interrupt().
Referenced by can_init().
Get Mob data from a selected MOB.
ch | CAN channel selected 0 (CAN Channel 0) 1 (CAN Channel 1) |
handle | CAN MOB number |
References CANIF_mob_get_ptr_data, and data.
Referenced by can_out_callback_channel0().
Get Mob dlc from a selected MOB.
ch | CAN channel selected 0 (CAN Channel 0) 1 (CAN Channel 1) |
handle | CAN MOB number |
References CANIF_mob_get_dlc.
Referenced by can_out_callback_channel0().
Get Mob ID from a selected MOB.
ch | CAN channel selected 0 (CAN Channel 0) 1 (CAN Channel 1) |
handle | CAN MOB number |
References CANIF_get_ext_id.
Referenced by can_out_callback_channel0().
Initialize CAN channel.
ch | CAN channel selected 0 (CAN Channel 0) 1 (CAN Channel 1) |
can_msg_ram_add | Address of the location of MOB Ram Buffer |
operating_mode | Selection between CAN_CHANNEL_MODE_NORMAL or CAN_CHANNEL_MODE_LISTENING or CAN_CHANNEL_MODE_LOOPBACK |
can_msg_callback | Callback for hardware interrupt |
Allocate one MOB in a specific CAN Channel.
ch | CAN channel selected 0 (CAN Channel 0) 1 (CAN Channel 1) |
References CAN_CMD_REFUSED, can_mob_alloc_vector0, can_mob_alloc_vector1, CANIF_clr_mob, i, and NB_MOB_CHANNEL.
Referenced by can_example_prepare_data(), can_example_prepare_data_to_receive(), can_example_prepare_data_to_send(), and main().
Free one specific MOB in a specific CAN Channel.
ch | CAN channel selected 0 (CAN Channel 0) 1 (CAN Channel 1) |
handle | CAN MOB number |
References CAN_CMD_ACCEPTED, CAN_CMD_REFUSED, can_mob_alloc_vector0, can_mob_alloc_vector1, and NB_MOB_CHANNEL.
Referenced by can_out_callback_channel0(), and can_out_callback_channel1().
Get Mob status from a selected MOB.
ch | CAN channel selected 0 (CAN Channel 0) 1 (CAN Channel 1) |
handle | CAN MOB number |
References CAN_CMD_REFUSED, CAN_STATUS_COMPLETED, CAN_STATUS_ERROR, CAN_STATUS_NOT_COMPLETED, CANIF_get_interrupt_error_status, CANIF_mob_get_status, MOB_RX_COMPLETED, MOB_RX_COMPLETED_DLCW, MOB_TX_COMPLETED, NB_MOB_CHANNEL, and status.
Start Reception.
ch | CAN channel selected 0 (CAN Channel 0) 1 (CAN Channel 1) |
handle | CAN MOB number |
req_type | CAN_DATA_FRAME or CAN_REMOTE_FRAME |
can_msg | CAN Message |
References CAN_CMD_ACCEPTED, CAN_CMD_REFUSED, CAN_REMOTE_FRAME, CANIF_config_rx, CANIF_mob_enable, CANIF_mob_enable_interrupt, CANIF_mob_set_automode, CANIF_set_data, CANIF_set_ext_id, CANIF_set_ext_idmask, CANIF_set_rtr, CANIF_set_rtrmask, CANIF_set_std_id, CANIF_set_std_idmask, data, can_msg_t::id, can_msg_t::id_mask, can_msg_t::ide_bit, and NB_MOB_CHANNEL.
Referenced by can_example_prepare_data(), can_example_prepare_data_to_receive(), and main().
Start Transmission.
ch | CAN channel selected 0 (CAN Channel 0) 1 (CAN Channel 1) |
handle | CAN MOB number |
dlc | Datalength |
req_type | CAN_DATA_FRAME or CAN_REMOTE_FRAME |
can_msg | CAN Message |
References CAN_CMD_ACCEPTED, CAN_CMD_REFUSED, CAN_REMOTE_FRAME, CANIF_config_tx, CANIF_mob_clr_dlc, CANIF_mob_enable, CANIF_mob_enable_interrupt, CANIF_mob_set_automode, CANIF_mob_set_dlc, CANIF_set_data, CANIF_set_ext_id, CANIF_set_ext_idmask, CANIF_set_rtr, CANIF_set_rtrmask, CANIF_set_std_id, CANIF_set_std_idmask, data, can_msg_t::id, can_msg_t::id_mask, can_msg_t::ide_bit, and NB_MOB_CHANNEL.
Referenced by can_example_prepare_data(), and can_example_prepare_data_to_send().