#include "xstatus.h"
#include "xcan_l.h"
Classes | |
struct | XCan_Config |
struct | XCan |
Defines | |
#define | XCAN_H |
#define | XCan_IsTxDone(InstancePtr) |
#define | XCan_IsTxFifoFull(InstancePtr) |
#define | XCan_IsHighPriorityBufFull(InstancePtr) |
#define | XCan_IsRxEmpty(InstancePtr) |
#define | XCan_IsAcceptFilterBusy(InstancePtr) |
#define | XCan_CreateIdValue(StandardId, SubRemoteTransReq, IdExtension, ExtendedId, RemoteTransReq) |
#define | XCan_CreateDlcValue(DataLengCode) (((DataLengCode) << XCAN_DLCR_DLC_SHIFT) & XCAN_DLCR_DLC_MASK) |
CAN operation modes | |
#define | XCAN_MODE_CONFIG 0x00000001 |
#define | XCAN_MODE_NORMAL 0x00000002 |
#define | XCAN_MODE_LOOPBACK 0x00000004 |
#define | XCAN_MODE_SLEEP 0x00000008 |
Callback identifiers used as parameters to XCan_SetHandler() | |
#define | XCAN_HANDLER_SEND 1 |
#define | XCAN_HANDLER_RECV 2 |
#define | XCAN_HANDLER_ERROR 3 |
#define | XCAN_HANDLER_EVENT 4 |
Typedefs | |
typedef void(* | XCan_SendRecvHandler )(void *CallBackRef) |
typedef void(* | XCan_ErrorHandler )(void *CallBackRef, u32 ErrorMask) |
typedef void(* | XCan_EventHandler )(void *CallBackRef, u32 Mask) |
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) |
int | XCan_SetBaudRatePrescaler (XCan *InstancePtr, u8 Prescaler) |
u8 | XCan_GetBaudRatePrescaler (XCan *InstancePtr) |
int | XCan_SetBitTiming (XCan *InstancePtr, u8 SyncJumpWidth, u8 TimeSegment2, u8 TimeSegment1) |
void | XCan_GetBitTiming (XCan *InstancePtr, u8 *SyncJumpWidth, u8 *TimeSegment2, u8 *TimeSegment1) |
int | XCan_SelfTest (XCan *InstancePtr) |
void | XCan_InterruptEnable (XCan *InstancePtr, u32 Mask) |
void | XCan_InterruptDisable (XCan *InstancePtr, u32 Mask) |
u32 | XCan_InterruptGetEnabled (XCan *InstancePtr) |
u32 | XCan_InterruptGetStatus (XCan *InstancePtr) |
void | XCan_InterruptClear (XCan *InstancePtr, u32 Mask) |
void | XCan_IntrHandler (void *InstancePtr) |
int | XCan_SetHandler (XCan *InstancePtr, u32 HandlerType, void *CallBackFunc, void *CallBackRef) |
#define XCan_CreateDlcValue | ( | DataLengCode | ) | (((DataLengCode) << XCAN_DLCR_DLC_SHIFT) & XCAN_DLCR_DLC_MASK) |
This macro calculates value for Data Length Code register given Data Length Code value.
DataLengCode | indicates Data Length Code value. |
Read the CAN specification for meaning of Data Length Code.
#define XCan_CreateIdValue | ( | StandardId, | |||
SubRemoteTransReq, | |||||
IdExtension, | |||||
ExtendedId, | |||||
RemoteTransReq | ) |
((((StandardId) << XCAN_IDR_ID1_SHIFT) & XCAN_IDR_ID1_MASK) | \ (((SubRemoteTransReq) << XCAN_IDR_SRR_SHIFT) & XCAN_IDR_SRR_MASK) | \ (((IdExtension) << XCAN_IDR_IDE_SHIFT) & XCAN_IDR_IDE_MASK) | \ (((ExtendedId) << XCAN_IDR_ID2_SHIFT) & XCAN_IDR_ID2_MASK) | \ ((RemoteTransReq) & XCAN_IDR_RTR_MASK))
This macro calculates CAN message identifier value given identifier field values.
StandardId | contains Standard Message ID value. | |
SubRemoteTransReq | contains Substitute Remote Transmission Request value. | |
IdExtension | contains Identifier Extension value. | |
ExtendedId | contains Extended Message ID value. | |
RemoteTransReq | contains Remote Transmission Request value. |
Read the CAN specification for meaning of each parameter.
#define XCAN_H |
#define XCAN_HANDLER_ERROR 3 |
Handler type for error interrupt
#define XCAN_HANDLER_EVENT 4 |
Handler type for all other interrupts
#define XCAN_HANDLER_RECV 2 |
Handler type for frame reception interrupt
#define XCAN_HANDLER_SEND 1 |
Handler type for frame sending interrupt
#define XCan_IsAcceptFilterBusy | ( | InstancePtr | ) |
((XCan_ReadReg(((InstancePtr)->BaseAddress), XCAN_SR_OFFSET) & \ XCAN_SR_ACFBSY_MASK) ? TRUE : FALSE)
This macro checks if the CAN device is ready for the driver to change Acceptance Filter Identifier Registers (AFIR) and Acceptance Filter Mask Registers (AFMR).
AFIR and AFMR for a filter are changeable only after the filter is disabled and this routine returns FALSE.
InstancePtr | is a pointer to the XCan instance to be worked on. |
#define XCan_IsHighPriorityBufFull | ( | InstancePtr | ) |
((XCan_ReadReg(((InstancePtr)->BaseAddress), XCAN_SR_OFFSET) & \ XCAN_SR_TXBFLL_MASK) ? TRUE : FALSE)
This macro checks if the Transmission High Priority Buffer is full.
InstancePtr | is a pointer to the XCan instance to be worked on. |
#define XCan_IsRxEmpty | ( | InstancePtr | ) |
((XCan_ReadReg(((InstancePtr)->BaseAddress), XCAN_ISR_OFFSET) & \ XCAN_IXR_RXNEMP_MASK) ? FALSE : TRUE)
This macro checks if the receive FIFO is empty.
InstancePtr | is a pointer to the XCan instance to be worked on. |
#define XCan_IsTxDone | ( | InstancePtr | ) |
((XCan_ReadReg(((InstancePtr)->BaseAddress), XCAN_ISR_OFFSET) & \ XCAN_IXR_TXOK_MASK) ? TRUE : FALSE)
This macro checks if the transmission is complete.
InstancePtr | is a pointer to the XCan instance to be worked on. |
#define XCan_IsTxFifoFull | ( | InstancePtr | ) |
((XCan_ReadReg(((InstancePtr)->BaseAddress), XCAN_SR_OFFSET) & \ XCAN_SR_TXFLL_MASK) ? TRUE : FALSE)
This macro checks if the transmission FIFO is full.
InstancePtr | is a pointer to the XCan instance to be worked on. |
#define XCAN_MODE_CONFIG 0x00000001 |
Configuration mode
#define XCAN_MODE_LOOPBACK 0x00000004 |
Loop Back mode
#define XCAN_MODE_NORMAL 0x00000002 |
Normal mode
#define XCAN_MODE_SLEEP 0x00000008 |
Sleep mode
typedef void(* XCan_ErrorHandler)(void *CallBackRef, u32 ErrorMask) |
Callback type for error interrupt.
CallBackRef | is a callback reference passed in by the upper layer when setting the callback functions, and passed back to the upper layer when the callback is invoked. | |
ErrorMask | is a bit mask indicating the cause of the error. Its value equals 'OR'ing one or more XCAN_ESR_* values defined in xcan_l.h |
typedef void(* XCan_EventHandler)(void *CallBackRef, u32 Mask) |
Callback type for all kinds of interrupts except sending frame interrupt, receiving frame interrupt, and error interrupt.
CallBackRef | is a callback reference passed in by the upper layer when setting the callback functions, and passed back to the upper layer when the callback is invoked. | |
Mask | is a bit mask indicating the pending interrupts. Its value equals 'OR'ing one or more XCAN_IXR_* defined in xcan_l.h |
typedef void(* XCan_SendRecvHandler)(void *CallBackRef) |
Callback type for frame sending and reception interrupts.
CallBackRef | is a callback reference passed in by the upper layer when setting the callback functions, and passed back to the upper layer when the callback is invoked. |
void XCan_AcceptFilterDisable | ( | XCan * | InstancePtr, | |
u32 | FilterIndexes | |||
) |
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.
InstancePtr | is a pointer to the XCan instance to be worked on. | |
FilterIndexes | specifies which filter(s) to disable. Use any XCAN_AFR_UAF*_MASK to disable one filter, and "Or" multiple XCAN_AFR_UAF*_MASK values if multiple filters need to be disabled. Any filter not specified in this parameter will keep its previous enable/disable setting. If all acceptance filters are disabled then all received frames are stored in the RX FIFO. |
Acceptance Filter Register is an optional register in Xilinx CAN device. If it is NOT existing in the device, this function should NOT be used. Calling this function in this case will cause an assertion failure.
void XCan_AcceptFilterEnable | ( | XCan * | InstancePtr, | |
u32 | FilterIndexes | |||
) |
This routine enables individual acceptance filters. Up to 4 filters could be enabled.
InstancePtr | is a pointer to the XCan instance to be worked on. | |
FilterIndexes | specifies which filter(s) to enable. Use any XCAN_AFR_UAF*_MASK to enable one filter, and "Or" multiple XCAN_AFR_UAF*_MASK values if multiple filters need to be enabled. Any filter not specified in this parameter will keep its previous enable/disable setting. |
Acceptance Filter Register is an optional register in Xilinx CAN device. If it is NOT existing in the device, this function should NOT be used. Calling this function in this case will cause an assertion failure.
void XCan_AcceptFilterGet | ( | XCan * | InstancePtr, | |
u32 | FilterIndex, | |||
u32 * | MaskValue, | |||
u32 * | IdValue | |||
) |
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.
InstancePtr | is a pointer to the XCan instance to be worked on. | |
FilterIndex | defines which Acceptance Filter Mask Register to get Mask and ID from. Use any single XCAN_FILTER_* value. | |
MaskValue | will store the Mask value read from the chosen Acceptance Filter Mask Register after this function returns. | |
IdValue | will store the ID value read from the chosen Acceptance Filter ID Register after this function returns. |
Acceptance Filter Mask and ID Registers are optional registers in Xilinx CAN device. If they are NOT existing in the device, this function should NOT be used. Calling this function in this case will cause an assertion failure.
u32 XCan_AcceptFilterGetEnabled | ( | XCan * | InstancePtr | ) |
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.
InstancePtr | is a pointer to the XCan instance to be worked on. |
Acceptance Filter Register is an optional register in Xilinx CAN device. If it is NOT existing in the device, this function should NOT be used. Calling this function in this case will cause an assertion failure.
int XCan_AcceptFilterSet | ( | XCan * | InstancePtr, | |
u32 | FilterIndex, | |||
u32 | MaskValue, | |||
u32 | IdValue | |||
) |
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:
InstancePtr | is a pointer to the XCan instance to be worked on. | |
FilterIndex | defines which Acceptance Filter Mask and ID Register to set. Use any single XCAN_AFR_UAF*_MASK value. | |
MaskValue | is the value to write to the chosen Acceptance Filter Mask Register. | |
IdValue | is the value to write to the chosen Acceptance Filter ID Register. |
Acceptance Filter Mask and ID Registers are optional registers in Xilinx CAN device. If they are NOT existing in the device, this function should NOT be used. Calling this function in this case will cause an assertion failure.
void XCan_ClearBusErrorStatus | ( | XCan * | InstancePtr, | |
u32 | Mask | |||
) |
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.
InstancePtr | is a pointer to the XCan instance to be worked on. | |
Mask | is he 32-bit mask used to clear bits in Error Status Register. Multiple XCAN_ESR_* values could be 'OR'ed to clear multiple bits |
void XCan_EnterMode | ( | XCan * | InstancePtr, | |
u8 | OperationMode | |||
) |
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.
InstancePtr | is a pointer to the XCan instance to be worked on. | |
OperationMode | specify which operation mode to enter. Valid value is any of XCAN_MODE_* defined in xcan.h. Please note no multiple modes could be entered at the same time. |
This function does NOT ensure CAN device enters the specified operation mode before returns the control to the caller. The caller is responsible for checking current operation mode using XCan_GetMode().
u8 XCan_GetBaudRatePrescaler | ( | XCan * | InstancePtr | ) |
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.
InstancePtr | is a pointer to the XCan instance to be worked on. |
void XCan_GetBitTiming | ( | XCan * | InstancePtr, | |
u8 * | SyncJumpWidth, | |||
u8 * | TimeSegment2, | |||
u8 * | TimeSegment1 | |||
) |
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.
InstancePtr | is a pointer to the XCan instance to be worked on. | |
SyncJumpWidth | will store the Synchronization Jump Width value after this function returns. Its value ranges from 0 to 3. | |
TimeSegment2 | will store the Time Segment 2 value after this function returns. Its value ranges from 0 to 7. | |
TimeSegment1 | will store the Time Segment 1 value after this function returns. Its value ranges from 0 to 15. |
void XCan_GetBusErrorCounter | ( | XCan * | InstancePtr, | |
u8 * | RxErrorCount, | |||
u8 * | TxErrorCount | |||
) |
This function reads Receive and Transmit error counters.
InstancePtr | is a pointer to the XCan instance to be worked on. | |
RxErrorCount | will contain Receive Error Counter value after this function returns. | |
TxErrorCount | will contain Transmit Error Counter value after this function returns. |
u32 XCan_GetBusErrorStatus | ( | XCan * | InstancePtr | ) |
XCan_Config* XCan_GetConfig | ( | unsigned int | InstanceIndex | ) |
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.
InstanceIndex | is a 0-based integer indexing all CAN devices in the system. |
u8 XCan_GetMode | ( | XCan * | InstancePtr | ) |
This routine returns current operation mode the CAN device is in.
InstancePtr | is a pointer to the XCan instance to be worked on. |
u32 XCan_GetStatus | ( | XCan * | InstancePtr | ) |
int XCan_Initialize | ( | XCan * | InstancePtr, | |
u16 | DeviceId | |||
) |
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:
InstancePtr | is a pointer to the XCan instance to be worked on. | |
DeviceId | is the unique ID of the device controlled by this XCan instance. Passing in a device ID associates the generic XCan instance to a specific device, as chosen by the caller or application developer. |
void XCan_InterruptClear | ( | XCan * | InstancePtr, | |
u32 | Mask | |||
) |
This function clears interrupt(s). Every bit set in Interrupt Status Register indicates that a specific type of interrupt is occurring, and this function clears one or more interrupts by writing a bit mask to Interrupt Clear Register.
InstancePtr | is a pointer to the XCan instance to be worked on. | |
Mask | is the mask to clear. Bit positions of 1 will be cleared. Bit positions of 0 will not change the previous interrupt status. This mask is formed by OR'ing XCAN_IXR_* bits defined in xcan_l.h. |
void XCan_InterruptDisable | ( | XCan * | InstancePtr, | |
u32 | Mask | |||
) |
This routine disables interrupt(s). Use the XCAN_IXR_* constants defined in xcan_l.h to create the bit-mask to disable interrupt(s).
InstancePtr | is a pointer to the XCan instance to be worked on. | |
Mask | is the mask to disable. Bit positions of 1 will be disabled. Bit positions of 0 will keep the previous setting. This mask is formed by OR'ing XCAN_IXR_* bits defined in xcan_l.h. |
void XCan_InterruptEnable | ( | XCan * | InstancePtr, | |
u32 | Mask | |||
) |
This routine enables interrupt(s). Use the XCAN_IXR_* constants defined in xcan_l.h to create the bit-mask to enable interrupts.
InstancePtr | is a pointer to the XCan instance to be worked on. | |
Mask | is the mask to enable. Bit positions of 1 will be enabled. Bit positions of 0 will keep the previous setting. This mask is formed by OR'ing XCAN_IXR_* bits defined in xcan_l.h. |
u32 XCan_InterruptGetEnabled | ( | XCan * | InstancePtr | ) |
u32 XCan_InterruptGetStatus | ( | XCan * | InstancePtr | ) |
void XCan_IntrHandler | ( | void * | InstancePtr | ) |
This routine is the interrupt handler for the CAN driver.
This handler reads the interrupt status from the ISR, determines the source of the interrupts, calls according callbacks, and finally clears the interrupts.
Application beyond this driver is responsible for providing callbacks to handle interrupts and installing the callbacks using XCan_SetHandler() during initialization phase. An example delivered with this driver demonstrates how this could be done.
InstancePtr | is a pointer to the XCan instance that just interrupted. |
XCan_Config* XCan_LookupConfig | ( | u16 | DeviceId | ) |
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.
DeviceId | is the unique device ID of the device being looked up. |
int XCan_Recv | ( | XCan * | InstancePtr, | |
u32 * | FramePtr | |||
) |
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.
InstancePtr | is a pointer to the XCan instance to be worked on. | |
FramePtr | is a pointer to a 32-bit aligned buffer where the CAN frame to be written. |
void XCan_Reset | ( | XCan * | InstancePtr | ) |
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.
InstancePtr | is a pointer to the XCan instance to be worked on. |
int XCan_SelfTest | ( | XCan * | InstancePtr | ) |
This function runs a self-test on the CAN driver/device. The test resets the device, sets up the Loop Back mode, sends a standard frame, receives the frame, verifies the contents, and resets the device again.
Note that this is a destructive test in that resets of the device are performed. Refer to the device specification for the device status after the reset operation.
InstancePtr | is a pointer to the XCan instance to be worked on. |
If the CAN device does not work properly, this function may enter an infinite loop and will never return to the caller.
If XST_FAILURE is returned, the device is not reset so that the caller could have a chance to check reason(s) causing the failure.
int XCan_Send | ( | XCan * | InstancePtr, | |
u32 * | FramePtr | |||
) |
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.
InstancePtr | is a pointer to the XCan instance to be worked on. | |
FramePtr | is a pointer to a 32-bit aligned buffer containing the CAN frame to be sent. |
int XCan_SendHighPriority | ( | XCan * | InstancePtr, | |
u32 * | FramePtr | |||
) |
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.
InstancePtr | is a pointer to the XCan instance to be worked on. | |
FramePtr | is a pointer to a 32-bit aligned buffer containing the CAN High Priority frame to be sent. |
If the frame needs to be sent immediately and not delayed by processor's interrupts handling, the caller should disable interrupt at processor level before invoking this function.
int XCan_SetBaudRatePrescaler | ( | XCan * | InstancePtr, | |
u8 | Prescaler | |||
) |
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 could be set only after CAN device entered Configuration Mode. So please call XCan_EnterMode() to enter Configuration Mode before using this function.
InstancePtr | is a pointer to the XCan instance to be worked on. | |
Prescaler | is the value to set. Valid values are from 0 to 255. |
int XCan_SetBitTiming | ( | XCan * | InstancePtr, | |
u8 | SyncJumpWidth, | |||
u8 | TimeSegment2, | |||
u8 | TimeSegment1 | |||
) |
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 could be set only after CAN device entered Configuration Mode. Please call XCan_EnterMode() to enter Configuration Mode before using this function.
InstancePtr | is a pointer to the XCan instance to be worked on. | |
SyncJumpWidth | is the Synchronization Jump Width value to set. Valid values are from 0 to 3. | |
TimeSegment2 | is the Time Segment 2 value to set. Valid values are from 0 to 7. | |
TimeSegment1 | is the Time Segment 1 value to set. Valid values are from 0 to 15. |
int XCan_SetHandler | ( | XCan * | InstancePtr, | |
u32 | HandlerType, | |||
void * | CallBackFunc, | |||
void * | CallBackRef | |||
) |
This routine installs an asynchronous callback function for the given HandlerType:
HandlerType Callback Function Type ----------------------- --------------------------- XCAN_HANDLER_SEND XCan_SendRecvHandler XCAN_HANDLER_RECV XCan_SendRecvHandler XCAN_HANDLER_ERROR XCan_ErrorHandler XCAN_HANDLER_EVENT XCan_EventHandler
HandlerType Invoked by this driver when: ----------------------- -------------------------------------------------- XCAN_HANDLER_SEND A frame transmitted by a call to XCan_Send() has been sent successfully.
XCAN_HANDLER_RECV A frame has been received and is sitting in the RX FIFO.
XCAN_HANDLER_ERROR An error interrupt is occurring.
XCAN_HANDLER_EVENT Any other kind of interrupt is occurring.
InstancePtr | is a pointer to the XCan instance to be worked on. | |
HandlerType | specifies which handler is to be attached. | |
CallBackFunc | is the address of the callback function. | |
CallBackRef | is a user data item that will be passed to the callback function when it is invoked. |
int XCan_VmInitialize | ( | XCan * | InstancePtr, | |
u16 | DeviceId, | |||
u32 | VirtAddr | |||
) |
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:
InstancePtr | is a pointer to the XCan instance to be worked on. | |
DeviceId | is the unique ID of the device controlled by this XCan instance. Passing in a device ID associates the generic XCan instance to a specific device, as chosen by the caller or application developer. | |
VirtAddr | is the device base address in the virtual memory address space. The caller is responsible for keeping the address mapping from VirtAddr to the device physical base address unchanged once this function is invoked. Unexpected errors may occur if the address mapping changes after this function is called. |
Copyright © 1995-2014 Xilinx, Inc. All rights reserved.