MODIFICATION HISTORY:
Ver Who Date Changes ----- ---- -------- ------------------------------------------------------- 1.00a xd 04/12/05 First release 1.10a mta 05/13/07 Updated to new coding style 2.00a ktn 10/22/09 Updated to use the HAL APIs/macros. The macros have been renamed to remove _m from the name in all the driver files.
#include "xil_types.h"
#include "xil_assert.h"
#include "xil_io.h"
#include "xenv.h"
#include "xcan.h"
#include "xparameters.h"
Functions | |
int | XCan_Initialize (XCan *InstancePtr, u16 DeviceId) |
int | XCan_VmInitialize (XCan *InstancePtr, u16 DeviceId, u32 VirtAddr) |
void | XCan_Reset (XCan *InstancePtr) |
u8 | XCan_GetMode (XCan *InstancePtr) |
void | XCan_EnterMode (XCan *InstancePtr, u8 OperationMode) |
u32 | XCan_GetStatus (XCan *InstancePtr) |
void | XCan_GetBusErrorCounter (XCan *InstancePtr, u8 *RxErrorCount, u8 *TxErrorCount) |
u32 | XCan_GetBusErrorStatus (XCan *InstancePtr) |
void | XCan_ClearBusErrorStatus (XCan *InstancePtr, u32 Mask) |
int | XCan_Send (XCan *InstancePtr, u32 *FramePtr) |
int | XCan_Recv (XCan *InstancePtr, u32 *FramePtr) |
int | XCan_SendHighPriority (XCan *InstancePtr, u32 *FramePtr) |
void | XCan_AcceptFilterEnable (XCan *InstancePtr, u32 FilterIndexes) |
void | XCan_AcceptFilterDisable (XCan *InstancePtr, u32 FilterIndexes) |
u32 | XCan_AcceptFilterGetEnabled (XCan *InstancePtr) |
int | XCan_AcceptFilterSet (XCan *InstancePtr, u32 FilterIndex, u32 MaskValue, u32 IdValue) |
void | XCan_AcceptFilterGet (XCan *InstancePtr, u32 FilterIndex, u32 *MaskValue, u32 *IdValue) |
XCan_Config * | XCan_LookupConfig (u16 DeviceId) |
XCan_Config * | XCan_GetConfig (unsigned int InstanceIndex) |
Variables | |
XCan_Config | XCan_ConfigTable [] |
|
This routine disables individual acceptance filters. Up to 4 filters could be disabled. If all acceptance filters are disabled then all received frames are stored in the RX FIFO.
|
|
This routine enables individual acceptance filters. Up to 4 filters could be enabled.
|
|
This function reads the values of the Acceptance Filter Mask and ID Register for the specified Acceptance Filter. Use XCAN_IDR_* defined in xcan_l.h to interpret the values. Read xcan.h and device specification for details.
|
|
This function returns enabled acceptance filters. Use XCAN_AFR_UAF*_MASK defined in xcan_l.h to interpret the returned value. If no acceptance filters are enabled then all received frames are stored in the RX FIFO.
|
|
This function sets values to the Acceptance Filter Mask Register (AFMR) and Acceptance Filter ID Register (AFIR) for the specified Acceptance Filter. Use XCAN_IDR_* defined in xcan_l.h to create the values to set the filter. Read xcan.h and device specification for details. This function should be called only after:
|
|
This function clears Error Status bit(s) previously set in Error Status Register (ESR). Use the XCAN_ESR_* constants defined in xcan_l.h to create the value to pass in. If a bit was cleared in Error Status Register before this function is called, it will not be touched.
|
|
This function allows the CAN device to enter one of the following operation modes:
Read xcan.h and device specification for detailed description of each operation mode.
|
|
This function reads Receive and Transmit error counters.
|
|
This function reads Error Status value from Error Status Register (ESR). Use the XCAN_ESR_* constants defined in xcan_l.h to interpret the returned value.
|
|
This function looks for the device configuration based on the device index. The table XCan_ConfigTable[] contains the configuration information for each device in the system.
|
|
This routine returns current operation mode the CAN device is in.
|
|
This function returns Status value from Status Register (SR). Use the XCAN_SR_* constants defined in xcan_l.h to interpret the returned value.
|
|
This routine initializes a specific XCan instance/driver. This function should only be used when no Virtual Memory support is needed. To use virtual memory, the caller should invoke XCan_VmInitialize(). See the description of XCan_VmInitialize() for detailed information. This initialization entails:
|
|
This function looks for the device configuration based on the unique device ID. The table XCan_ConfigTable[] contains the configuration information for each device in the system.
|
|
This function receives a CAN Frame. This function first checks if RX FIFO is empty, if not, it then reads a frame from the RX FIFO into the given buffer. This function returns error code immediately if there is no frame in the RX FIFO.
|
|
This function resets the CAN device. Calling this function resets the device immediately, and any pending transmission or reception is terminated at once. Both Object Layer and Transfer Layer are reset. This function does not reset the Physical Layer. All registers are reset to the default values, and no previous status will be restored. TX FIFO, RX FIFO and TX High Priority Buffer are also reset. When a reset is required due to an internal error, the driver notifies the upper layer software of this need through the error status code or interrupts The upper layer software is responsible for calling this Reset function and then re-configuring the device. The CAN device will be in Configuration Mode immediately after this function returns.
|
|
This function sends a CAN Frame. This function first checks if TX FIFO is full. If not, it then writes the given frame into the TX FIFO; otherwise, it returns error code immediately. This function does not wait for the given frame being sent to CAN bus.
|
|
This routine sends a CAN High Priority frame. This function first checks if TX High Priority Buffer is empty. If yes, it then writes the given frame into the Buffer. If not, This function returns immediately. This function does not wait for the given frame being sent to CAN bus.
|
|
This routine initializes of a specific XCan instance/driver. This function should only be used if Virtual Memory support is necessary. The caller is responsible for calculating the correct device base address in Virtual memory address space and passing it into this function. This initialization entails:
|
|
This table contains configuration information for each CAN device in the system. |