intc: xintc_low_level_example.c File Reference

| intc Xilinx SDK Drivers API Documentation

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

Functions
xintc_low_level_example.c File Reference

## Overview

This file contains a design example using the low level-0 driver, interface of the Interrupt Controller driver.

This example shows the use of the Interrupt Controller both with a PowerPC and a MicroBlaze processor.

Note
  This example can also be used for Cascade mode interrupt controllers by using the interrupt IDs generated in xparameters.h. For Cascade mode, Interrupt IDs are generated in xparameters.h as shown below:

Master/Primary INTC

| |-0 Secondary INTC | |-. ______ | |-. | |-32 Last INTC | |-. | |-. ______ |______|<–31--—| |-. | |-64 | |-. | |-. |______|<–63---—| |-. | |-. |______|-95

All driver functions has to be called using BaseAddress of Primary/Master Controller only. Driver functions takes care of Slave Controllers based on Interrupt ID passed. User must not use Interrupt source/ID 31 of Primary and Secondary controllers to call driver functions.

    MODIFICATION HISTORY:

    Ver   Who  Date  Changes

    1.00c rpm  12/04/03 First release
    1.00c sv   06/29/05 Minor changes to comply to Doxygen and coding guidelines
    2.00a ktn  10/20/09 Updated to use HAL Processor APIs and _m is removed from
                  all the macro names/definitions. Minor changes done as per
                  coding guidelines.
    3.6   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
int | IntcLowLevelExample (u32 IntcBaseAddress)
| This function is an example of how to use the interrupt controller driver component (XIntc) and the hardware device. More...
void | SetupInterruptSystem ()
| This function connects the interrupt handler of the interrupt controller to the processor. More...
void | DeviceDriverHandler (void *CallbackRef)
| This function is designed to look like an interrupt handler in a device driver. More...
int | main (void)
| This is the main function for the Interrupt Controller Low Level example. More...

## Function Documentation

void DeviceDriverHandler | ( | void * | CallbackRef | ) |

This function is designed to look like an interrupt handler in a device driver.

This is typically a 2nd level handler that is called from the interrupt controller interrupt handler. This handler would typically perform device specific processing such as reading and writing the registers of the device to clear the interrupt condition and pass any data to an application using the device driver.

Parameters

  CallbackRef | is passed back to the device driver's interrupt handler by the XIntc driver. It was given to the XIntc driver in the XIntc_Connect() function call. It is typically a pointer to the device driver instance variable if using the Xilinx Level 1 device drivers. In this example, we do not care about the callback reference, so we passed it a 0 when connecting the handler to the XIntc driver and we make no use of it here.

Returns
  None.

Note
  None.

int IntcLowLevelExample | ( | u32 | IntcBaseAddress | ) |

This function is an example of how to use the interrupt controller driver component (XIntc) and the hardware device.

This function is designed to work without any hardware devices to cause interrupts. It may not return if the interrupt controller is not properly connected to the processor in either software or hardware.

This function relies on the fact that the interrupt controller hardware has come out of the reset state such that it will allow interrupts to be simulated by the software.

Parameters

  IntcBaseAddress | is Base Address of the the Interrupt Controller Device.

Returns
  XST_SUCCESS to indicate success, otherwise XST_FAILURE.

Note
  None.

References DeviceDriverHandler(), SetupInterruptSystem(), XIntc_EnableIntr, and XIntc_RegisterHandler().

Referenced by main().

int main | ( | void |  | ) |

This is the main function for the Interrupt Controller Low Level example.

Parameters

  None. |

Returns
  XST_SUCCESS to indicate success, otherwise XST_FAILURE.

Note
  None.

References IntcLowLevelExample().

void SetupInterruptSystem | ( |  | ) |

This function connects the interrupt handler of the interrupt controller to the processor.

This function is separate to allow it to be customized for each application. Each processor or RTOS may require unique processing to connect the interrupt handler.

Parameters

  None. |

Returns
  None.

Note
  None.

References XIntc_DeviceInterruptHandler().

Referenced by IntcLowLevelExample().