iomodule
Vitis Drivers API Documentation
xiomodule_intr_example.c File Reference

Overview

This file contains a design example using the IO Module driver (XIOModule) and hardware device using interrupt mode.This example tests the internal interrupts in the IO Module.

This file can be used as a standalone example or by the TestAppGen utility to include a test of IOModule interrupts.

Note

None

MODIFICATION HISTORY:
Ver   Who  Date     Changes


1.00a sa 07/15/11 First release 2.4 ms 01/23/17 Added xil_printf statement in main function to ensure that "Successfully ran" and "Failed" strings are available in all examples. This is a fix for CR-965028.

Functions

XStatus IOModuleIntrExample (XIOModule *IOModuleInstancePtr, u16 DeviceId)
 This function does a minimal test on the IO Module device and driver as a design example. More...
 
XStatus IOModuleInterruptSetup (XIOModule *IOModuleInstancePtr, u16 DeviceId)
 This function is used by the TestAppGen generated application to setup the IO Module interrupts. More...
 
void IOModuleHandler (void *CallBackRef, u8 Timer)
 This function is the handler which performs processing for the IO module. More...
 
void IOModuleSetupIntrSystem (XIOModule *IOModuleInstancePtr)
 This function initializes and enables exception handling for interrupts in the processor. More...
 
void IOModuleDisableIntr (XIOModule *IOModuleInstancePtr)
 This function disables the interrupts for the IO Module. More...
 
int main (void)
 This is the main function for the IO Module example. More...
 

Function Documentation

void IOModuleDisableIntr ( XIOModule IOModuleInstancePtr)

This function disables the interrupts for the IO Module.

Parameters
IOModuleInstancePtris a reference to the IO Module driver Instance.
Returns
None.
Note
None.

References XIOModule_Disable().

Referenced by IOModuleIntrExample().

void IOModuleHandler ( void *  CallBackRef,
u8  Timer 
)

This function is the handler which performs processing for the IO module.

It is called from an interrupt context such that the amount of processing performed should be minimized. It is called when an interrupt occurs if interrupts are enabled.

This handler provides an example of how to handle Programmable Interval Timer interrupts but is application specific.

Parameters
CallBackRefis a pointer to the callback function
Timeris the number of the interrupt this handler is associated with.
Returns
None.
Note
None.

References XIOModule_IsExpired(), and XIOModule_Timer_SetOptions().

Referenced by IOModuleIntrExample().

XStatus IOModuleInterruptSetup ( XIOModule IOModuleInstancePtr,
u16  DeviceId 
)

This function is used by the TestAppGen generated application to setup the IO Module interrupts.

Parameters
IOModuleInstancePtris the reference to the IO Module instance.
DeviceIdis device ID of the IO Module Device , typically XPAR_<IOMODULE_instance>_DEVICE_ID value from xparameters.h
Returns
XST_SUCCESS to indicate success, otherwise XST_FAILURE
Note
None.

References IOModuleSetupIntrSystem(), XIOModule_Initialize(), XIOModule_SelfTest(), and XIOModule_Start().

XStatus IOModuleIntrExample ( XIOModule IOModuleInstancePtr,
u16  DeviceId 
)

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

The purpose of this function is to illustrate how to use the IO Module component. It initializes the Programmable Interval Timers and then sets it up in compare mode with auto reload such that a periodic interrupt is generated.

This function uses interrupt driven mode of the IO Module.

Parameters
IOModuleInstancePtris a pointer to the IO Module driver Instance
DeviceIdis the XPAR_<IOModule_instance>_DEVICE_ID value from xparameters.h
Returns
XST_SUCCESS if the Test is successful, otherwise XST_FAILURE
Note
This function contains an infinite loop such that if interrupts are not working it may never return.

References XIOModule::CfgPtr, IOModuleDisableIntr(), IOModuleHandler(), IOModuleSetupIntrSystem(), XIOModule_Config::PitPrescaler, XIOModule_Config::PitReadable, XIOModule_Config::PitSize, XIOModule_Config::PitUsed, XIOModule_Enable(), XIOModule_Initialize(), XIOModule_SelfTest(), XIOModule_SetHandler(), XIOModule_SetResetValue(), XIOModule_Timer_SetOptions(), XIOModule_Timer_Start(), and XIOModule_Timer_Stop().

Referenced by main().

void IOModuleSetupIntrSystem ( XIOModule IOModuleInstancePtr)

This function initializes and enables exception handling for interrupts in the processor.

Parameters
IOModuleInstancePtris the reference to the IO Module instance.
Returns
None.
Note
None.

References XIOModule_DeviceInterruptHandler().

Referenced by IOModuleInterruptSetup(), and IOModuleIntrExample().

int main ( void  )

This is the main function for the IO Module example.

This function is not included if the example is generated from the TestAppGen test tool.

Parameters
None.
Returns
XST_SUCCESS to indicate success, otherwise XST_FAILURE.
Note
None.

References IOModuleIntrExample().