MODIFICATION HISTORY:
Ver Who Date Changes ----- ----- -------- ----------------------------------------------- 1.00a xd/sv 01/12/10 First release 1.01a bss 12/27/11 Added the APIs XCanPs_SetTxIntrWatermark and XCanPs_GetTxIntrWatermark.
#include "xcanps.h"
Functions | |
void | XCanPs_Reset (XCanPs *InstancePtr) |
u8 | XCanPs_GetMode (XCanPs *InstancePtr) |
void | XCanPs_EnterMode (XCanPs *InstancePtr, u8 OperationMode) |
u32 | XCanPs_GetStatus (XCanPs *InstancePtr) |
void | XCanPs_GetBusErrorCounter (XCanPs *InstancePtr, u8 *RxErrorCount, u8 *TxErrorCount) |
u32 | XCanPs_GetBusErrorStatus (XCanPs *InstancePtr) |
void | XCanPs_ClearBusErrorStatus (XCanPs *InstancePtr, u32 Mask) |
int | XCanPs_Send (XCanPs *InstancePtr, u32 *FramePtr) |
int | XCanPs_Recv (XCanPs *InstancePtr, u32 *FramePtr) |
int | XCanPs_SendHighPriority (XCanPs *InstancePtr, u32 *FramePtr) |
void | XCanPs_AcceptFilterEnable (XCanPs *InstancePtr, u32 FilterIndexes) |
void | XCanPs_AcceptFilterDisable (XCanPs *InstancePtr, u32 FilterIndexes) |
u32 | XCanPs_AcceptFilterGetEnabled (XCanPs *InstancePtr) |
int | XCanPs_AcceptFilterSet (XCanPs *InstancePtr, u32 FilterIndex, u32 MaskValue, u32 IdValue) |
void | XCanPs_AcceptFilterGet (XCanPs *InstancePtr, u32 FilterIndex, u32 *MaskValue, u32 *IdValue) |
int | XCanPs_SetBaudRatePrescaler (XCanPs *InstancePtr, u8 Prescaler) |
u8 | XCanPs_GetBaudRatePrescaler (XCanPs *InstancePtr) |
int | XCanPs_SetBitTiming (XCanPs *InstancePtr, u8 SyncJumpWidth, u8 TimeSegment2, u8 TimeSegment1) |
void | XCanPs_GetBitTiming (XCanPs *InstancePtr, u8 *SyncJumpWidth, u8 *TimeSegment2, u8 *TimeSegment1) |
int | XCanPs_SetRxIntrWatermark (XCanPs *InstancePtr, u8 Threshold) |
u8 | XCanPs_GetRxIntrWatermark (XCanPs *InstancePtr) |
int | XCanPs_SetTxIntrWatermark (XCanPs *InstancePtr, u8 Threshold) |
u8 | XCanPs_GetTxIntrWatermark (XCanPs *InstancePtr) |
|
This routine disables individual acceptance filters. Up to 4 filters could be disabled. If all acceptance filters are disabled then all the 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 XCANPS_IDR_* defined in xcanps_hw.h to interpret the values. Read the xcanps.h file and device specification for details.
|
|
This function returns enabled acceptance filters. Use XCANPS_AFR_UAF*_MASK defined in xcanps_hw.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 XCANPS_IDR_* defined in xcanps_hw.h to create the values to set the filter. Read the xcanps.h file 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 XCANPS_ESR_* constants defined in xcanps_hw.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 modified.
|
|
This function allows the CAN device to enter one of the following operation modes:
Read the xcanps.h file and device specification for detailed description of each operation mode.
|
|
This routine gets Baud Rate Prescaler value. The system clock for the CAN controller is divided by (Prescaler + 1) to generate the quantum clock needed for sampling and synchronization. Read the device specification for details.
|
|
This routine gets Bit time. Time segment 1, Time segment 2 and Synchronization Jump Width values are read in this function. According to device specification, the actual value of each of these fields is one more than the value read. Read the device specification for details.
|
|
This function reads Receive and Transmit error counters.
|
|
This function reads Error Status value from Error Status Register (ESR). Use the XCANPS_ESR_* constants defined in xcanps_hw.h to interpret the returned value.
|
|
This routine returns the current operation mode of the CAN device.
|
|
This routine gets the Rx Full threshold from the Watermark Interrupt Register.
|
|
This function returns Status value from Status Register (SR). Use the XCANPS_SR_* constants defined in xcanps_hw.h to interpret the returned value.
|
|
This routine gets the Tx Empty threshold from Watermark Interrupt Register.
|
|
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. If the TX FIFO is not full then the given frame is written into the the TX FIFO otherwise, it returns an 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 sets Baud Rate Prescaler value. The system clock for the CAN controller is divided by (Prescaler + 1) to generate the quantum clock needed for sampling and synchronization. Read the device specification for details. Baud Rate Prescaler can be set only if the CAN device is in Configuration Mode. Call XCanPs_EnterMode() to enter Configuration Mode before using this function.
|
|
This routine sets Bit time. Time segment 1, Time segment 2 and Synchronization Jump Width are set in this function. Device specification requires the values passed into this function be one less than the actual values of these fields. Read the device specification for details. Bit time can be set only if the CAN device is in Configuration Mode. Call XCanPs_EnterMode() to enter Configuration Mode before using this function.
|
|
This routine sets the Rx Full threshold in the Watermark Interrupt Register.
|
|
This routine sets the Tx Empty Threshold in the Watermark Interrupt Register.
|