| iomodule Vitis Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Functions
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.
    2.16  ml   12/07/23 Make TimerExpired as a static variable.
    2.19  ml   04/18/25 Added support for system device-tree flow.

## Functions
XStatus | IOModuleIntrExample (XIOModule *IOModuleInstancePtr, u32 DeviceId)
| This function does a minimal test on the IO Module device and driver as a design example. More...
XStatus | IOModuleInterruptSetup (XIOModule *IOModuleInstancePtr, u32 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 (void)
| 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

  IOModuleInstancePtr | is 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

  CallBackRef | is a pointer to the callback function
  Timer | is 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,
|  | u32 | DeviceId
| ) |  |

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

Parameters

  IOModuleInstancePtr | is the reference to the IO Module instance.
  DeviceId | is 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,
|  | u32 | 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

  IOModuleInstancePtr | is a pointer to the IO Module driver Instance
  DeviceId | is 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 | ( | void |  | ) |

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

Parameters

  IOModuleInstancePtr | is 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().