![]() |
Altera HWLIB
16.0
The Altera HW Manager API Reference Manual
|
This module defines an API for configuring and managing the HPS CAN controllers.
The hardware processor system (HPS) provides two controller area network (CAN) controllers for serial communication with the Cortex™-A9 microprocessor unit (MPU) subsystem host processor and the direct memory access (DMA) controller using the CAN protocol. The CAN controllers are instances of the Bosch D_CAN controller and compliant with ISO 11898-1.
The CAN controllers perform communication according to the CAN protocol version 2.0 parts A and B. All communication on the CAN bus is through message objects. The CAN controller stores message objects in its internal message RAM. The host processor cannot access the message RAM directly, instead the IF1and IF2message interface register sets provide the host processor access to the messages. Messages are passed between the message RAM and the CAN core by the message handler. The message handler is also responsible for message level responsibilities such as acceptance filtering, interrupt generation, and transmission request generation.
Features of the CAN Controller:
For a complete details on the configuration and operation of CAN controller, consult the following references:
Data Structures | |
struct | ALT_CAN_MAILBOX_PARAM_s |
struct | ALT_CAN_STATUS_s |
struct | ALT_CAN_BITTIME_s |
struct | ALT_CAN_MSG_PARAM_s |
struct | ALT_CAN_MSG_MSK_s |
struct | ALT_CAN_MSG_ARB_s |
struct | ALT_CAN_MSG_IFMCTR_s |
struct | ALT_CAN_ERROR_COUNTER_s |
Macros | |
#define | ALT_CAN_MAILBOXES_COUNT (128) |
#define | ALT_CAN_DEFAULT_BAUDRATE (100000) |
Typedefs | |
typedef enum ALT_CAN_TMOD_e | ALT_CAN_TMOD_t |
typedef enum ALT_CAN_FIFO_MODE_e | ALT_CAN_FIFO_MODE_t |
typedef struct ALT_CAN_MAILBOX_PARAM_s | ALT_CAN_MAILBOX_PARAM_t |
typedef enum ALT_CAN_CTLR_e | ALT_CAN_CTLR_t |
typedef enum ALT_CAN_INTERFACE_e | ALT_CAN_INTERFACE_t |
typedef enum ALT_CAN_TEST_TYPE_e | ALT_CAN_TEST_TYPE_t |
typedef enum ALT_CAN_LAST_ERROR_e | ALT_CAN_LAST_ERROR_t |
typedef struct ALT_CAN_STATUS_s | ALT_CAN_STATUS_t |
typedef struct ALT_CAN_BITTIME_s | ALT_CAN_BITTIME_t |
typedef struct ALT_CAN_MSG_PARAM_s | ALT_CAN_MSG_PARAM_t |
typedef struct ALT_CAN_MSG_MSK_s | ALT_CAN_MSG_MSK_t |
typedef struct ALT_CAN_MSG_ARB_s | ALT_CAN_MSG_ARB_t |
typedef struct ALT_CAN_MSG_IFMCTR_s | ALT_CAN_MSG_IFMCTR_t |
typedef enum ALT_CAN_INT_GROUP_e | ALT_CAN_INT_GROUP_t |
typedef struct ALT_CAN_ERROR_COUNTER_s | ALT_CAN_ERROR_COUNTER_t |
ENUMS | |
enum | ALT_CAN_TMOD_e { ALT_CAN_TMOD_TX = 0, ALT_CAN_TMOD_RX = 1 } |
enum | ALT_CAN_FIFO_MODE_e { ALT_CAN_FIFO_MODE_SINGLE_MSG, ALT_CAN_FIFO_MODE_BUFFER_NOT_LAST, ALT_CAN_FIFO_MODE_BUFFER_LAST } |
enum | ALT_CAN_CTLR_e { ALT_CAN_CAN0 = (int)ALT_CAN0_OFST, ALT_CAN_CAN1 = (int)ALT_CAN1_OFST } |
enum | ALT_CAN_INTERFACE_e { ALT_CAN_INTERFACE_READ = (int)ALT_CAN_MSGIF_IF1CMR_OFST, ALT_CAN_INTERFACE_WRITE = (int)ALT_CAN_MSGIF_IF2CMR_OFST } |
enum | ALT_CAN_TEST_TYPE_e |
enum | ALT_CAN_LAST_ERROR_e { ALT_CAN_STAT_ERROR_NOERROR, ALT_CAN_STAT_ERROR_STUFF, ALT_CAN_STAT_ERROR_FORM, ALT_CAN_STAT_ERROR_ACK, ALT_CAN_STAT_ERROR_BIT1, ALT_CAN_STAT_ERROR_BIT0, ALT_CAN_STAT_ERROR_CRC, ALT_CAN_STAT_ERROR_NOCNG } |
enum | ALT_CAN_INT_GROUP_e { ALT_CAN_INT_GROUP_MOD_LINE = 1UL << 0, ALT_CAN_INT_GROUP_STATUS = 1UL << 1, ALT_CAN_INT_GROUP_ERROR = 1UL << 2, ALT_CAN_INT_GROUP_MSG_LINE = 1UL << 3, ALT_CAN_INT_GROUP_ALL = 0xF } |
Functions | |
ALT_STATUS_CODE | alt_can_init (const ALT_CAN_CTLR_t can, ALT_CAN_DEV_t *can_dev) |
ALT_STATUS_CODE | alt_can_reset (ALT_CAN_DEV_t *can_dev) |
ALT_STATUS_CODE | alt_can_disable (ALT_CAN_DEV_t *can_dev) |
ALT_STATUS_CODE | alt_can_enable (ALT_CAN_DEV_t *can_dev) |
ALT_STATUS_CODE | alt_can_is_enabled (ALT_CAN_DEV_t *can_dev) |
ALT_STATUS_CODE | alt_can_baudrate_set (ALT_CAN_DEV_t *can_dev, const uint32_t bitrate) |
ALT_STATUS_CODE | alt_can_uninit (ALT_CAN_DEV_t *can_dev) |
ALT_STATUS_CODE | alt_can_int_disable (ALT_CAN_DEV_t *can_dev, const uint8_t mask) |
ALT_STATUS_CODE | alt_can_int_enable (ALT_CAN_DEV_t *can_dev, const uint8_t mask) |
ALT_STATUS_CODE | alt_can_int_ident_get (ALT_CAN_DEV_t *can_dev, uint32_t *interrupt) |
ALT_STATUS_CODE | alt_can_int_status_get (ALT_CAN_DEV_t *can_dev) |
ALT_STATUS_CODE | alt_can_bit_timing_get (ALT_CAN_DEV_t *can_dev, ALT_CAN_BITTIME_t *params) |
ALT_STATUS_CODE | alt_can_bit_timing_set (ALT_CAN_DEV_t *can_dev, ALT_CAN_BITTIME_t *bittime) |
ALT_STATUS_CODE | alt_can_rate_to_bittime (ALT_CAN_DEV_t *can_dev, uint32_t bitrate, ALT_CAN_BITTIME_t *bittime) |
ALT_STATUS_CODE | alt_can_test_mode_disable (ALT_CAN_DEV_t *can_dev) |
ALT_STATUS_CODE | alt_can_test_mode_enable (ALT_CAN_DEV_t *can_dev, ALT_CAN_TEST_TYPE_t type) |
ALT_STATUS_CODE | alt_can_test_mode_is_enabled (ALT_CAN_DEV_t *can_dev, ALT_CAN_TEST_TYPE_t *type) |
ALT_STATUS_CODE | alt_can_error_counter_get (ALT_CAN_DEV_t *can_dev, ALT_CAN_ERROR_COUNTER_t *counter) |
ALT_STATUS_CODE | alt_can_status_get (ALT_CAN_DEV_t *can_dev, ALT_CAN_STATUS_t *status) |
ALT_STATUS_CODE | alt_can_if_cmd_set (ALT_CAN_DEV_t *can_dev, ALT_CAN_INTERFACE_t if_index, uint32_t msg_obj_num, ALT_CAN_MSG_PARAM_t *cmd_params) |
ALT_STATUS_CODE | alt_can_if_mask_set (ALT_CAN_DEV_t *can_dev, ALT_CAN_INTERFACE_t if_index, ALT_CAN_MSG_MSK_t *mask_param) |
ALT_STATUS_CODE | alt_can_if_mask_get (ALT_CAN_DEV_t *can_dev, ALT_CAN_INTERFACE_t if_index, ALT_CAN_MSG_MSK_t *mask_param) |
ALT_STATUS_CODE | alt_can_if_arb_set (ALT_CAN_DEV_t *can_dev, ALT_CAN_INTERFACE_t if_index, ALT_CAN_MSG_ARB_t *arb_param) |
ALT_STATUS_CODE | alt_can_if_arb_get (ALT_CAN_DEV_t *can_dev, ALT_CAN_INTERFACE_t if_index, ALT_CAN_MSG_ARB_t *arb_param) |
ALT_STATUS_CODE | alt_can_if_msg_ctrl_set (ALT_CAN_DEV_t *can_dev, ALT_CAN_INTERFACE_t if_index, ALT_CAN_MSG_IFMCTR_t *ctrl) |
ALT_STATUS_CODE | alt_can_if_msg_ctrl_get (ALT_CAN_DEV_t *can_dev, ALT_CAN_INTERFACE_t if_index, ALT_CAN_MSG_IFMCTR_t *ctrl) |
ALT_STATUS_CODE | alt_can_if_data_set (ALT_CAN_DEV_t *can_dev, ALT_CAN_INTERFACE_t if_index, uint32_t dataA, uint32_t dataB) |
ALT_STATUS_CODE | alt_can_if_data_get (ALT_CAN_DEV_t *can_dev, ALT_CAN_INTERFACE_t if_index, uint32_t *dataA, uint32_t *dataB) |
ALT_STATUS_CODE | alt_can_mailbox_reset (ALT_CAN_DEV_t *can_dev, ALT_CAN_INTERFACE_t if_index, uint32_t msg_obj_num) |
ALT_STATUS_CODE | alt_can_message_is_busy (ALT_CAN_DEV_t *can_dev, ALT_CAN_INTERFACE_t if_index) |
ALT_STATUS_CODE | alt_can_message_put (ALT_CAN_DEV_t *can_dev, ALT_CAN_INTERFACE_t if_index, uint32_t msg_obj_num, ALT_CAN_MSG_PARAM_t *cmd_params) |
ALT_STATUS_CODE | alt_can_message_get (ALT_CAN_DEV_t *can_dev, ALT_CAN_INTERFACE_t if_index, uint32_t msg_obj_num, ALT_CAN_MSG_PARAM_t *cmd_params) |
ALT_STATUS_CODE | alt_can_mailbox_init (ALT_CAN_DEV_t *can_dev, uint32_t msg_obj_num, uint32_t id, uint32_t id_mask, ALT_CAN_TMOD_t transfer_mode, ALT_CAN_FIFO_MODE_t fifo_mode) |
ALT_STATUS_CODE | alt_can_mailbox_uninit (ALT_CAN_DEV_t *can_dev, uint32_t msg_obj_num) |
ALT_STATUS_CODE | alt_can_mailboxes_reset (ALT_CAN_DEV_t *can_dev) |
ALT_STATUS_CODE | alt_can_frame_read (ALT_CAN_DEV_t *can_dev, uint32_t msg_obj_num, void *buffer, uint32_t *frame_size) |
ALT_STATUS_CODE | alt_can_frame_write (ALT_CAN_DEV_t *can_dev, uint32_t msg_obj_num, void *buffer) |
ALT_STATUS_CODE | alt_can_data_read (ALT_CAN_DEV_t *can_dev, uint32_t msg_obj_num, void *buffer, uint32_t size, uint32_t *bytes_read) |
ALT_STATUS_CODE | alt_can_data_write (ALT_CAN_DEV_t *can_dev, uint32_t msg_obj_num, void *buffer, uint32_t size) |
struct ALT_CAN_MAILBOX_PARAM_s |
This type defines a structure for status and parameters of specified mailbox.
Data Fields | ||
---|---|---|
uint32_t | id | Identifier Mask |
uint32_t | mask | Identifier Mask for acceptance filtering of incoming messages. |
uint32_t | dlc | Data Length Code |
ALT_CAN_TMOD_t | transfer_mode | Transfer mode |
bool | init_done | Initialization is completed for specified mailbox if init_done is true |
bool | extend | Extended Identifier true - the 29-bit (extended) identifier will be used for this mailbox. false - the 11-bit (standard) identifier will be used for this Message Object. |
bool | remote | Remote Enable true - at the reception of a Remote Frame, TxRqst is set. false - at the reception of a Remote Frame, TxRqst is left unchanged. |
ALT_CAN_FIFO_MODE_t | fifo_mode | Single message object, or fifo mode |
struct ALT_CAN_STATUS_s |
This type defines a structure for status of CAN instance.
Data Fields | ||
---|---|---|
ALT_CAN_LAST_ERROR_t | last_err_code | The LEC field holds a code which indicates the type of the last error to occur on the CAN bus. This field will be cleared to 0 when a message has been transferred (reception or transmission) without error.. |
bool | tx_success | Since this bit was last reset by a read access of the CPU, a message has been successfully (error free and acknowledged by at least one other node) transmitted. This bit will be reset by reading the Status Register. |
bool | rx_success | Since this bit was last reset by a read access of the CPU, a message has been successfully received (independently of the result of acceptance filtering). This bit will be reset by reading the Status Register. |
bool | err_passive | Limited error signaling and transmission features. |
bool | warning | At least one of the error counters in the EML has reached the error warning limit of 96. |
bool | bus_off | The CAN module is in Bus_Off state. |
bool | par_error | The Parity Check Mechanism has detected a parity error in the Message RAM, this bit will be reset if Status Register is read. |
struct ALT_CAN_BITTIME_s |
This type defines a structure for status of CAN instance.
struct ALT_CAN_MSG_PARAM_s |
This type defines a structure for config parameters of CAN Message Object.
struct ALT_CAN_MSG_MSK_s |
This type defines a structure for message mask of CAN message object.
struct ALT_CAN_MSG_ARB_s |
This type defines a structure for message control arbitration of CAN message object.
struct ALT_CAN_MSG_IFMCTR_s |
This type defines a structure for message control parameters of CAN message object.
struct ALT_CAN_ERROR_COUNTER_s |
This type defines a structure for error counters of CAN controller.
#define ALT_CAN_MAILBOXES_COUNT (128) |
The number of mailboxes of the CAN controller.
#define ALT_CAN_DEFAULT_BAUDRATE (100000) |
Default baudrate.
typedef enum ALT_CAN_TMOD_e ALT_CAN_TMOD_t |
This type enumerates the CAN transfer mode choices.
typedef enum ALT_CAN_FIFO_MODE_e ALT_CAN_FIFO_MODE_t |
This type enumerates single message object or FIFO mode for a mailbox.
typedef struct ALT_CAN_MAILBOX_PARAM_s ALT_CAN_MAILBOX_PARAM_t |
This type defines a structure for status and parameters of specified mailbox.
typedef enum ALT_CAN_CTLR_e ALT_CAN_CTLR_t |
This type enumerates the HPS CAN controller instances.
typedef enum ALT_CAN_INTERFACE_e ALT_CAN_INTERFACE_t |
This type enumerates the HPS CAN message interfaces.
typedef enum ALT_CAN_TEST_TYPE_e ALT_CAN_TEST_TYPE_t |
This type enumerates the test types for the CAN controller.
typedef enum ALT_CAN_LAST_ERROR_e ALT_CAN_LAST_ERROR_t |
This type enumerates interrupt groups for the CAN controller.
typedef struct ALT_CAN_STATUS_s ALT_CAN_STATUS_t |
This type defines a structure for status of CAN instance.
typedef struct ALT_CAN_BITTIME_s ALT_CAN_BITTIME_t |
This type defines a structure for status of CAN instance.
typedef struct ALT_CAN_MSG_PARAM_s ALT_CAN_MSG_PARAM_t |
This type defines a structure for config parameters of CAN Message Object.
typedef struct ALT_CAN_MSG_MSK_s ALT_CAN_MSG_MSK_t |
This type defines a structure for message mask of CAN message object.
typedef struct ALT_CAN_MSG_ARB_s ALT_CAN_MSG_ARB_t |
This type defines a structure for message control arbitration of CAN message object.
typedef struct ALT_CAN_MSG_IFMCTR_s ALT_CAN_MSG_IFMCTR_t |
This type defines a structure for message control parameters of CAN message object.
typedef enum ALT_CAN_INT_GROUP_e ALT_CAN_INT_GROUP_t |
This type enumerates interrupt groups for the CAN controller.
typedef struct ALT_CAN_ERROR_COUNTER_s ALT_CAN_ERROR_COUNTER_t |
This type defines a structure for error counters of CAN controller.
enum ALT_CAN_TMOD_e |
enum ALT_CAN_FIFO_MODE_e |
This type enumerates single message object or FIFO mode for a mailbox.
enum ALT_CAN_CTLR_e |
enum ALT_CAN_INTERFACE_e |
enum ALT_CAN_TEST_TYPE_e |
This type enumerates the test types for the CAN controller.
enum ALT_CAN_LAST_ERROR_e |
This type enumerates interrupt groups for the CAN controller.
enum ALT_CAN_INT_GROUP_e |
This type enumerates interrupt groups for the CAN controller.
ALT_STATUS_CODE alt_can_init | ( | const ALT_CAN_CTLR_t | can, |
ALT_CAN_DEV_t * | can_dev | ||
) |
Initializes the specified CAN controller instance for use and return a device handle referencing it.
can | The HPS CAN controller instance to initialize. |
can_dev | A pointer to the CAN controller device block instance. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_reset | ( | ALT_CAN_DEV_t * | can_dev | ) |
Resets the specified CAN controller instance for use.
can_dev | A pointer to the CAN controller device block instance. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_disable | ( | ALT_CAN_DEV_t * | can_dev | ) |
Disables the CAN controller.
When the CAN controller is disabled, the following occurs:
can_dev | A pointer to the CAN controller device block instance. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_enable | ( | ALT_CAN_DEV_t * | can_dev | ) |
Enables the CAN controller.
When the CAN controller is enabled, the following occurs:
can_dev | A pointer to the CAN controller device block instance. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_is_enabled | ( | ALT_CAN_DEV_t * | can_dev | ) |
Returns ALT_E_TRUE if the CAN controller is enabled, ALT_E_FALSE otherwise
can_dev | A pointer to the CAN controller device block instance. |
ALT_E_TRUE | The CAN controller in question is enabled. |
ALT_E_FALSE | The CAN controller in question is disabled. |
ALT_STATUS_CODE alt_can_baudrate_set | ( | ALT_CAN_DEV_t * | can_dev, |
const uint32_t | bitrate | ||
) |
Configures the specified CAN controller instance to the desired baudrate.
can_dev | A pointer to the CAN controller device block instance. |
bitrate | baudrate desired |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_uninit | ( | ALT_CAN_DEV_t * | can_dev | ) |
Uninitializes the CAN controller referenced by the can_dev handle.
This function attempts to gracefully shutdown the CAN controller by waiting for any incomplete transactions to finish and then putting the CAN controller into reset.
can_dev | A pointer to the CAN controller device block instance. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_int_disable | ( | ALT_CAN_DEV_t * | can_dev, |
const uint8_t | mask | ||
) |
Disables the specified CAN controller interrupt status conditions identified in the mask.
This function disables one or more of the status conditions as contributors to the ALT_INT_INTERRUPT_CANn_IRQ interrupt signal state.
NOTE: A cleared bit for any status condition in the mask value does not have the effect of enabling it as a contributor to the ALT_INT_INTERRUPT_CANn_IRQ interrupt signal state. The function alt_can_int_enable() is used to enable status source conditions.
can_dev | A pointer to the CAN controller device block instance. |
mask | Specifies the status conditions to disable as interrupt source contributors. mask is a mask of logically OR'ed ALT_CAN_STATUS_t values that designate the status conditions to disable. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_int_enable | ( | ALT_CAN_DEV_t * | can_dev, |
const uint8_t | mask | ||
) |
Enables the specified CAN controller interrupt status conditions identified in the mask.
This function enables one or more of the status conditions as contributors to the ALT_INT_INTERRUPT_CANn_IRQ interrupt signal state.
NOTE: A cleared bit for any status condition in the mask value does not have the effect of disabling it as a contributor to the ALT_INT_INTERRUPT_CANn_IRQ interrupt signal state. The function alt_can_int_disable() is used to disable status source conditions.
can_dev | A pointer to the CAN controller device block instance. |
mask | Specifies the status conditions to enable as interrupt source contributors. mask is a mask of logically OR'ed ALT_CAN_STATUS_t values that designate the status conditions to enable. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_int_ident_get | ( | ALT_CAN_DEV_t * | can_dev, |
uint32_t * | interrupt | ||
) |
Gets the interrupt identifier of the CAN instance.
can_dev | A pointer to the CAN controller device block instance. |
interrupt | [out] Pointer to a 32bit structure for holding the returned interrupt identifier. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_int_status_get | ( | ALT_CAN_DEV_t * | can_dev | ) |
Returns the current CAN controller status interrupt conditions.
This function returns the current value of the CAN controller interrupt status register value which reflects the current CAN controller status conditions that are not disabled (i.e. masked).
can_dev | A pointer to the CAN controller device block instance. |
ALT_E_TRUE | Status Interrupt has occurred. |
ALT_E_FALSE | Status Interrupt has not occurred. |
ALT_STATUS_CODE alt_can_bit_timing_get | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_BITTIME_t * | params | ||
) |
Gets the current configuration of the CAN bittiming.
can_dev | A pointer to the CAN controller device block instance. |
params | [out] Pointer to a ALT_CAN_BITTIME_t structure for holding the returned CAN bittiming parameters. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_bit_timing_set | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_BITTIME_t * | bittime | ||
) |
Sets the configuration of the CAN bittiming.
can_dev | A pointer to the CAN controller device block instance. |
bittime | Pointer to a ALT_CAN_BITTIME_t structure holding the desired CAN bittiming parameters. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_rate_to_bittime | ( | ALT_CAN_DEV_t * | can_dev, |
uint32_t | bitrate, | ||
ALT_CAN_BITTIME_t * | bittime | ||
) |
Returns CAN controller configurations based on speed parameter(Hz).
can_dev | A pointer to the CAN controller device instance. |
bitrate | Speed (Hz) of the can bus. |
bittime | A pointer to the structure for bittiming configurations. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_test_mode_disable | ( | ALT_CAN_DEV_t * | can_dev | ) |
Disables test mode of the CAN controller.
can_dev | A pointer to the CAN controller device block instance. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_test_mode_enable | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_TEST_TYPE_t | type | ||
) |
Enables test mode of the CAN controler and set type of it.
can_dev | A pointer to the CAN controller device block instance. |
type | The type of test mode. Valid values: ALT_CAN_TEST_SILENT, ALT_CAN_TEST_LOOP_BACK, ALT_CAN_TEST_MIXED. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_test_mode_is_enabled | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_TEST_TYPE_t * | type | ||
) |
Returns ALT_E_TRUE if the test mode of the CAN controller is enabled.
can_dev | A pointer to the CAN controller device block instance. |
type | Test mode type. |
ALT_E_TRUE | - test mode is enabled. |
ALT_E_FALSE | - test mode is not enabled |
ALT_E_ERROR | - Details about error status code |
ALT_STATUS_CODE alt_can_error_counter_get | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_ERROR_COUNTER_t * | counter | ||
) |
Returns the error counters of the CAN controller.
can_dev | A pointer to the CAN controller device block instance. |
counter | [out] Pointer to the ALT_CAN_ERROR_COUNTER_t structure for holding Transmit Error Counter, Receive Error Counter and Receive Error Passive. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_status_get | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_STATUS_t * | status | ||
) |
Gets the current status of the CAN controller.
can_dev | A pointer to the CAN controller device block instance. |
status | [out] Pointer to a ALT_CAN_STATUS_t structure for holding the returned CAN status. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_if_cmd_set | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_INTERFACE_t | if_index, | ||
uint32_t | msg_obj_num, | ||
ALT_CAN_MSG_PARAM_t * | cmd_params | ||
) |
Sets the message object parameters of the CAN controller.
can_dev | A pointer to the CAN controller device block instance. |
if_index | Interface number. Valid number 1 or 2. |
msg_obj_num | Message Number. 0x01-0x80 Valid Message Number. msg_obj_num is the Message Object in the Message RAM selected for data transfer (up to 128 MsgObj). |
cmd_params | Pointer to a ALT_CAN_MSGIF_IF1CMR_t structure for holding the command configurations. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_if_mask_set | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_INTERFACE_t | if_index, | ||
ALT_CAN_MSG_MSK_t * | mask_param | ||
) |
Sets the message object mask of the CAN controller.
can_dev | A pointer to the CAN controller device block instance. |
if_index | Interface number. Valid number 1 or 2. |
mask_param | Pointer to a ALT_CAN_MSG_MSK_t structure for holding the message object mask. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_if_mask_get | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_INTERFACE_t | if_index, | ||
ALT_CAN_MSG_MSK_t * | mask_param | ||
) |
Gets the message object mask of the CAN controller.
can_dev | A pointer to the CAN controller device block instance. |
if_index | Interface number. Valid number 1 or 2. |
mask_param | [out]Pointer to a ALT_CAN_MSG_MSK_t structure for holding the message object mask. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_if_arb_set | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_INTERFACE_t | if_index, | ||
ALT_CAN_MSG_ARB_t * | arb_param | ||
) |
Sets the message object arbitration of the CAN controller.
can_dev | A pointer to the CAN controller device block instance. |
if_index | Interface number. Valid number 1 or 2. |
arb_param | Pointer to a ALT_CAN_MSG_ARB_t structure for holding the message object mask. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_if_arb_get | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_INTERFACE_t | if_index, | ||
ALT_CAN_MSG_ARB_t * | arb_param | ||
) |
Gets the message object arbitration of the CAN controller.
can_dev | A pointer to the CAN controller device block instance. |
if_index | Interface number. Valid number 1 or 2. |
arb_param | [out]Pointer to a ALT_CAN_MSG_ARB_t structure for holding the message object mask. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_if_msg_ctrl_set | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_INTERFACE_t | if_index, | ||
ALT_CAN_MSG_IFMCTR_t * | ctrl | ||
) |
Sets the message object control of the CAN controller.
can_dev | A pointer to the CAN controller device block instance. |
if_index | Interface number. Valid number 1 or 2. |
ctrl | Pointer to a ALT_CAN_MSGIF_IF1MCTR_t structure holding the desired CAN message parameters. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_if_msg_ctrl_get | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_INTERFACE_t | if_index, | ||
ALT_CAN_MSG_IFMCTR_t * | ctrl | ||
) |
Gets the message object control of the CAN controller.
can_dev | A pointer to the CAN controller device block instance. |
if_index | Interface number. Valid number 1 or 2. |
ctrl | [out] Pointer to a ALT_CAN_MSGIF_IF1MCTR_t structure holding the desired CAN message parameters. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_if_data_set | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_INTERFACE_t | if_index, | ||
uint32_t | dataA, | ||
uint32_t | dataB | ||
) |
Sets 8 data bytes on the CAN controller.
can_dev | A pointer to the CAN controller device block instance. |
if_index | Interface number. Valid number 1 or 2. |
dataA | Value for holding 1 - 4 bytes of CAN data. |
dataB | Value for holding 5 - 8 bytes of CAN data. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_if_data_get | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_INTERFACE_t | if_index, | ||
uint32_t * | dataA, | ||
uint32_t * | dataB | ||
) |
Gets 8 data bytes from the CAN controller.
can_dev | A pointer to the CAN controller device block instance. |
if_index | Interface number. Valid number 1 or 2. |
dataA | [out] Pointer to integer value for holding 1 - 4 bytes of CAN data. |
dataB | [out] Pointer to integer value for holding 5 - 8 bytes of CAN data. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_mailbox_reset | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_INTERFACE_t | if_index, | ||
uint32_t | msg_obj_num | ||
) |
Resets specified mailbox.
can_dev | A pointer to the CAN controller device block instance. |
if_index | Interface number. Valid number 1 or 2. |
msg_obj_num | Message Number. Valid values from 1 to ALT_CAN_MAILBOXES_COUNT |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_message_is_busy | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_INTERFACE_t | if_index | ||
) |
Returns ALT_E_TRUE if specified message in specified interface is busy.
can_dev | A pointer to the CAN controller device block instance. |
if_index | Interface number. Valid number 1 or 2. |
ALT_E_TRUE | - Message object is writing. |
ALT_E_FALSE | - Message object is free. |
ALT_E_ERROR | - Details about error status code |
ALT_STATUS_CODE alt_can_message_put | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_INTERFACE_t | if_index, | ||
uint32_t | msg_obj_num, | ||
ALT_CAN_MSG_PARAM_t * | cmd_params | ||
) |
Puts Message Object to mailbox from interface registers.
can_dev | A pointer to the CAN controller device block instance. |
if_index | Interface number. Valid number 1 or 2. |
msg_obj_num | Message Number. Valid values from 1 to ALT_CAN_MAILBOXES_COUNT |
cmd_params | Pointer to a ALT_CAN_MSGIF_IF1CMR_t structure for holding the command configurations. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_message_get | ( | ALT_CAN_DEV_t * | can_dev, |
ALT_CAN_INTERFACE_t | if_index, | ||
uint32_t | msg_obj_num, | ||
ALT_CAN_MSG_PARAM_t * | cmd_params | ||
) |
Gets Message Object from mailbox to interface registers.
can_dev | A pointer to the CAN controller device block instance. |
if_index | Interface number. Valid number 1 or 2. |
msg_obj_num | Message Number. Valid values from 1 to ALT_CAN_MAILBOXES_COUNT |
cmd_params | Pointer to a ALT_CAN_MSGIF_IF1CMR_t structure for holding the command configurations. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_mailbox_init | ( | ALT_CAN_DEV_t * | can_dev, |
uint32_t | msg_obj_num, | ||
uint32_t | id, | ||
uint32_t | id_mask, | ||
ALT_CAN_TMOD_t | transfer_mode, | ||
ALT_CAN_FIFO_MODE_t | fifo_mode | ||
) |
Initializes mailbox for transfer with specified parameters.
can_dev | A pointer to the CAN controller device block instance. |
msg_obj_num | Message Number. Valid values from 1 to ALT_CAN_MAILBOXES_COUNT |
id | Identifier Mask for message identifier. ID28 - ID0 29-bit Identifier (Extended Frame). ID28 - ID18 11-bit Identifier (Standard Frame). |
id_mask | Identifier Mask for filtering. ID28 - ID0 29-bit Identifier (Extended Frame). ID28 - ID18 11-bit Identifier (Standard Frame). |
transfer_mode | One transfer mode type of enumerate ALT_CAN_TMOD_t. |
fifo_mode | one type of enumerate ALT_CAN_FIFO_MODE_t. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_mailbox_uninit | ( | ALT_CAN_DEV_t * | can_dev, |
uint32_t | msg_obj_num | ||
) |
Uninitializes mailbox for transfer.
can_dev | A pointer to the CAN controller device block instance. |
msg_obj_num | Message Number. Valid values from 1 to ALT_CAN_MAILBOXES_COUNT |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_mailboxes_reset | ( | ALT_CAN_DEV_t * | can_dev | ) |
Resets all mailboxes (uninitialize all mailboxes).
can_dev | A pointer to the CAN controller device block instance. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_frame_read | ( | ALT_CAN_DEV_t * | can_dev, |
uint32_t | msg_obj_num, | ||
void * | buffer, | ||
uint32_t * | frame_size | ||
) |
Reads one frame of the data.
can_dev | A pointer to the CAN controller device block instance. |
msg_obj_num | Message Number. Valid values from 1 to ALT_CAN_MAILBOXES_COUNT |
buffer | [out] Pointer to the memory for saving received data. |
frame_size | [out] Pointer to the memory for storing frame size in bytes. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_frame_write | ( | ALT_CAN_DEV_t * | can_dev, |
uint32_t | msg_obj_num, | ||
void * | buffer | ||
) |
Writes one frame of the data (size of frame = data length code).
can_dev | A pointer to the CAN controller device block instance. |
msg_obj_num | Message Number. Valid values from 1 to ALT_CAN_MAILBOXES_COUNT |
buffer | Pointer to the memory with sending data. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_data_read | ( | ALT_CAN_DEV_t * | can_dev, |
uint32_t | msg_obj_num, | ||
void * | buffer, | ||
uint32_t | size, | ||
uint32_t * | bytes_read | ||
) |
Reads array of the data.
can_dev | A pointer to the CAN controller device block instance. |
msg_obj_num | Message Number. Valid values from 1 to ALT_CAN_MAILBOXES_COUNT |
buffer | [out] Pointer to the memory for saving received data. |
size | The requested number of data bytes to read from the CAN bus. If size is zero, the function will return as soon as one frame has been received. If size is non-zero, the function will return when all the data requested has been received. |
bytes_read | [out] Pointer to the memory for storing the length of received data. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |
ALT_STATUS_CODE alt_can_data_write | ( | ALT_CAN_DEV_t * | can_dev, |
uint32_t | msg_obj_num, | ||
void * | buffer, | ||
uint32_t | size | ||
) |
Writes array of the data.
can_dev | A pointer to the CAN controller device block instance. |
msg_obj_num | Message Number. Valid values from 1 to ALT_CAN_MAILBOXES_COUNT |
buffer | [out] Pointer to the memory that stores the data to be written. |
size | The requested number of data bytes to write to CAN bus. |
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Details about error status code |