![]() |
MAX32690 Peripheral Driver API
Peripheral Driver API for the MAX32690
|
Modules | |
| CAN_Registers | |
Data Structures | |
| struct | mxc_can_drv_version_t |
| struct | mxc_can_capabilities_t |
| struct | mxc_can_obj_capabilities_t |
| struct | mxc_can_stat_t |
| struct | mxc_can_msg_info_t |
| struct | mxc_can_req_t |
Typedefs | |
| typedef void(* | mxc_can_unit_event_cb_t) (uint32_t can_idx, uint32_t event) |
Enumerations | |
| enum | mxc_can_pwr_ctrl_t |
| enum | mxc_can_bitrate_sel_t |
| enum | mxc_can_mode_t |
| enum | mxc_can_filt_cfg_t |
| enum | mxc_can_obj_cfg_t |
| enum | mxc_can_ctrl_t |
| enum | mxc_can_unit_evt_t |
| enum | mxc_can_obj_evt_t |
Functions | |
| mxc_can_drv_version_t | MXC_CAN_GetVersion (void) |
| mxc_can_capabilities_t | MXC_CAN_GetCapabilities (void) |
| int | MXC_CAN_Init (uint32_t can_idx, mxc_can_obj_cfg_t cfg, mxc_can_unit_event_cb_t unit_cb, mxc_can_object_event_cb_t obj_cb) |
| int | MXC_CAN_UnInit (uint32_t can_idx) |
| int | MXC_CAN_PowerControl (uint32_t can_idx, mxc_can_pwr_ctrl_t pwr) |
| int | MXC_CAN_EnableInt (uint32_t can_idx, uint8_t en, uint8_t ext_en) |
| int | MXC_CAN_DisableInt (uint32_t can_idx, uint8_t dis, uint8_t ext_dis) |
| int | MXC_CAN_GetFlags (uint32_t can_idx, uint8_t *flags, uint8_t *ext_flags) |
| int | MXC_CAN_ClearFlags (uint32_t can_idx, uint8_t flags, uint8_t ext_flags) |
| int | MXC_CAN_GetClock (uint32_t can_idx) |
| int | MXC_CAN_GetBitRate (uint32_t can_idx, mxc_can_bitrate_sel_t sel) |
| int | MXC_CAN_SetBitRate (uint32_t can_idx, mxc_can_bitrate_sel_t sel, uint32_t bitrate, uint32_t bit_segments) |
| int | MXC_CAN_SetMode (uint32_t can_idx, mxc_can_mode_t mode) |
| mxc_can_obj_capabilities_t | MXC_CAN_ObjectGetCapabilities (uint32_t can_idx) |
| int | MXC_CAN_ObjectSetFilter (uint32_t can_idx, mxc_can_filt_cfg_t cfg, uint32_t id, uint32_t arg) |
| int | MXC_CAN_ObjectConfigure (uint32_t can_idx, mxc_can_obj_cfg_t cfg) |
| int | MXC_CAN_WriteTXFIFO (uint32_t can_idx, mxc_can_msg_info_t *info, const uint8_t *data, uint8_t size) |
| int | MXC_CAN_ReadRXFIFO (uint32_t can_idx, mxc_can_msg_info_t *info, uint8_t *data, uint8_t size) |
| int | MXC_CAN_MessageSend (uint32_t can_idx, mxc_can_req_t *req) |
| int | MXC_CAN_MessageSendAsync (uint32_t can_idx, mxc_can_req_t *req) |
| int | MXC_CAN_MessageSendDMA (uint32_t can_idx, mxc_can_req_t *req) |
| int | MXC_CAN_MessageRead (uint32_t can_idx, mxc_can_req_t *req) |
| int | MXC_CAN_MessageReadAsync (uint32_t can_idx, mxc_can_req_t *req) |
| int | MXC_CAN_MessageReadDMA (uint32_t can_idx, mxc_can_req_t *req, void(*dma_cb)(int, int)) |
| int | MXC_CAN_Handler (uint32_t can_idx) |
| int | MXC_CAN_Control (uint32_t can_idx, mxc_can_ctrl_t ctrl, uint32_t ctrl_arg) |
| int | MXC_CAN_SetWakeupTimer (uint32_t can_idx, uint8_t prescaler, uint16_t wup_filter_tm, uint32_t wup_expire_tm) |
| void | MXC_CAN_SignalUnitEvent (uint32_t can_idx, mxc_can_unit_evt_t event) |
| void | MXC_CAN_SignalObjectEvent (uint32_t can_idx, mxc_can_obj_evt_t event) |
| struct mxc_can_drv_version_t |
| struct mxc_can_capabilities_t |
| struct mxc_can_obj_capabilities_t |
Struct containing information about the objects associated with a particular CAN driver.
| struct mxc_can_stat_t |
| struct mxc_can_msg_info_t |
| struct mxc_can_req_t |
Struct containing information about CAN message.
Data Fields | |
| mxc_can_msg_info_t * | msg_info |
| uint8_t * | data |
| uint8_t | data_sz |
| enum mxc_can_ctrl_t |
Selects the control operation for the CAN driver to perform.
| enum mxc_can_filt_cfg_t |
Type used to select which operation to perform on message ID filter. Mask together one choice from each group to make configuration selection.
| enum mxc_can_mode_t |
Selects the CAN driver's mode of operation.
| enum mxc_can_obj_cfg_t |
Used to set the features available to a CAN object.
| enum mxc_can_obj_evt_t |
| enum mxc_can_pwr_ctrl_t |
| enum mxc_can_unit_evt_t |
State which bus has entered to trigger unit event.
| int MXC_CAN_ClearFlags | ( | uint32_t | can_idx, |
| uint8_t | flags, | ||
| uint8_t | ext_flags | ||
| ) |
Clears interrupts flags.
| can_idx | Clear interrupt flags for CAN peripheral specified by this parameter (0 - CAN0, 1 - CAN1) |
| flags | Mask of interrupt flags to clear in INTFL register |
| ext_flags | Mask of interrupt flags to clear in EINTFL register |
| int MXC_CAN_Control | ( | uint32_t | can_idx, |
| mxc_can_ctrl_t | ctrl, | ||
| uint32_t | ctrl_arg | ||
| ) |
Perform control operation on CAN peripheral(s)
| can_idx | Index of CAN peripheral to perform control function on |
| ctrl | Operation to perform on the CAN peripherals |
| ctrl_arg | Depends on ctrl. RETRANSMISSION: 1-Enable, 0-Disable; TRANSCEIVER_DELAY: number of time quanta to delay; any other value of control this parameter is ignored |
| int MXC_CAN_DisableInt | ( | uint32_t | can_idx, |
| uint8_t | dis, | ||
| uint8_t | ext_dis | ||
| ) |
Disables interrupts in the interrupt and extended interrupt enable registers.
| can_idx | Index of the CAN peripheral to disable interrupts for (0 - CAN0, 1 - CAN1) |
| dis | Mask of interrupts to disable in the interrupt enable register |
| ext_dis | Mask of interrupts to disable in the extended interrupt enable register |
| int MXC_CAN_EnableInt | ( | uint32_t | can_idx, |
| uint8_t | en, | ||
| uint8_t | ext_en | ||
| ) |
Enables interrupts in the interrupt and extended interrupt enable registetrs.
| can_idx | Index of the CAN peripheral to enable interrupts for (0 - CAN0, 1 - CAN1) |
| en | Mask of interrupts to enable in the interrupt enable register |
| ext_en | Mask of interrupts to enable in the extended interrupt enable register |
| int MXC_CAN_GetBitRate | ( | uint32_t | can_idx, |
| mxc_can_bitrate_sel_t | sel | ||
| ) |
Returns the bit rate of the CAN clock.
| can_idx | Selects CAN peripheral (0 - CAN0, 1 - CAN1) to retrieve bit rate for |
| sel | Select which bitrate to return |
| mxc_can_capabilities_t MXC_CAN_GetCapabilities | ( | void | ) |
Get information about the capabilities of the Maxim CAN SDK.
| int MXC_CAN_GetClock | ( | uint32_t | can_idx | ) |
Returns the bit rate of the CAN clock.
| can_idx | Index of CAN peripheral to get clock rate of |
| int MXC_CAN_GetFlags | ( | uint32_t | can_idx, |
| uint8_t * | flags, | ||
| uint8_t * | ext_flags | ||
| ) |
Reads interrupt status flags.
| can_idx | Retrieve interrupt flags for CAN peripheral specified by this parameter (0 - CAN0, 1 - CAN1) |
| flags | Interrupt status flags in the INTFL register |
| ext_flags | Interrupt status flags in the EINTFL register |
| mxc_can_drv_version_t MXC_CAN_GetVersion | ( | void | ) |
Get information about the version of the CMSIS API and Maxim CAN SDK.
| int MXC_CAN_Handler | ( | uint32_t | can_idx | ) |
General interrupt handler for MessageSendAsync and MessageReadAsync.
| can_idx | Index of the CAN peripheral to handle interrupts for |
| int MXC_CAN_Init | ( | uint32_t | can_idx, |
| mxc_can_obj_cfg_t | cfg, | ||
| mxc_can_unit_event_cb_t | unit_cb, | ||
| mxc_can_object_event_cb_t | obj_cb | ||
| ) |
Initializes CAN event callbacks.
| can_idx | Index of the CAN peripheral to initialize |
| cfg | Specifies how to configure CAN peripheral (see MXC_CAN_ObjectConfigure) |
| unit_cb | Pointer to unit event callback function |
| obj_cb | Pointer to object event callback function |
| int MXC_CAN_MessageRead | ( | uint32_t | can_idx, |
| mxc_can_req_t * | req | ||
| ) |
Read received message if any. (this is a blocking function)
| can_idx | Index of the CAN peripheral to read the message for |
| req | Pointer to struct that stores CAN message information |
| int MXC_CAN_MessageReadAsync | ( | uint32_t | can_idx, |
| mxc_can_req_t * | req | ||
| ) |
Set up CAN device for asynchronus data receive (non-blocking)
| can_idx | Index of the CAN peripheral to set up asynchronus reads for |
| req | Pointer to struct that stores CAN message information |
| int MXC_CAN_MessageReadDMA | ( | uint32_t | can_idx, |
| mxc_can_req_t * | req, | ||
| void(*)(int, int) | dma_cb | ||
| ) |
Set up CAN device for DMA data receive.
| can_idx | Index of the CAN peripheral to receive data |
| req | Pointer to struct that stores CAN message information, initialize "msg_info" to expected configuration of the message to be received (Needed to ensure proper DMA length is set, if these are not known use MXC_CAN_MessageReadAsync instead.) |
| dma_cb | Pointer to DMA callback function. |
| int MXC_CAN_MessageSend | ( | uint32_t | can_idx, |
| mxc_can_req_t * | req | ||
| ) |
Send message (this is a blocking function).
| can_idx | Index of the CAN peripheral to send the message from |
| req | Contains information about the format and data of message to send |
| int MXC_CAN_MessageSendAsync | ( | uint32_t | can_idx, |
| mxc_can_req_t * | req | ||
| ) |
Send message (non-blocking).
| can_idx | Index of the CAN peripheral to send the message from |
| req | Contains information about the format and data of message to send |
| int MXC_CAN_MessageSendDMA | ( | uint32_t | can_idx, |
| mxc_can_req_t * | req | ||
| ) |
Send message (non-blocking DMA).
| can_idx | Index of the CAN peripheral to send the message from |
| req | Contains information about the format and data of message to send |
| int MXC_CAN_ObjectConfigure | ( | uint32_t | can_idx, |
| mxc_can_obj_cfg_t | cfg | ||
| ) |
Configure CAN object.
| can_idx | Pointer to CAN instance |
| cfg | Specifies how the filter should be configured |
| mxc_can_obj_capabilities_t MXC_CAN_ObjectGetCapabilities | ( | uint32_t | can_idx | ) |
Get the capabilities of the CAN object specified by can_idx.
| can_idx | Index of the CAN peripheral to get capabilities of |
| int MXC_CAN_ObjectSetFilter | ( | uint32_t | can_idx, |
| mxc_can_filt_cfg_t | cfg, | ||
| uint32_t | id, | ||
| uint32_t | arg | ||
| ) |
Setup message ID filter on CAN peripheral.
| can_idx | Pointer to CAN instance |
| cfg | Specifies how the filter should be configured |
| id | Exact ID for exact filter type. Base ID for maskable filter type. |
| arg | Mask for maskable filter type. Bits set to 0 are "don't care" bits and will always be accepted regardless of value, 1's are compared with ID. (Inverse of AMR register function.) |
| int MXC_CAN_PowerControl | ( | uint32_t | can_idx, |
| mxc_can_pwr_ctrl_t | pwr | ||
| ) |
Change Power state of the CAN peripherals.
| can_idx | Index of CAN peripheral to alter power settings for |
| pwr | Desired power state of the CAN peripherals |
| int MXC_CAN_ReadRXFIFO | ( | uint32_t | can_idx, |
| mxc_can_msg_info_t * | info, | ||
| uint8_t * | data, | ||
| uint8_t | size | ||
| ) |
Reads data from RX FIFO if data available.
| can_idx | Index of CAN peripheral to read RX data for |
| info | Pointer to struct to store message information in |
| data | Buffer to store received data bytes |
| size | Maximum number of data bytes that can be stored in "data" |
| int MXC_CAN_SetBitRate | ( | uint32_t | can_idx, |
| mxc_can_bitrate_sel_t | sel, | ||
| uint32_t | bitrate, | ||
| uint32_t | bit_segments | ||
| ) |
Sets CAN clock frequency and sets time quanta values.
| can_idx | Index of CAN peripheral to set bitrate for |
| sel | Selects which bitrate to set (nominal/FD arbitration phase or FD data phase) |
| bitrate | Desired bitrate |
| bit_segments | Mask of number of time quanta in each bit segment see MXC_CAN_BIT_SEGMENTS(seg1_tq, seg2_tq, sjw_tq) defined above |
| int MXC_CAN_SetMode | ( | uint32_t | can_idx, |
| mxc_can_mode_t | mode | ||
| ) |
Sets the operating mode of the CAN peripherals.
| can_idx | Index of CAN peripheral |
| mode | Selects the mode of the CAN peripherals |
| int MXC_CAN_SetWakeupTimer | ( | uint32_t | can_idx, |
| uint8_t | prescaler, | ||
| uint16_t | wup_filter_tm, | ||
| uint32_t | wup_expire_tm | ||
| ) |
Configure wakeup timer settings (must be called before entering sleep mode)
| can_idx | Index of CAN peripheral to configure wakeup timer for |
| prescaler | Value to scale the CAN clock by to generate the wakup clock signal |
| wup_filter_tm | Value to set Wake-up filter time register to |
| wup_expire_tm | Value to set wake-up expire time register to |
| void MXC_CAN_SignalObjectEvent | ( | uint32_t | can_idx, |
| mxc_can_obj_evt_t | event | ||
| ) |
Notify object event handler of event that transpired.
| can_idx | Index of the CAN peripheral which had the event |
| event | Event that occured |
| void MXC_CAN_SignalUnitEvent | ( | uint32_t | can_idx, |
| mxc_can_unit_evt_t | event | ||
| ) |
Notify unit event handler of event that transpired.
| can_idx | Index of CAN peripheral which the event transpired on |
| event | Event that occured |
| int MXC_CAN_UnInit | ( | uint32_t | can_idx | ) |
Free CAN resources (does not reset or disable CAN peripherals)
| can_idx | Index of CAN peripheral to un-initialize (shutdown) |
| int MXC_CAN_WriteTXFIFO | ( | uint32_t | can_idx, |
| mxc_can_msg_info_t * | info, | ||
| const uint8_t * | data, | ||
| uint8_t | size | ||
| ) |
Write data to be transmitted to TX FIFO (does not need to be called before message send)
| can_idx | Index of CAN peripheral to read RX data for |
| info | Pointer to struct containing information about the type of CAN message to send |
| data | Buffer of data bytes to be transmitted |
| size | Number of data bytes in "data" |