tmr_manager
Xilinx SDK Drivers API Documentation
xtmr_manager_intr_example.c File Reference

Overview

This file contains a design example using the TMRManager driver (XTMRManager) and hardware device using the interrupt mode.

Note

The user must provide a physical loopback such that data which is transmitted will be received.

MODIFICATION HISTORY:

Ver   Who  Date     Changes


1.0 sa 04/05/17 First release

Functions

int TMRManagerIntrExample (u16 DeviceId)
 This function does a minimal test on the TMRManager device and driver as a design example. More...
 
int SetupInterruptSystem (XTMRManager *TMRManagerPtr)
 This function setups the interrupt system such that interrupts can occur for the TMRManager device. More...
 
void SendHandler (void *CallBackRef, unsigned int EventData)
 This function is the handler which performs processing to send data to the TMRManager. More...
 
void RecvHandler (void *CallBackRef, unsigned int EventData)
 This function is the handler which performs processing to receive data from the TMRManager. More...
 
int main (void)
 Main function to call the TMRManager interrupt example. More...
 

Function Documentation

int main ( void  )

Main function to call the TMRManager interrupt example.

Parameters
None
Returns
XST_SUCCESS if successful, XST_FAILURE if unsuccessful
Note
None

References TMRManagerIntrExample().

void RecvHandler ( void *  CallBackRef,
unsigned int  EventData 
)

This function is the handler which performs processing to receive data from the TMRManager.

It is called from an interrupt context such that the amount of processing performed should be minimized. It is called data is present in the receive FIFO of the TMRManager such that the data can be retrieved from the TMRManager. The size of the data present in the FIFO is not known when this function is called.

This handler provides an example of how to handle data for the TMRManager, but is application specific.

Parameters
CallBackRefcontains a callback reference from the driver, in this case it is the instance pointer for the TMRManager driver.
EventDatacontains the number of bytes sent or received for sent and receive events.
Returns
None.
Note
None.

Referenced by TMRManagerIntrExample().

void SendHandler ( void *  CallBackRef,
unsigned int  EventData 
)

This function is the handler which performs processing to send data to the TMRManager.

It is called from an interrupt context such that the amount of processing performed should be minimized. It is called when the transmit FIFO of the TMRManager is empty and more data can be sent through the TMRManager.

This handler provides an example of how to handle data for the TMRManager, but is application specific.

Parameters
CallBackRefcontains a callback reference from the driver. In this case it is the instance pointer for the TMRManager driver.
EventDatacontains the number of bytes sent or received for sent and receive events.
Returns
None.
Note
None.

Referenced by TMRManagerIntrExample().

int SetupInterruptSystem ( XTMRManager *  TMRManagerPtr)

This function setups the interrupt system such that interrupts can occur for the TMRManager device.

This function is application specific since the actual system may or may not have an interrupt controller. The TMRManager could be directly connected to a processor without an interrupt controller. The user should modify this function to fit the application.

Parameters
TMRManagerPtrcontains a pointer to the instance of the TMRManager component which is going to be connected to the interrupt controller.
Returns
XST_SUCCESS if successful, otherwise XST_FAILURE.
Note
None.

Referenced by TMRManagerIntrExample().

int TMRManagerIntrExample ( u16  DeviceId)

This function does a minimal test on the TMRManager device and driver as a design example.

The purpose of this function is to illustrate how to use the XTMRManager component.

This function sends data and expects to receive the same data through the TMRManager. The user must provide a physical loopback such that data which is transmitted will be received.

This function uses interrupt driver mode of the TMRManager device. The calls to the TMRManager driver in the handlers should only use the non-blocking calls.

Parameters
DeviceIdis the Device ID of the TMRManager Device and is the XPAR_<tmr_manager_instance>_DEVICE_ID value from xparameters.h.
Returns
XST_SUCCESS if successful, otherwise XST_FAILURE.
Note

This function contains an infinite loop such that if interrupts are not working it may never return.

References RecvHandler(), SendHandler(), and SetupInterruptSystem().

Referenced by main().