iomodule: Iomodule_v2_7

| iomodule Xilinx SDK Drivers API Documentation

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

Data Structures | Macros | Typedefs | Functions | Variables
Iomodule_v2_7

## Data Structures
struct | XIOModule_Config
| This typedef contains configuration information for the device. More...
struct | XIOModule_Uart_Stats
| Statistics for the UART. More...
struct | XIOModule_Buffer
| The following data type is used to manage the buffers that are handled when sending and receiving UART data in the interrupt mode. More...
struct | XIOModule_Timer_Stats
| Programmable Interval Timer statistics. More...
struct | XIOModule
| The XIOModule driver instance data. More...

## Macros
#define | XTC_DEVICE_TIMER_COUNT 4
| Defines the number of timer counters within a single hardware device. More...
#define | XTC_TIMER_COUNTER_OFFSET 16
| Each timer counter consumes 16 bytes of address space. More...
#define | XUL_RX_OFFSET 0x00000000
| Define the offsets from the base address for all the registers of the IO module, some registers may be optional in the hardware device. More...
#define | XUL_TX_OFFSET 0x00000004
| UART Transmit Register - W. More...
#define | XUL_STATUS_REG_OFFSET 0x00000008
| UART Status Register - R. More...
#define | XUL_BAUDRATE_OFFSET 0x0000004C
| UART Baud Rate Register - W. More...
#define | XIN_IMR_OFFSET 0x0000000C
| Intr Mode Register - W. More...
#define | XGO_OUT_OFFSET 0x00000010
| General Purpose Output - W. More...
#define | XGI_IN_OFFSET 0x00000020
| General Purpose Input - R. More...
#define | XIN_ISR_OFFSET 0x00000030
| Intr Status Register - R. More...
#define | XIN_IPR_OFFSET 0x00000034
| Intr Pending Register - R. More...
#define | XIN_IER_OFFSET 0x00000038
| Intr Enable Register - W. More...
#define | XIN_IAR_OFFSET 0x0000003C
| Intr Acknowledge Register - W. More...
#define | XTC_TLR_OFFSET 0x00000040
| Timer Load register - W. More...
#define | XTC_TCR_OFFSET 0x00000044
| Timer counter register - R. More...
#define | XTC_TCSR_OFFSET 0x00000048
| Timer Control register - W. More...
#define | XIN_IVAR_OFFSET 0x00000080
| Intr Vector Address Register, Interrupt 0 offset, present only for Fast Interrupt - W. More...
#define | XIN_IVEAR_OFFSET 0x00000100
| Intr Extended Vector Address Register - W. More...
#define | XUL_SR_PARITY_ERROR 0x80
| UART status register bit position masks. More...
#define | XUL_SR_INTR_ENABLED 0x10
| UART Interrupt enabled. More...
#define | XUL_SR_TX_FIFO_FULL 0x08
| UART Transmit FIFO full. More...
#define | XUL_SR_RX_FIFO_VALID_DATA 0x01
| UART Data Register valid. More...
#define | XUL_STOP_BITS 1
| UART stop bits are fixed at 1. More...
#define | XUL_PARITY_NONE 0
| UART Parity definitions. More...
#define | XIOModule_EnableIntr(BaseAddress, EnableMask) XIomodule_Out32((BaseAddress) + XIN_IER_OFFSET, (EnableMask))
| Enable specific interrupt(s) in the interrupt controller. More...
#define | XIOModule_DisableIntr(BaseAddress, DisableMask) XIomodule_Out32((BaseAddress) + XIN_IER_OFFSET, ~(DisableMask))
| Disable specific interrupt(s) in the interrupt controller. More...
#define | XIOModule_AckIntr(BaseAddress, AckMask) XIomodule_Out32((BaseAddress) + XIN_IAR_OFFSET, (AckMask))
| Acknowledge specific interrupt(s) in the interrupt controller. More...
#define | XIOModule_GetIntrStatus(BaseAddress) (XIomodule_In32((BaseAddress) + XIN_IPR_OFFSET))
| Get the interrupt status from the interrupt controller which indicates which interrupts are active and enabled. More...
#define | XIOModule_GetStatusReg(BaseAddress) XIomodule_In32((BaseAddress) + XUL_STATUS_REG_OFFSET)
| Get the contents of the UART status register. More...
#define | XIOModule_IsReceiveEmpty(BaseAddress)
| Check to see if the UART receiver has data. More...
#define | XIOModule_IsTransmitFull(BaseAddress)
| Check to see if the transmitter is full. More...
#define | XIOModule_WriteReg(BaseAddress, RegOffset, Data) XIomodule_Out32((BaseAddress) + (RegOffset), (u32)(Data))
| Write a value to a GPO register. More...
#define | XIOModule_ReadReg(BaseAddress, RegOffset) XIomodule_In32((BaseAddress) + (RegOffset))
| Read a value from a GPI register. More...

## Typedefs
typedef void(* | XIOModule_Handler )(void *CallBackRef, unsigned int ByteCount)
| Callback function. More...
typedef void(* | XIOModule_Timer_Handler )(void *CallBackRef, u8 TimerNumber)
| Signature for the timer callback function. More...

## Functions
int | XIOModule_Initialize (XIOModule *InstancePtr, u16 DeviceId)
| Initialize a specific interrupt controller instance/driver. More...
int | XIOModule_Start (XIOModule *InstancePtr)
| Starts the IO Module. More...
void | XIOModule_Stop (XIOModule *InstancePtr)
| Stops the interrupt controller by disabling the output from the controller so that no interrupts will be caused by the interrupt controller. More...
int | XIOModule_Connect (XIOModule *InstancePtr, u8 Id, XInterruptHandler Handler, void *CallBackRef)
| Makes the connection between the Id of the interrupt source and the associated handler that is to run when the interrupt is recognized. More...
void | XIOModule_Disconnect (XIOModule *InstancePtr, u8 Id)
| Updates the interrupt table with the Null Handler and NULL arguments at the location pointed at by the Id. More...
void | XIOModule_Enable (XIOModule *InstancePtr, u8 Id)
| Enables the interrupt source provided as the argument Id. More...
void | XIOModule_Disable (XIOModule *InstancePtr, u8 Id)
| Disables the interrupt source provided as the argument Id such that the interrupt controller will not cause interrupts for the specified Id. More...
void | XIOModule_Acknowledge (XIOModule *InstancePtr, u8 Id)
| Acknowledges the interrupt source provided as the argument Id. More...
XIOModule_Config * | XIOModule_LookupConfig (u16 DeviceId)
| Looks up the device configuration based on the unique device ID. More...
int | XIOModule_ConnectFastHandler (XIOModule *InstancePtr, u8 Id, XFastInterruptHandler Handler)
| Makes the connection between the Id of the interrupt source and the associated handler that is to run when the interrupt is recognized. More...
void | XIOModule_SetNormalIntrMode (XIOModule *InstancePtr, u8 Id)
| Sets the normal interrupt mode for the specified interrupt in the Interrupt Mode Register, by resetting the vector to (BaseVector & 0xFFFFFF80) | 0x10 and selecting normal mode. More...
u32 | XIOModule_DiscreteRead (XIOModule *InstancePtr, unsigned Channel)
| Read state of discretes for the specified GPI channel. More...
void | XIOModule_DiscreteWrite (XIOModule *InstancePtr, unsigned Channel, u32 Data)
| Write to discretes register for the specified GPO channel. More...
int | XIOModule_Timer_Initialize (XIOModule *InstancePtr, u16 DeviceId)
| Initializes a specific timer instance/driver. More...
void | XIOModule_Timer_Start (XIOModule *InstancePtr, u8 TimerNumber)
| Starts the specified timer counter of the device such that it starts running. More...
void | XIOModule_Timer_Stop (XIOModule *InstancePtr, u8 TimerNumber)
| Stops the timer by disabling it. More...
u32 | XIOModule_GetValue (XIOModule *InstancePtr, u8 TimerNumber)
| Get the current value of the specified timer counter. More...
void | XIOModule_SetResetValue (XIOModule *InstancePtr, u8 TimerNumber, u32 ResetValue)
| Set the reset value for the specified timer counter. More...
u32 | XIOModule_GetCaptureValue (XIOModule *InstancePtr, u8 TimerNumber)
| Returns the timer counter value that was captured the last time the external capture input was asserted. More...
void | XIOModule_Reset (XIOModule *InstancePtr, u8 TimerNumber)
| Resets the specified timer counter of the device. More...
int | XIOModule_IsExpired (XIOModule *InstancePtr, u8 TimerNumber)
| Checks if the specified timer counter of the device has expired. More...
u32 | XIOModule_IoReadWord (XIOModule *InstancePtr, u32 ByteOffset)
| Read 32-bit word from the IO Bus memory mapped IO. More...
u16 | XIOModule_IoReadHalfword (XIOModule *InstancePtr, u32 ByteOffset)
| Read 16-bit halfword from the IO Bus memory mapped IO. More...
u8 | XIOModule_IoReadByte (XIOModule *InstancePtr, u32 ByteOffset)
| Read byte from the IO Bus memory mapped IO. More...
void | XIOModule_IoWriteWord (XIOModule *InstancePtr, u32 ByteOffset, u32 Data)
| Write 32-bit word to the IO Bus memory mapped IO. More...
void | XIOModule_IoWriteHalfword (XIOModule *InstancePtr, u32 ByteOffset, u16 Data)
| Write 16-bit word to the IO Bus memory mapped IO. More...
void | XIOModule_IoWriteByte (XIOModule *InstancePtr, u32 ByteOffset, u8 Data)
| Write 8-bit word to the IO Bus memory mapped IO. More...
void | XIOModule_DiscreteSet (XIOModule *InstancePtr, unsigned Channel, u32 Mask)
| Set output discrete(s) to logic 1 for the specified GPO channel. More...
void | XIOModule_DiscreteClear (XIOModule *InstancePtr, unsigned Channel, u32 Mask)
| Set output discrete(s) to logic 0 for the specified GPO channel. More...
int | XIOModule_CfgInitialize (XIOModule *InstancePtr, XIOModule_Config *Config, u32 EffectiveAddr)
| Initialize a XIOModule instance. More...
void | XIOModule_ResetFifos (XIOModule *InstancePtr)
| This function does nothing, since the UART doesn't have any FIFOs. More...
unsigned int | XIOModule_Send (XIOModule *InstancePtr, u8 *DataBufferPtr, unsigned int NumBytes)
| This functions sends the specified buffer of data using the UART in either polled or interrupt driven modes. More...
unsigned int | XIOModule_Recv (XIOModule *InstancePtr, u8 *DataBufferPtr, unsigned int NumBytes)
| This function will attempt to receive a specified number of bytes of data from the UART and store it into the specified buffer. More...
int | XIOModule_IsSending (XIOModule *InstancePtr)
| This function determines if the specified UART is sending data. More...
void | XIOModule_GetStats (XIOModule *InstancePtr, XIOModule_Uart_Stats *StatsPtr)
| Returns a snapshot of the current statistics in the structure specified. More...
void | XIOModule_ClearStats (XIOModule *InstancePtr)
| This function zeros the statistics for the given instance. More...
void | XIOModule_InterruptHandler (XIOModule *InstancePtr)
| Interrupt handler for the driver used when there can be no argument passed to the handler. More...
void | XIOModule_Uart_EnableInterrupt (XIOModule *InstancePtr)
| This function enables the UART interrupts such that an interrupt will occur when data is received or data has been transmitted. More...
void | XIOModule_Uart_DisableInterrupt (XIOModule *InstancePtr)
| This function disables the UART interrupt. More...
void | XIOModule_SetRecvHandler (XIOModule *InstancePtr, XIOModule_Handler FuncPtr, void *CallBackRef)
| This function sets the handler that will be called when an event (interrupt) occurs in the driver for the UART. More...
void | XIOModule_SetSendHandler (XIOModule *InstancePtr, XIOModule_Handler FuncPtr, void *CallBackRef)
| This function sets the handler that will be called when an event (interrupt) occurs in the driver for the UART. More...
void | XIOModule_Uart_InterruptHandler (XIOModule *InstancePtr)
| This function is the interrupt handler for the UART. More...
int | XIOModule_SetOptions (XIOModule *InstancePtr, u32 Options)
| Set the options for the interrupt controller driver. More...
u32 | XIOModule_GetOptions (XIOModule *InstancePtr)
| Return the currently set options. More...
void | XIOModule_Timer_SetOptions (XIOModule *InstancePtr, u8 TimerNumber, u32 Options)
| Enables the specified options for the specified timer . More...
int | XIOModule_Timer_SelfTest (XIOModule *InstancePtr, u8 TimerNumber)
| Runs a self-test on the timer driver/device. More...
void | XIOModule_SetHandler (XIOModule *InstancePtr, XIOModule_Timer_Handler FuncPtr, void *CallBackRef)
| Sets the timer callback function, which the driver calls when the specified timer times out. More...
void | XIOModule_Timer_InterruptHandler (void *InstancePtr)
| Interrupt Service Routine (ISR) for the driver. More...
unsigned int | XIOModule_SendBuffer (XIOModule *InstancePtr)
| This function sends a buffer that has been previously specified by setting up the instance variables of the instance. More...
unsigned int | XIOModule_ReceiveBuffer (XIOModule *InstancePtr)
| This function receives a buffer that has been previously specified by setting up the instance variables of the instance. More...
void | XIOModule_DeviceInterruptHandler (void *DeviceId)
| This is the interrupt handler for the driver interface provided in this file when there can be no argument passed to the handler. More...
void | XIOModule_SetIntrSvcOption (UINTPTR BaseAddress, int Option)
| Set the interrupt service option, which can configure the driver so that it services only a single interrupt at a time when an interrupt occurs, or services all pending interrupts when an interrupt occurs. More...
void | XIOModule_RegisterHandler (UINTPTR BaseAddress, int InterruptId, XInterruptHandler Handler, void *CallBackRef)
| Register a handler function for a specific interrupt ID. More...
void | XIOModule_SendByte (UINTPTR BaseAddress, u8 Data)
| This functions sends a single byte using the UART. More...
u8 | XIOModule_RecvByte (UINTPTR BaseAddress)
| This functions receives a single byte using the UART. More...
u32 | XIOModel_Timer_GetOptions (XIOModule *InstancePtr, u8 TimerNumber)
| Get the options for the specified timer. More...
int | XIOModule_Intc_SelfTest (XIOModule *InstancePtr)
| Run a self-test on the interrupt controller driver/device. More...

## Variables
XIOModule_Config | XIOModule_ConfigTable [XPAR_XIOMODULE_NUM_INSTANCES]
| This table contains configuration information for each iomodule device in the system. More...
XIOModule_Config | XIOModule_ConfigTable []
| This table contains configuration information for each iomodule device in the system. More...

## Configuration options
These options are used in XIOModule_SetOptions() to configure the device.
#define | XTC_INT_MODE_OPTION 0
| Used to configure the Programmable Interval Timer. More...
#define | XTC_AUTO_RELOAD_OPTION 0x00000002UL
#define | XIN_SVC_SGL_ISR_OPTION 1UL
| Used to configure the Interrupt Controller. More...
#define | XIN_SVC_ALL_ISRS_OPTION 2UL

## Hardware configuration mnemonics
These mnemonics are used when accessing hardware configuration parameters.
#define | XTC_PRESCALER_NONE 0
| Mnemonics for the Programmable Interval Timer hardware configuration. More...
#define | XTC_PRESCALER_FIT1 1
#define | XTC_PRESCALER_FIT2 2
#define | XTC_PRESCALER_FIT3 3
#define | XTC_PRESCALER_FIT4 4
#define | XTC_PRESCALER_PIT1 5
#define | XTC_PRESCALER_PIT2 6
#define | XTC_PRESCALER_PIT3 7
#define | XTC_PRESCALER_PIT4 8
#define | XTC_PRESCALER_EXTERNAL 9
#define | XGPI_DEVICE_COUNT 4
| Defines the number of GPI and GPO within a single hardware device. More...
#define | XGPI_CHAN_OFFSET 0x00004
| The following constants describe the offset of each GPI and GPO channel's data from the base address. More...
#define | XIN_IOMODULE_GPI_4_INTERRUPT_INTR 14
| Interrupt register bit position masks. More...

## Control Status Register Bit Definitions
Control Status Register bit masks Used to configure the timer counter device.
#define | XTC_CSR_ENABLE_TMR_MASK 0x00000001
| Enables the timer. More...
#define | XTC_CSR_AUTO_RELOAD_MASK 0x00000002
| In compare mode, configures the timer reload from the Load Register. More...

## Macro Definition Documentation

#define XGI_IN_OFFSET 0x00000020

General Purpose Input - R.

#define XGO_OUT_OFFSET 0x00000010

General Purpose Output - W.

#define XGPI_CHAN_OFFSET 0x00004

The following constants describe the offset of each GPI and GPO channel's data from the base address.

Referenced by XIOModule_DiscreteRead().

#define XGPI_DEVICE_COUNT 4

Defines the number of GPI and GPO within a single hardware device.

This number is not currently parameterized in the hardware but may be in the future.

Referenced by XIOModule_DiscreteRead().

#define XIN_IAR_OFFSET 0x0000003C

Intr Acknowledge Register - W.

Referenced by XIOModule_Acknowledge(), XIOModule_Initialize(), XIOModule_Intc_SelfTest(), and XIOModule_Timer_InterruptHandler().

#define XIN_IER_OFFSET 0x00000038

Intr Enable Register - W.

Referenced by XIOModule_CfgInitialize(), XIOModule_ConnectFastHandler(), XIOModule_Disable(), XIOModule_Disconnect(), XIOModule_Enable(), XIOModule_Initialize(), XIOModule_ReceiveBuffer(), XIOModule_Recv(), XIOModule_Send(), XIOModule_SendBuffer(), XIOModule_SetNormalIntrMode(), XIOModule_Uart_DisableInterrupt(), and XIOModule_Uart_EnableInterrupt().

#define XIN_IMR_OFFSET 0x0000000C

Intr Mode Register - W.

Referenced by XIOModule_ConnectFastHandler(), XIOModule_Initialize(), and XIOModule_SetNormalIntrMode().

#define XIN_IOMODULE_GPI_4_INTERRUPT_INTR 14

Interrupt register bit position masks.

#define XIN_IPR_OFFSET 0x00000034

Intr Pending Register - R.

Referenced by XIOModule_Timer_InterruptHandler().

#define XIN_ISR_OFFSET 0x00000030

Intr Status Register - R.

Referenced by IOModuleLowLevelExample(), and XIOModule_Intc_SelfTest().

#define XIN_IVAR_OFFSET 0x00000080

Intr Vector Address Register, Interrupt 0 offset, present only for Fast Interrupt - W.

Referenced by XIOModule_ConnectFastHandler(), XIOModule_Initialize(), and XIOModule_SetNormalIntrMode().

#define XIN_IVEAR_OFFSET 0x00000100

Intr Extended Vector Address Register - W.

Referenced by XIOModule_ConnectFastHandler(), XIOModule_Initialize(), and XIOModule_SetNormalIntrMode().

#define XIN_SVC_SGL_ISR_OPTION 1UL

Used to configure the Interrupt Controller.

    XIN_SVC_SGL_ISR_OPTION  Service the highest priority pending interrupt
                            and then return.
    XIN_SVC_ALL_ISRS_OPTION Service all of the pending interrupts and then
                            return.

Referenced by XIOModule_DeviceInterruptHandler(), XIOModule_Initialize(), and XIOModule_SetOptions().

#define XIOModule_AckIntr | ( |  | BaseAddress,
|  |  | AckMask
| ) |  | XIomodule_Out32((BaseAddress) + XIN_IAR_OFFSET, (AckMask))

Acknowledge specific interrupt(s) in the interrupt controller.

Parameters

  BaseAddress | is the base address of the device
  AckMask | is the 32-bit value to write to the acknowledge register. Each bit of the mask corresponds to an interrupt input signal that is connected to the interrupt controller (INT0 = LSB). Only the bits which are set in the mask will acknowledge interrupts.

Returns
  None.

Note
  C-style signature: void XIOModule_AckIntr(UINTPTR BaseAddress, u32 AckMask);

Referenced by XIOModule_DeviceInterruptHandler().

#define XIOModule_DisableIntr | ( |  | BaseAddress,
|  |  | DisableMask
| ) |  | XIomodule_Out32((BaseAddress) + XIN_IER_OFFSET, ~(DisableMask))

Disable specific interrupt(s) in the interrupt controller.

Parameters

  BaseAddress | is the base address of the device
  DisableMask | is the 32-bit value to write to enable register. Each bit of the mask corresponds to an interrupt input signal that is connected to the interrupt controller (INT0 = LSB). Only bits which are set in the mask will disable interrupts.

Returns
  None.

Note
  C-style signature: void XIOModule_DisableIntr(UINTPTR BaseAddress, u32 DisableMask);

#define XIOModule_EnableIntr | ( |  | BaseAddress,
|  |  | EnableMask
| ) |  | XIomodule_Out32((BaseAddress) + XIN_IER_OFFSET, (EnableMask))

Enable specific interrupt(s) in the interrupt controller.

Parameters

  BaseAddress | is the base address of the device
  EnableMask | is the 32-bit value to write to the enable register. Each bit of the mask corresponds to an interrupt input signal that is connected to the interrupt controller (INT0 = LSB). Only the bits which are set in the mask will enable interrupts.

Returns
  None.

Note
  C-style signature: void XIOModule_EnableIntr(UINTPTR BaseAddress, u32 EnableMask);

Referenced by IOModuleLowLevelExample().

#define XIOModule_GetIntrStatus | ( |  | BaseAddress | ) | (XIomodule_In32((BaseAddress) + XIN_IPR_OFFSET))

Get the interrupt status from the interrupt controller which indicates which interrupts are active and enabled.

Parameters

  BaseAddress | is the base address of the device

Returns
  The 32-bit contents of the interrupt status register. Each bit corresponds to an interrupt input signal that is connected to the interrupt controller (INT0 = LSB). Bits which are set indicate an active interrupt which is also enabled.

Note
  C-style signature: u32 XIOModule_GetIntrStatus(UINTPTR BaseAddress);

Referenced by XIOModule_DeviceInterruptHandler().

#define XIOModule_GetStatusReg | ( |  | BaseAddress | ) | XIomodule_In32((BaseAddress) + XUL_STATUS_REG_OFFSET)

Get the contents of the UART status register.

Use the XUL_SR_* constants defined above to interpret the bit-mask returned.

Parameters

  BaseAddress | is the base address of the device

Returns
  A 32-bit value representing the contents of the status register.

Note
  C-style Signature: u32 XIOModule_GetStatusReg(UINTPTR BaseAddress);

Referenced by XIOModule_ReceiveBuffer(), XIOModule_SendBuffer(), and XIOModule_Uart_InterruptHandler().

#define XIOModule_IsReceiveEmpty | ( |  | BaseAddress | ) |

Value:
((XIOModule_GetStatusReg((BaseAddress)) & XUL_SR_RX_FIFO_VALID_DATA) != \
XUL_SR_RX_FIFO_VALID_DATA)
XUL_SR_RX_FIFO_VALID_DATA
#define XUL_SR_RX_FIFO_VALID_DATA
UART Data Register valid.
Definition: xiomodule_l.h:139
XIOModule_GetStatusReg
#define XIOModule_GetStatusReg(BaseAddress)
Get the contents of the UART status register.
Definition: xiomodule_l.h:333

Check to see if the UART receiver has data.

Parameters

  BaseAddress | is the base address of the device

Returns
  TRUE if the receiver is empty, FALSE if there is data present.

Note
  C-style Signature: int XIOModule_IsReceiveEmpty(UINTPTR BaseAddress);

Referenced by XIOModule_RecvByte().

#define XIOModule_IsTransmitFull | ( |  | BaseAddress | ) |

Value:
((XIOModule_GetStatusReg((BaseAddress)) & XUL_SR_TX_FIFO_FULL) == \
XUL_SR_TX_FIFO_FULL)
XUL_SR_TX_FIFO_FULL
#define XUL_SR_TX_FIFO_FULL
UART Transmit FIFO full.
Definition: xiomodule_l.h:138
XIOModule_GetStatusReg
#define XIOModule_GetStatusReg(BaseAddress)
Get the contents of the UART status register.
Definition: xiomodule_l.h:333

Check to see if the transmitter is full.

Parameters

  BaseAddress | is the base address of the device

Returns
  TRUE if the transmitter is full, FALSE otherwise.

Note
  C-style Signature: int XIOModule_IsTransmitFull(UINTPTR BaseAddress);

Referenced by XIOModule_SendByte().

#define XIOModule_ReadReg | ( |  | BaseAddress,
|  |  | RegOffset
| ) |  | XIomodule_In32((BaseAddress) + (RegOffset))

Read a value from a GPI register.

A 32 bit read is performed. If the GPI component is implemented in a smaller width, only the least significant data is read from the register. The most significant data will be read as 0.

Parameters

  BaseAddress | is the base address of the GPI device.
  RegOffset | is the register offset from the base to read from.

Returns
  Data read from the register.

Note
  C-style signature: u32 XIOModule_ReadReg(UINTPTR BaseAddress, unsigned RegOffset)

Referenced by XIOModule_DiscreteRead(), XIOModule_GetValue(), XIOModule_IsExpired(), XIOModule_IsSending(), XIOModule_ReceiveBuffer(), and XIOModule_Timer_InterruptHandler().

#define XIOModule_WriteReg | ( |  | BaseAddress,
|  |  | RegOffset,
|  |  | Data
| ) |  | XIomodule_Out32((BaseAddress) + (RegOffset), (u32)(Data))

Write a value to a GPO register.

A 32 bit write is performed. If the GPO component is implemented in a smaller width, only the least significant data is written.

Parameters

  BaseAddress | is the base address of the GPO device.
  RegOffset | is the register offset from the base to write to.
  Data | is the data written to the register.

Returns
  None.

Note
  C-style signature: void XIOModule_WriteReg(UINTPTR BaseAddress, unsigned RegOffset, u32 Data)

Referenced by XIOModule_DiscreteClear(), XIOModule_DiscreteSet(), XIOModule_DiscreteWrite(), XIOModule_Reset(), XIOModule_SendBuffer(), XIOModule_SetResetValue(), XIOModule_Timer_Initialize(), XIOModule_Timer_InterruptHandler(), XIOModule_Timer_SetOptions(), XIOModule_Timer_Start(), and XIOModule_Timer_Stop().

#define XTC_CSR_AUTO_RELOAD_MASK 0x00000002

In compare mode, configures the timer reload from the Load Register.

The default mode causes the timer counter to hold when it rolls under.

Referenced by XIOModule_IsExpired().

#define XTC_CSR_ENABLE_TMR_MASK 0x00000001

Enables the timer.

Referenced by XIOModule_Reset(), XIOModule_Timer_Initialize(), XIOModule_Timer_Start(), and XIOModule_Timer_Stop().

#define XTC_DEVICE_TIMER_COUNT 4

Defines the number of timer counters within a single hardware device.

This number is not currently parameterized in the hardware but may be in the future.

Referenced by IOModuleDisableIntr(), IOModuleIntrExample(), XIOModel_Timer_GetOptions(), XIOModule_GetCaptureValue(), XIOModule_GetValue(), XIOModule_IsExpired(), XIOModule_Reset(), XIOModule_SetResetValue(), XIOModule_Timer_Initialize(), XIOModule_Timer_InterruptHandler(), XIOModule_Timer_SelfTest(), XIOModule_Timer_SetOptions(), XIOModule_Timer_Start(), and XIOModule_Timer_Stop().

#define XTC_INT_MODE_OPTION 0

Used to configure the Programmable Interval Timer.

    XTC_INT_MODE_OPTION             Dummy compatibility option. Enable interrupt
                                 output.
    XTC_AUTO_RELOAD_OPTION  In compare mode, configures the timer to reload
                                 from the load value. The default mode causes
                                 the timer to hold after it rolls under.

Referenced by IOModuleIntrExample().

#define XTC_PRESCALER_NONE 0

Mnemonics for the Programmable Interval Timer hardware configuration.

    XTC_PRESCALER_* Define the prescaler configured in hardware.

Referenced by IOModuleIntrExample().

#define XTC_TCR_OFFSET 0x00000044

Timer counter register - R.

Referenced by XIOModule_GetValue(), and XIOModule_IsExpired().

#define XTC_TCSR_OFFSET 0x00000048

Timer Control register - W.

Referenced by XIOModule_Reset(), XIOModule_Timer_Initialize(), XIOModule_Timer_SetOptions(), XIOModule_Timer_Start(), and XIOModule_Timer_Stop().

#define XTC_TIMER_COUNTER_OFFSET 16

Each timer counter consumes 16 bytes of address space.

#define XTC_TLR_OFFSET 0x00000040

Timer Load register - W.

Referenced by XIOModule_SetResetValue(), and XIOModule_Timer_Initialize().

#define XUL_BAUDRATE_OFFSET 0x0000004C

UART Baud Rate Register - W.

#define XUL_PARITY_NONE 0

UART Parity definitions.

#define XUL_RX_OFFSET 0x00000000

Define the offsets from the base address for all the registers of the IO module, some registers may be optional in the hardware device.

UART Receive Register - R

Referenced by XIOModule_ReceiveBuffer(), and XIOModule_RecvByte().

#define XUL_SR_INTR_ENABLED 0x10

UART Interrupt enabled.

#define XUL_SR_PARITY_ERROR 0x80

UART status register bit position masks.

#define XUL_SR_RX_FIFO_VALID_DATA 0x01

UART Data Register valid.

Referenced by XIOModule_ReceiveBuffer(), and XIOModule_Uart_InterruptHandler().

#define XUL_SR_TX_FIFO_FULL 0x08

UART Transmit FIFO full.

Referenced by XIOModule_IsSending(), XIOModule_SendBuffer(), and XIOModule_Uart_InterruptHandler().

#define XUL_STATUS_REG_OFFSET 0x00000008

UART Status Register - R.

Referenced by XIOModule_IsSending().

#define XUL_STOP_BITS 1

UART stop bits are fixed at 1.

Baud, parity, and data bits are fixed on a per instance basis.

#define XUL_TX_OFFSET 0x00000004

UART Transmit Register - W.

Referenced by XIOModule_SendBuffer(), and XIOModule_SendByte().

## Typedef Documentation

typedef void(* XIOModule_Handler)(void *CallBackRef, unsigned int ByteCount)

Callback function.

The first argument 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. The second argument is the ByteCount which is the number of bytes that actually moved from/to the buffer provided in the _Send/_Receive call.

typedef void(* XIOModule_Timer_Handler)(void *CallBackRef, u8 TimerNumber)

Signature for the timer callback function.

Parameters

  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. Its type is unimportant to the driver, so it is a void pointer.
  TimerNumber | is the number of the timer within the device. The device typically contains from one to four timers. The timer number is a zero based number with a range of 0 to (XTC_DEVICE_TIMER_COUNT - 1).

## Function Documentation

u32 XIOModel_Timer_GetOptions | ( | XIOModule * | InstancePtr,
|  | u8 | TimerNumber
| ) |  |

Get the options for the specified timer.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  TimerNumber | is the timer of the device to operate on Each device may contain multiple timer. The timer number is a zero based number with a range of 0 to (XTC_DEVICE_TIMER_COUNT - 1).

Returns

The currently set options. An option which is set to a '1' is enabled and set to a '0' is disabled. The options are bit masks such that multiple options may be set or cleared. The options are described in xiomodule.h.

Note
  None.

References XIOModule::CurrentTCSR, XIOModule::IsReady, and XTC_DEVICE_TIMER_COUNT.

void XIOModule_Acknowledge | ( | XIOModule * | InstancePtr,
|  | u8 | Id
| ) |  |

Acknowledges the interrupt source provided as the argument Id.

When the interrupt is acknowledged, it causes the interrupt controller to clear its interrupt condition.

Parameters

  InstancePtr | is a pointer to the XIOModule instance to be worked on.
  Id | contains the ID of the interrupt source and should be in the range of 0 to XPAR_IOMODULE_INTC_MAX_INTR_SIZE - 1 with 0 being the highest priority interrupt.

Returns
  None.

Note
  None.

References XIOModule::BaseAddress, XIOModule::IsReady, and XIN_IAR_OFFSET.

int XIOModule_CfgInitialize | ( | XIOModule * | InstancePtr,
|  | XIOModule_Config * | Config,
|  | u32 | EffectiveAddr
| ) |  |

Initialize a XIOModule instance.

This function disables the UART interrupts. The baud rate and format of the data are fixed in the hardware at hardware build time, except if programmable baud rate is selected.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  Config | is a reference to a structure containing information about a specific IO Module device. This function initializes an InstancePtr object for a specific device specified by the contents of Config. This function can initialize multiple instance objects with the use of multiple calls giving different Config information on each call.
  EffectiveAddr | is the device register base address. Use Config->BaseAddress for this parameters, passing the physical address.

Returns
  - XST_SUCCESS if everything starts up as expected.

Note
  The Config and EffectiveAddress arguments are not used by this function, but are provided to keep the function signature consistent with other drivers.

References XIOModule::BaseAddress, XIOModule::CurrentIER, XIOModule::IsReady, XIOModule::ReceiveBuffer, XIOModule::RecvHandler, XIOModule::SendBuffer, XIOModule::SendHandler, XIN_IER_OFFSET, and XIOModule_ClearStats().

Referenced by XIOModule_Initialize().

void XIOModule_ClearStats | ( | XIOModule * | InstancePtr | ) |

This function zeros the statistics for the given instance.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.

Returns
  None.

Note
  None.

References XIOModule_Uart_Stats::CharactersReceived, XIOModule_Uart_Stats::CharactersTransmitted, XIOModule::IsReady, XIOModule_Uart_Stats::ReceiveFramingErrors, XIOModule_Uart_Stats::ReceiveInterrupts, XIOModule_Uart_Stats::ReceiveOverrunErrors, XIOModule_Uart_Stats::ReceiveParityErrors, XIOModule_Uart_Stats::TransmitInterrupts, and XIOModule::Uart_Stats.

Referenced by XIOModule_CfgInitialize().

int XIOModule_Connect | ( | XIOModule * | InstancePtr,
|  | u8 | Id,
|  | XInterruptHandler | Handler,
|  | void * | CallBackRef
| ) |  |

Makes the connection between the Id of the interrupt source and the associated handler that is to run when the interrupt is recognized.

The argument provided in this call as the Callbackref is used as the argument for the handler when it is called.

Parameters

  InstancePtr | is a pointer to the XIOModule instance to be worked on.
  Id | contains the ID of the interrupt source and should be in the range of 0 to XPAR_IOMODULE_INTC_MAX_INTR_SIZE - 1 with 0 being the highest priority interrupt.
  Handler | to the handler for that interrupt.
  CallBackRef | is the callback reference, usually the instance pointer of the connecting driver.

Returns
  - XST_SUCCESS if the handler was connected correctly.

Note
  Only used with normal interrupt mode. Does not restore normal interrupt mode.

WARNING: The handler provided as an argument will overwrite any handler that was previously connected.

References XIOModule::CfgPtr, XIOModule_Config::HandlerTable, and XIOModule::IsReady.

Referenced by SetUpInterruptSystem().

int XIOModule_ConnectFastHandler | ( | XIOModule * | InstancePtr,
|  | u8 | Id,
|  | XFastInterruptHandler | Handler
| ) |  |

Makes the connection between the Id of the interrupt source and the associated handler that is to run when the interrupt is recognized.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  Id | contains the ID of the interrupt source and should be in the range of 0 to XPAR_INTC_MAX_NUM_INTR_INPUTS - 1 with 0 being the highest priority interrupt.
  Handler | to the handler for that interrupt.

Returns
  - XST_SUCCESS if the handler was connected correctly.

Note
  Only used with fast interrupt mode.

WARNING: The handler provided as an argument will overwrite any handler that was previously connected.

References XIOModule::BaseAddress, XIOModule::CfgPtr, XIOModule::CurrentIER, XIOModule::CurrentIMR, XIOModule_Config::FastIntr, XIOModule_Config::HandlerTable, XIOModule::IsReady, XIOModule_Config::VectorAddrWidth, XIN_IER_OFFSET, XIN_IMR_OFFSET, XIN_IVAR_OFFSET, and XIN_IVEAR_OFFSET.

void XIOModule_DeviceInterruptHandler | ( | void * | DeviceId | ) |

This is the interrupt handler for the driver interface provided in this file when there can be no argument passed to the handler.

In this case, we just use the globally defined device ID for the interrupt controller. This function is provided mostly for backward compatibility. The user should use XIOModule_DeviceInterruptHandler() if possible.

This function does not support multiple interrupt controller instances to be handled.

The user must connect this function to the interrupt system such that it is called whenever the devices which are connected to it cause an interrupt.

Returns
  None.

Note

The constant XPAR_IOMODULE_SINGLE_DEVICE_ID must be defined for this handler to be included in the driver compilation.

This function is the primary interrupt handler for the driver. It must be connected to the interrupt source such that is called when an interrupt of the interrupt controller is active. It will resolve which interrupts are active and enabled and call the appropriate interrupt handler. It uses the AckBeforeService flag in the configuration data to determine when to acknowledge the interrupt. Highest priority interrupts are serviced first. The driver can be configured to service only the highest priority interrupt or all pending interrupts using the {XIOModule_SetOptions()} function or the {XIOModule_SetIntrSrvOption()} function.

This function assumes that an interrupt vector table has been previously initialized. It does not verify that entries in the table are valid before calling an interrupt handler, except skipping null handlers that indicate use of fast interrupts where the hardware directly jumps to the handler.

Parameters

  DeviceId | is the zero-based device ID defined in xparameters.h of the interrupting interrupt controller. It is used as a direct index into the configuration data, which contains the vector table for the interrupt controller. Note that even though the argument is a void pointer, the value is not a pointer but the actual device ID. The void pointer type is necessary to meet the XInterruptHandler typedef for interrupt handlers.

Returns
  None.

Note

The constant XPAR_IOMODULE_MAX_INTR_SIZE must be setup for this to compile. Interrupt IDs range from 0 - 31 and correspond to the interrupt input signals for the interrupt controller. XPAR_IOMODULE_MAX_INTR_SIZE specifies the highest numbered interrupt input signal that is used.

References XIOModule_Config::AckBeforeService, XIOModule_Config::BaseAddress, XIOModule_Config::HandlerTable, XIOModule_Config::Options, XIN_SVC_SGL_ISR_OPTION, XIOModule_AckIntr, XIOModule_ConfigTable, and XIOModule_GetIntrStatus.

Referenced by IOModuleSetupIntrSystem(), SetUpInterruptSystem(), and XIOModule_InterruptHandler().

void XIOModule_Disable | ( | XIOModule * | InstancePtr,
|  | u8 | Id
| ) |  |

Disables the interrupt source provided as the argument Id such that the interrupt controller will not cause interrupts for the specified Id.

The interrupt controller will continue to hold an interrupt condition for the Id, but will not cause an interrupt.

Parameters

  InstancePtr | is a pointer to the XIOModule instance to be worked on.
  Id | contains the ID of the interrupt source and should be in the range of 0 to XPAR_IOMODULE_INTC_MAX_INTR_SIZE - 1 with 0 being the highest priority interrupt.

Returns
  None.

Note
  None.

References XIOModule::BaseAddress, XIOModule::CurrentIER, XIOModule::IsReady, and XIN_IER_OFFSET.

Referenced by IOModuleDisableIntr().

void XIOModule_Disconnect | ( | XIOModule * | InstancePtr,
|  | u8 | Id
| ) |  |

Updates the interrupt table with the Null Handler and NULL arguments at the location pointed at by the Id.

This effectively disconnects that interrupt source from any handler. The interrupt is disabled also.

Parameters

  InstancePtr | is a pointer to the XIOModule instance to be worked on.
  Id | contains the ID of the interrupt source and should be in the range of 0 to XPAR_IOMODULE_INTC_MAX_INTR_SIZE - 1 with 0 being the highest priority interrupt.

Returns
  None.

Note
  None.

References XIOModule::BaseAddress, XIOModule::CfgPtr, XIOModule::CurrentIER, XIOModule_Config::HandlerTable, XIOModule::IsReady, and XIN_IER_OFFSET.

void XIOModule_DiscreteClear | ( | XIOModule * | InstancePtr,
|  | unsigned | Channel,
|  | u32 | Mask
| ) |  |

Set output discrete(s) to logic 0 for the specified GPO channel.

Parameters

  InstancePtr | is a pointer to an XIOModule instance to be worked on.
  Channel | contains the channel of the GPIO (1, 2, 3 or 4) to operate on.
  Mask | is the set of bits that will be set to 0 in the discrete data register. All other bits in the data register are unaffected.

Returns
  None.

References XIOModule::BaseAddress, XIOModule::GpoValue, XIOModule::IsReady, and XIOModule_WriteReg.

u32 XIOModule_DiscreteRead | ( | XIOModule * | InstancePtr,
|  | unsigned | Channel
| ) |  |

Read state of discretes for the specified GPI channel.

Parameters

  InstancePtr | is a pointer to an XIOModule instance to be worked on.
  Channel | contains the channel of the GPI (1, 2, 3 or 4) to operate on.

Returns
  Current copy of the discretes register.

References XIOModule::BaseAddress, XIOModule::IsReady, XGPI_CHAN_OFFSET, XGPI_DEVICE_COUNT, and XIOModule_ReadReg.

void XIOModule_DiscreteSet | ( | XIOModule * | InstancePtr,
|  | unsigned | Channel,
|  | u32 | Mask
| ) |  |

Set output discrete(s) to logic 1 for the specified GPO channel.

Parameters

  InstancePtr | is a pointer to an XIOModule instance to be worked on.
  Channel | contains the channel of the GPIO (1, 2, 3 or 4) to operate on.
  Mask | is the set of bits that will be set to 1 in the discrete data register. All other bits in the data register are unaffected.

Returns
  None.

References XIOModule::BaseAddress, XIOModule::GpoValue, XIOModule::IsReady, and XIOModule_WriteReg.

void XIOModule_DiscreteWrite | ( | XIOModule * | InstancePtr,
|  | unsigned | Channel,
|  | u32 | Data
| ) |  |

Write to discretes register for the specified GPO channel.

Parameters

  InstancePtr | is a pointer to an XIOModule instance to be worked on.
  Channel | contains the channel of the GPO (1, 2, 3 or 4) to operate on.
  Data | is the value to be written to the discretes register.

Returns
  None.

References XIOModule::BaseAddress, XIOModule::GpoValue, XIOModule::IsReady, and XIOModule_WriteReg.

void XIOModule_Enable | ( | XIOModule * | InstancePtr,
|  | u8 | Id
| ) |  |

Enables the interrupt source provided as the argument Id.

Any pending interrupt condition for the specified Id will occur after this function is called.

Parameters

  InstancePtr | is a pointer to the XIOModule instance to be worked on.
  Id | contains the ID of the interrupt source and should be in the range of 0 to XPAR_IOMODULE_INTC_MAX_INTR_SIZE - 1 with 0 being the highest priority interrupt.

Returns
  None.

Note
  None.

References XIOModule::BaseAddress, XIOModule::CurrentIER, XIOModule::IsReady, and XIN_IER_OFFSET.

Referenced by IOModuleIntrExample(), and SetUpInterruptSystem().

u32 XIOModule_GetCaptureValue | ( | XIOModule * | InstancePtr,
|  | u8 | TimerNumber
| ) |  |

Returns the timer counter value that was captured the last time the external capture input was asserted.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  TimerNumber | is the timer counter of the device to operate on. Each device may contain multiple timer counters. The timer number is a zero based number with a range of 0 to (XTC_DEVICE_TIMER_COUNT - 1).

Returns
  The current capture value for the indicated timer counter.

Note
  None.

References XIOModule::CurrentTLR, XIOModule::IsReady, and XTC_DEVICE_TIMER_COUNT.

u32 XIOModule_GetOptions | ( | XIOModule * | InstancePtr | ) |

Return the currently set options.

Parameters

  InstancePtr | is a pointer to the XIOModule instance to be worked on.

Returns
  The currently set options. The options are described in xiomodule.h.

Note
  None.

References XIOModule::CfgPtr, XIOModule::IsReady, and XIOModule_Config::Options.

void XIOModule_GetStats | ( | XIOModule * | InstancePtr,
|  | XIOModule_Uart_Stats * | StatsPtr
| ) |  |

Returns a snapshot of the current statistics in the structure specified.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  StatsPtr | is a pointer to a XIOModule_Uart_Stats structure to where the statistics are to be copied.

Returns
  None.

Note
  None.

References XIOModule_Uart_Stats::CharactersReceived, XIOModule_Uart_Stats::CharactersTransmitted, XIOModule::IsReady, XIOModule_Uart_Stats::ReceiveFramingErrors, XIOModule_Uart_Stats::ReceiveInterrupts, XIOModule_Uart_Stats::ReceiveOverrunErrors, XIOModule_Uart_Stats::ReceiveParityErrors, XIOModule_Uart_Stats::TransmitInterrupts, and XIOModule::Uart_Stats.

u32 XIOModule_GetValue | ( | XIOModule * | InstancePtr,
|  | u8 | TimerNumber
| ) |  |

Get the current value of the specified timer counter.

The timer counter may be either incrementing or decrementing based upon the current mode of operation.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  TimerNumber | is the timer counter of the device to operate on. Each device may contain multiple timer counters. The timer number is a zero based number with a range of 0 to (XTC_DEVICE_TIMER_COUNT - 1).

Returns
  The current value for the timer counter.

Note
  None.

References XIOModule::BaseAddress, XIOModule::IsReady, XIOModule_ReadReg, XTC_DEVICE_TIMER_COUNT, and XTC_TCR_OFFSET.

Referenced by XIOModule_Timer_SelfTest().

int XIOModule_Initialize | ( | XIOModule * | InstancePtr,
|  | u16 | DeviceId
| ) |  |

Initialize a specific interrupt controller instance/driver.

The initialization entails:

      - Initialize fields of the XIOModule structure
      - Initial vector table with stub function calls
      - All interrupt sources are disabled
      - Interrupt output is disabled
      - All timers are initialized

Parameters

  InstancePtr | is a pointer to the XIOModule instance to be worked on.
  DeviceId | is the unique id of the device controlled by this XIOModule instance. Passing in a device id associates the generic XIOModule instance to a specific device, as chosen by the caller or application developer.

Returns
  - XST_SUCCESS if initialization was successful
  - XST_DEVICE_IS_STARTED if the device has already been started
  - XST_DEVICE_NOT_FOUND if device configuration information was not found for a device with the supplied device ID.

Note
  None.

References XIOModule_Config::BaseAddress, XIOModule::BaseAddress, XIOModule_Config::BaseVector, XIOModule::CfgPtr, XIOModule::CurrentIER, XIOModule::CurrentIMR, XIOModule_Config::FastIntr, XIOModule_Config::GpoInit, XIOModule::GpoValue, XIOModule_Config::HandlerTable, XIOModule_Config::IoBaseAddress, XIOModule::IoBaseAddress, XIOModule::IsReady, XIOModule::IsStarted, XIOModule_Config::Options, XIOModule_Config::VectorAddrWidth, XIN_IAR_OFFSET, XIN_IER_OFFSET, XIN_IMR_OFFSET, XIN_IVAR_OFFSET, XIN_IVEAR_OFFSET, XIN_SVC_SGL_ISR_OPTION, XIOModule_CfgInitialize(), XIOModule_LookupConfig(), and XIOModule_Timer_Initialize().

Referenced by IOModuleExample(), IOModuleInterruptSetup(), IOModuleIntrExample(), and IOModuleSelfTestExample().

int XIOModule_Intc_SelfTest | ( | XIOModule * | InstancePtr | ) |

Run a self-test on the interrupt controller driver/device.

This is a destructive test.

This involves forcing interrupts into the controller (if possible, given the IO Module configuration) and verifying that they are recognized and can be acknowledged.

Parameters

  InstancePtr | is a pointer to the XIOModule instance to be worked on.

Returns
  - XST_SUCCESS if self-test is successful.
  - XST_INTC_FAIL_SELFTEST if the Interrupt controller fails the self-test. It will fail the self test if the device has previously been started in real mode.

Note
  None.

References XIOModule::BaseAddress, XIOModule::IsReady, XIN_IAR_OFFSET, and XIN_ISR_OFFSET.

void XIOModule_InterruptHandler | ( | XIOModule * | InstancePtr | ) |

Interrupt handler for the driver used when there can be no argument passed to the handler.

This function is provided mostly for backward compatibility. The user should use XIOModule_DeviceInterruptHandler(), defined in xiomodule_l.c, if possible.

The user must connect this function to the interrupt system such that it is called whenever the devices which are connected to it cause an interrupt.

Returns
  None.

Note

The constant XPAR_IOMODULE_SINGLE_DEVICE_ID must be defined for this handler to be included in the driver compilation.

The interrupt handler for the driver. This function is provided mostly for backward compatibility. The user should use XIOModule_DeviceInterruptHandler(), defined in xiomodule_l.c when possible and pass the device ID of the interrupt controller device as its argument.

The user must connect this function to the interrupt system such that it is called whenever the devices which are connected to it cause an interrupt.

Parameters

  InstancePtr | is a pointer to the XIOModule instance to be worked on.

Returns
  None.

Note
  None.

References XIOModule::CfgPtr, XIOModule_Config::DeviceId, and XIOModule_DeviceInterruptHandler().

u8 XIOModule_IoReadByte | ( | XIOModule * | InstancePtr,
|  | u32 | ByteOffset
| ) |  |

Read byte from the IO Bus memory mapped IO.

Parameters

  InstancePtr | is a pointer to an XIOModule instance to be worked on.
  ByteOffset | is a byte offset from the beginning of the IO Bus address area

Returns
  Value read from the IO Bus - 8-bit byte

References XIOModule::IoBaseAddress, and XIOModule::IsReady.

u16 XIOModule_IoReadHalfword | ( | XIOModule * | InstancePtr,
|  | u32 | ByteOffset
| ) |  |

Read 16-bit halfword from the IO Bus memory mapped IO.

Parameters

  InstancePtr | is a pointer to an XIOModule instance to be worked on.
  ByteOffset | is a byte offset from the beginning of the IO Bus address area

Returns
  Value read from the IO Bus - 16-bit halfword

References XIOModule::IoBaseAddress, and XIOModule::IsReady.

u32 XIOModule_IoReadWord | ( | XIOModule * | InstancePtr,
|  | u32 | ByteOffset
| ) |  |

Read 32-bit word from the IO Bus memory mapped IO.

Parameters

  InstancePtr | is a pointer to an XIOModule instance to be worked on.
  ByteOffset | is a byte offset from the beginning of the IO Bus address area

Returns
  Value read from the IO Bus - 32-bit word

References XIOModule::IoBaseAddress, and XIOModule::IsReady.

void XIOModule_IoWriteByte | ( | XIOModule * | InstancePtr,
|  | u32 | ByteOffset,
|  | u8 | Data
| ) |  |

Write 8-bit word to the IO Bus memory mapped IO.

Parameters

  InstancePtr | is a pointer to an XIOModule instance to be worked on.
  ByteOffset | is a byte offset from the beginning of the IO Bus address area
  Data | is the value to be written to the IO Bus - 8-bit

Returns
  None.

References XIOModule::IoBaseAddress, and XIOModule::IsReady.

void XIOModule_IoWriteHalfword | ( | XIOModule * | InstancePtr,
|  | u32 | ByteOffset,
|  | u16 | Data
| ) |  |

Write 16-bit word to the IO Bus memory mapped IO.

Parameters

  InstancePtr | is a pointer to an XIOModule instance to be worked on.
  ByteOffset | is a byte offset from the beginning of the IO Bus address area
  Data | is the value to be written to the IO Bus - 16-bit

Returns
  None.

References XIOModule::IoBaseAddress, and XIOModule::IsReady.

void XIOModule_IoWriteWord | ( | XIOModule * | InstancePtr,
|  | u32 | ByteOffset,
|  | u32 | Data
| ) |  |

Write 32-bit word to the IO Bus memory mapped IO.

Parameters

  InstancePtr | is a pointer to an XIOModule instance to be worked on.
  ByteOffset | is a byte offset from the beginning of the IO Bus address area
  Data | is the value to be written to the IO Bus - 32-bit

Returns
  None.

References XIOModule::IoBaseAddress, and XIOModule::IsReady.

int XIOModule_IsExpired | ( | XIOModule * | InstancePtr,
|  | u8 | TimerNumber
| ) |  |

Checks if the specified timer counter of the device has expired.

In capture mode, expired is defined as a capture occurred. In compare mode, expired is defined as the timer counter rolled over/under for up/down counting.

When interrupts are enabled, the expiration causes an interrupt. This function is typically used to poll a timer counter to determine when it has expired.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  TimerNumber | is the timer counter of the device to operate on. Each device may contain multiple timer counters. The timer number is a zero based number with a range of 0 to (XTC_DEVICE_TIMER_COUNT - 1).

Returns
  TRUE if the timer has expired, and FALSE otherwise.

Note
  None.

References XIOModule::BaseAddress, XIOModule::CfgPtr, XIOModule::CurrentTCSR, XIOModule::IsReady, XIOModule_Config::PitMask, XIOModule_Config::PitReadable, XIOModule_ReadReg, XTC_CSR_AUTO_RELOAD_MASK, XTC_DEVICE_TIMER_COUNT, and XTC_TCR_OFFSET.

Referenced by IOModuleHandler().

int XIOModule_IsSending | ( | XIOModule * | InstancePtr | ) |

This function determines if the specified UART is sending data.

If the transmitter register is not empty, it is sending data.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.

Returns
  A value of TRUE if the UART is sending data, otherwise FALSE.

Note
  None.

References XIOModule::BaseAddress, XIOModule_ReadReg, XUL_SR_TX_FIFO_FULL, and XUL_STATUS_REG_OFFSET.

XIOModule_Config * XIOModule_LookupConfig | ( | u16 | DeviceId | ) |

Looks up the device configuration based on the unique device ID.

A table contains the configuration info for each device in the system.

Parameters

  DeviceId | is the unique identifier for a device.

Returns
  A pointer to the XIOModule configuration structure for the specified device, or NULL if the device was not found.

Note
  None.

References XIOModule_ConfigTable.

Referenced by XIOModule_Initialize(), and XIOModule_Timer_Initialize().

unsigned int XIOModule_ReceiveBuffer | ( | XIOModule * | InstancePtr | ) |

This function receives a buffer that has been previously specified by setting up the instance variables of the instance.

This function is designed to be an internal function for the XIOModule component such that it may be called from a shell function that sets up the buffer or from an interrupt handler.

This function will attempt to receive a specified number of bytes of data from the UART and store it into the specified buffer. This function is designed for either polled or interrupt driven modes. It is non-blocking such that it will return if there is no data has already received by the UART.

In a polled mode, this function will only receive as much data as the UART can buffer, either in the receiver or in the FIFO if present and enabled. The application may need to call it repeatedly to receive a buffer. Polled mode is the default mode of operation for the driver.

In interrupt mode, this function will start receiving and then the interrupt handler of the driver will continue until the buffer has been received. A callback function, as specified by the application, will be called to indicate the completion of receiving the buffer or when any receive errors or timeouts occur.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.

Returns
  The number of bytes received.

Note
  None.

References XIOModule::BaseAddress, XIOModule_Uart_Stats::CharactersReceived, XIOModule::CurrentIER, XIOModule::ReceiveBuffer, XIOModule::Uart_Stats, XIN_IER_OFFSET, XIOModule_GetStatusReg, XIOModule_ReadReg, XUL_RX_OFFSET, and XUL_SR_RX_FIFO_VALID_DATA.

Referenced by XIOModule_Recv().

unsigned int XIOModule_Recv | ( | XIOModule * | InstancePtr,
|  | u8 * | DataBufferPtr,
|  | unsigned int | NumBytes
| ) |  |

This function will attempt to receive a specified number of bytes of data from the UART and store it into the specified buffer.

This function is designed for either polled or interrupt driven modes. It is non-blocking such that it will return if no data has already received by the UART.

In a polled mode, this function will only receive as much data as the UART can buffer in the receiver. The application may need to call it repeatedly to receive a buffer. Polled mode is the default mode of operation for the driver.

In interrupt mode, this function will start receiving and then the interrupt handler of the driver will continue receiving data until the buffer has been received. A callback function, as specified by the application, will be called to indicate the completion of receiving the buffer or when any receive errors or timeouts occur.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  DataBufferPtr | is pointer to buffer for data to be received into.
  NumBytes | is the number of bytes to be received. A value of zero will stop a previous receive operation that is in progress in interrupt mode.

Returns
  The number of bytes received.

Note
  The number of bytes is not asserted so that this function may be called with a value of zero to stop an operation that is already in progress.

References XIOModule::BaseAddress, XIOModule::CurrentIER, XIOModule::IsReady, XIOModule::ReceiveBuffer, XIN_IER_OFFSET, and XIOModule_ReceiveBuffer().

u8 XIOModule_RecvByte | ( | UINTPTR | BaseAddress | ) |

This functions receives a single byte using the UART.

It is blocking in that it waits for the receiver to become non-empty before it reads from the receive register.

Parameters

  BaseAddress | is the base address of the device

Returns
  The byte of data received.

Note
  None.

References XIOModule_IsReceiveEmpty, and XUL_RX_OFFSET.

void XIOModule_RegisterHandler | ( | UINTPTR | BaseAddress,
|  | int | InterruptId,
|  | XInterruptHandler | Handler,
|  | void * | CallBackRef
| ) |  |

Register a handler function for a specific interrupt ID.

The vector table of the interrupt controller is updated, overwriting any previous handler. The handler function will be called when an interrupt occurs for the given interrupt ID.

This function can also be used to remove a handler from the vector table by passing in the XIOModule_DefaultHandler() as the handler and NULL as the callback reference.

Parameters

  BaseAddress | is the base address of the interrupt controller whose vector table will be modified.
  InterruptId | is the interrupt ID to be associated with the input handler.
  Handler | is the function pointer that will be added to the vector table for the given interrupt ID. It adheres to the XInterruptHandler signature found in xbasic_types.h.
  CallBackRef | is the argument that will be passed to the new handler function when it is called. This is user-specific.

Returns
  None.

Note
  Only used with normal interrupt mode. Does not restore normal interrupt mode.

Note that this function has no effect if the input base address is invalid.

References XIOModule_Config::HandlerTable.

Referenced by IOModuleLowLevelExample().

void XIOModule_Reset | ( | XIOModule * | InstancePtr,
|  | u8 | TimerNumber
| ) |  |

Resets the specified timer counter of the device.

A reset causes the timer counter to set it's value to the reset value.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  TimerNumber | is the timer counter of the device to operate on. Each device may contain multiple timer counters. The timer number is a zero based number with a range of 0 to (XTC_DEVICE_TIMER_COUNT - 1).

Returns
  None.

Note
  None.

References XIOModule::BaseAddress, XIOModule::CurrentTCSR, XIOModule::IsReady, XIOModule_WriteReg, XTC_CSR_ENABLE_TMR_MASK, XTC_DEVICE_TIMER_COUNT, and XTC_TCSR_OFFSET.

void XIOModule_ResetFifos | ( | XIOModule * | InstancePtr | ) |

This function does nothing, since the UART doesn't have any FIFOs.

It is included for compatibility with the UART Lite driver.

Parameters

  InstancePtr | is a pointer to the XIOModule instance .

Returns
  None.

Note
  None.

References XIOModule::IsReady.

unsigned int XIOModule_Send | ( | XIOModule * | InstancePtr,
|  | u8 * | DataBufferPtr,
|  | unsigned int | NumBytes
| ) |  |

This functions sends the specified buffer of data using the UART in either polled or interrupt driven modes.

This function is non-blocking such that it will return before the data has been sent by the UART. If the UART is busy sending data, it will return and indicate zero bytes were sent.

In a polled mode, this function will only send as much data as the UART can buffer in the transmitter. The application may need to call it repeatedly to send a buffer.

In interrupt mode, this function will start sending the specified buffer and then the interrupt handler of the driver will continue sending data until the buffer has been sent. A callback function, as specified by the application, will be called to indicate the completion of sending the buffer.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  DataBufferPtr | is pointer to a buffer of data to be sent.
  NumBytes | contains the number of bytes to be sent. A value of zero will stop a previous send operation that is in progress in interrupt mode. Any data that was already put into the transmit FIFO will be sent.

Returns
  The number of bytes actually sent.

Note
  The number of bytes is not asserted so that this function may be called with a value of zero to stop an operation that is already in progress.

References XIOModule::BaseAddress, XIOModule::CurrentIER, XIOModule::IsReady, XIOModule::SendBuffer, XIN_IER_OFFSET, and XIOModule_SendBuffer().

unsigned int XIOModule_SendBuffer | ( | XIOModule * | InstancePtr | ) |

This function sends a buffer that has been previously specified by setting up the instance variables of the instance.

This function is designed to be an internal function for the XIOModule component such that it may be called from a shell function that sets up the buffer or from an interrupt handler.

This function sends the specified buffer of data to the UART in either polled or interrupt driven modes. This function is non-blocking such that it will return before the data has been sent by the UART.

In a polled mode, this function will only send as much data as the UART can buffer in the transmitter. The application may need to call it repeatedly to send a buffer.

In interrupt mode, this function will start sending the specified buffer and then the interrupt handler of the driver will continue until the buffer has been sent. A callback function, as specified by the application, will be called to indicate the completion of sending the buffer.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.

Returns
  NumBytes is the number of bytes actually sent (put into the UART transmitter and/or FIFO).

Note
  None.

References XIOModule::BaseAddress, XIOModule_Uart_Stats::CharactersTransmitted, XIOModule::CurrentIER, XIOModule::SendBuffer, XIOModule::Uart_Stats, XIN_IER_OFFSET, XIOModule_GetStatusReg, XIOModule_WriteReg, XUL_SR_TX_FIFO_FULL, and XUL_TX_OFFSET.

Referenced by XIOModule_Send().

void XIOModule_SendByte | ( | UINTPTR | BaseAddress,
|  | u8 | Data
| ) |  |

This functions sends a single byte using the UART.

It is blocking in that it waits for the transmitter to become non-full before it writes the byte to the transmit register.

Parameters

  BaseAddress | is the base address of the device
  Data | is the byte of data to send

Returns
  None.

Note
  None.

References XIOModule_IsTransmitFull, and XUL_TX_OFFSET.

void XIOModule_SetHandler | ( | XIOModule * | InstancePtr,
|  | XIOModule_Timer_Handler | FuncPtr,
|  | void * | CallBackRef
| ) |  |

Sets the timer callback function, which the driver calls when the specified timer times out.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  CallBackRef | is the upper layer callback reference passed back when the callback function is invoked.
  FuncPtr | is the pointer to the callback function.

Returns
  None.

Note

The handler is called within interrupt context so the function that is called should either be short or pass the more extensive processing off to another task to allow the interrupt to return and normal processing to continue.

This function is provided for compatibility, and only allows setting a single handler for all Programmable Interval Timers.

References XIOModule::CallBackRef, XIOModule::CfgPtr, XIOModule::Handler, XIOModule_Config::HandlerTable, XIOModule::IsReady, and XIOModule_Timer_InterruptHandler().

Referenced by IOModuleIntrExample().

void XIOModule_SetIntrSvcOption | ( | UINTPTR | BaseAddress,
|  | int | Option
| ) |  |

Set the interrupt service option, which can configure the driver so that it services only a single interrupt at a time when an interrupt occurs, or services all pending interrupts when an interrupt occurs.

The default behavior when using the driver interface given in xintc.h file is to service only a single interrupt, whereas the default behavior when using the driver interface given in this file is to service all outstanding interrupts when an interrupt occurs.

Parameters

  BaseAddress | is the unique identifier for a device.
  Option | is XIN_SVC_SGL_ISR_OPTION if you want only a single interrupt serviced when an interrupt occurs, or XIN_SVC_ALL_ISRS_OPTION if you want all pending interrupts serviced when an interrupt occurs.

Returns
  None.

Note

Note that this function has no effect if the input base address is invalid.

References XIOModule_Config::Options.

void XIOModule_SetNormalIntrMode | ( | XIOModule * | InstancePtr,
|  | u8 | Id
| ) |  |

Sets the normal interrupt mode for the specified interrupt in the Interrupt Mode Register, by resetting the vector to (BaseVector & 0xFFFFFF80) | 0x10 and selecting normal mode.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  Id | contains the ID of the interrupt source and should be in the range of 0 to XPAR_INTC_MAX_NUM_INTR_INPUTS - 1 with 0 being the highest priority interrupt.

Returns
  None.

Note
  Only used with fast interrupt mode.

References XIOModule::BaseAddress, XIOModule_Config::BaseVector, XIOModule::CfgPtr, XIOModule::CurrentIER, XIOModule::CurrentIMR, XIOModule_Config::FastIntr, XIOModule_Config::HandlerTable, XIOModule::IsReady, XIOModule_Config::VectorAddrWidth, XIN_IER_OFFSET, XIN_IMR_OFFSET, XIN_IVAR_OFFSET, and XIN_IVEAR_OFFSET.

int XIOModule_SetOptions | ( | XIOModule * | InstancePtr,
|  | u32 | Options
| ) |  |

Set the options for the interrupt controller driver.

Parameters

  InstancePtr | is a pointer to the XIOModule instance to be worked on.
  Options | to be set. The available options are described in xiomodule.h.

Returns
  - XST_SUCCESS if the options were set successfully
  - XST_INVALID_PARAM if the specified option was not valid

Note
  None.

References XIOModule::CfgPtr, XIOModule::IsReady, XIOModule_Config::Options, and XIN_SVC_SGL_ISR_OPTION.

void XIOModule_SetRecvHandler | ( | XIOModule * | InstancePtr,
|  | XIOModule_Handler | FuncPtr,
|  | void * | CallBackRef
| ) |  |

This function sets the handler that will be called when an event (interrupt) occurs in the driver for the UART.

The purpose of the handler is to allow application specific processing to be performed.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  FuncPtr | is the pointer to the callback function.
  CallBackRef | is the upper layer callback reference passed back when the callback function is invoked.

Returns
  None.

Note
  There is no assert on the CallBackRef since the driver doesn't know what it is (nor should it)

References XIOModule::IsReady, XIOModule::RecvCallBackRef, and XIOModule::RecvHandler.

void XIOModule_SetResetValue | ( | XIOModule * | InstancePtr,
|  | u8 | TimerNumber,
|  | u32 | ResetValue
| ) |  |

Set the reset value for the specified timer counter.

This is the value that is loaded into the timer counter when it is reset. This value is also loaded when the timer counter is started.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  TimerNumber | is the timer counter of the device to operate on. Each device may contain multiple timer counters. The timer number is a zero based number with a range of 0 to (XTC_DEVICE_TIMER_COUNT - 1).
  ResetValue | contains the value to be used to reset the timer counter.

Returns
  None.

Note
  None.

References XIOModule::BaseAddress, XIOModule::CurrentTLR, XIOModule::IsReady, XIOModule_WriteReg, XTC_DEVICE_TIMER_COUNT, and XTC_TLR_OFFSET.

Referenced by IOModuleIntrExample(), and XIOModule_Timer_SelfTest().

void XIOModule_SetSendHandler | ( | XIOModule * | InstancePtr,
|  | XIOModule_Handler | FuncPtr,
|  | void * | CallBackRef
| ) |  |

This function sets the handler that will be called when an event (interrupt) occurs in the driver for the UART.

The purpose of the handler is to allow application specific processing to be performed.

Parameters

  InstancePtr | is a pointer to the XIOModule instance .
  FuncPtr | is the pointer to the callback function.
  CallBackRef | is the upper layer callback reference passed back when the callback function is invoked.

Returns
  None.

Note
  There is no assert on the CallBackRef since the driver doesn't know what it is (nor should it)

References XIOModule::IsReady, XIOModule::SendCallBackRef, and XIOModule::SendHandler.

int XIOModule_Start | ( | XIOModule * | InstancePtr | ) |

Starts the IO Module.

Interrupts may be generated by the IO Module after this function is called.

It is necessary for the caller to connect the interrupt handler of this component to the proper interrupt source.

Parameters

  InstancePtr | is a pointer to the XIOModule instance to be worked on.

Returns
  - XST_SUCCESS if the device was started successfully
  - XST_FAILURE if simulation mode was specified and it could not be set because real mode has already been entered.

Note
  Must be called after XIOModule initialization is completed.

References XIOModule::IsReady, and XIOModule::IsStarted.

Referenced by IOModuleInterruptSetup(), and SetUpInterruptSystem().

void XIOModule_Stop | ( | XIOModule * | InstancePtr | ) |

Stops the interrupt controller by disabling the output from the controller so that no interrupts will be caused by the interrupt controller.

Parameters

  InstancePtr | is a pointer to the XIOModule instance to be worked on.

Returns
  None.

Note
  None.

References XIOModule::IsReady, and XIOModule::IsStarted.

int XIOModule_Timer_Initialize | ( | XIOModule * | InstancePtr,
|  | u16 | DeviceId
| ) |  |

Initializes a specific timer instance/driver.

Initialize fields of the XIOModule structure, then reset the timer

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  DeviceId | is the unique id of the device controlled by this XIOModule component. Passing in a device id associates the generic XIOModule component to a specific device, as chosen by the caller or application developer.

Returns
  - XST_SUCCESS if initialization was successful
  - XST_DEVICE_IS_STARTED if the device has already been started
  - XST_DEVICE_NOT_FOUND if the device doesn't exist

Note
  None.

References XIOModule_Config::BaseAddress, XIOModule::BaseAddress, XIOModule::CallBackRef, XIOModule::CurrentTCSR, XIOModule::CurrentTLR, XIOModule::Handler, XIOModule_Timer_Stats::Interrupts, XIOModule::IsReady, XIOModule::Timer_Stats, XIOModule_LookupConfig(), XIOModule_WriteReg, XTC_CSR_ENABLE_TMR_MASK, XTC_DEVICE_TIMER_COUNT, XTC_TCSR_OFFSET, and XTC_TLR_OFFSET.

Referenced by XIOModule_Initialize().

void XIOModule_Timer_InterruptHandler | ( | void * | InstancePtr | ) |

Interrupt Service Routine (ISR) for the driver.

This function only performs processing for the Programmable Interval Timere and does not save and restore the interrupt context.

Parameters

  InstancePtr | contains a pointer to the IO Module instance for the interrupt.

Returns
  None.

Note
  None.

References XIOModule::BaseAddress, XIOModule::CallBackRef, XIOModule::CfgPtr, XIOModule::CurrentIMR, XIOModule::Handler, XIOModule_Timer_Stats::Interrupts, XIOModule_Config::PitUsed, XIOModule::Timer_Stats, XIN_IAR_OFFSET, XIN_IPR_OFFSET, XIOModule_ReadReg, XIOModule_WriteReg, and XTC_DEVICE_TIMER_COUNT.

Referenced by XIOModule_SetHandler().

int XIOModule_Timer_SelfTest | ( | XIOModule * | InstancePtr,
|  | u8 | TimerNumber
| ) |  |

Runs a self-test on the timer driver/device.

This test verifies that the specified programmable interval timer of the device can be enabled and increments.

Parameters

  InstancePtr | is a pointer to the XIOMOdule instance.
  TimerNumber | is the timer of the device to operate on. Each device may contain multiple timers. The timer number is a zero based number with a range of 0 to (XTC_DEVICE_TIMER_COUNT - 1).

Returns
  - XST_SUCCESS if self-test was successful

- XST_FAILURE if the timer is not incrementing.

Note

This is a destructive test using the provided timer. The current settings of the timer are returned to the initialized values and all settings at the time this function is called are overwritten.

References XIOModule::CfgPtr, XIOModule::IsReady, XIOModule_Config::PitSize, XIOModule_GetValue(), XIOModule_SetResetValue(), XIOModule_Timer_SetOptions(), XIOModule_Timer_Start(), XIOModule_Timer_Stop(), and XTC_DEVICE_TIMER_COUNT.

void XIOModule_Timer_SetOptions | ( | XIOModule * | InstancePtr,
|  | u8 | TimerNumber,
|  | u32 | Options
| ) |  |

Enables the specified options for the specified timer .

This function sets the options without regard to the current options of the driver. To prevent a loss of the current options, the user should call XIOModule_Timer_GetOptions() prior to this function and modify the retrieved options to pass into this function to prevent loss of the current options.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  TimerNumber | is the timer of the device to operate on. Each device may contain multiple timers. The timer number is a zero based number with a range of 0 to (XTC_DEVICE_TIMER_COUNT - 1).
  Options | contains the desired options to be set or cleared. Setting the option to '1' enables the option, clearing the to '0' disables the option. The options are bit masks such that multiple options may be set or cleared. The options are described in xiomodule.h.

Returns
  None.

Note
  None.

References XIOModule::BaseAddress, XIOModule::CurrentTCSR, XIOModule::IsReady, XIOModule_WriteReg, XTC_DEVICE_TIMER_COUNT, and XTC_TCSR_OFFSET.

Referenced by IOModuleHandler(), IOModuleIntrExample(), and XIOModule_Timer_SelfTest().

void XIOModule_Timer_Start | ( | XIOModule * | InstancePtr,
|  | u8 | TimerNumber
| ) |  |

Starts the specified timer counter of the device such that it starts running.

The timer counter is reset before it is started and the reset value is loaded into the timer counter.

If interrupt mode is specified in the options, it is necessary for the caller to connect the interrupt handler of the timer to the interrupt source, typically an interrupt controller, and enable the interrupt within the interrupt controller.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  TimerNumber | is the timer of the device to operate on. Each device may contain multiple timers. The timer number is a zero based number with a range of 0 to (XTC_DEVICE_TIMER_COUNT - 1).

Returns
  None.

Note
  None.

References XIOModule::BaseAddress, XIOModule::CurrentTCSR, XIOModule::IsReady, XIOModule_WriteReg, XTC_CSR_ENABLE_TMR_MASK, XTC_DEVICE_TIMER_COUNT, and XTC_TCSR_OFFSET.

Referenced by IOModuleIntrExample(), and XIOModule_Timer_SelfTest().

void XIOModule_Timer_Stop | ( | XIOModule * | InstancePtr,
|  | u8 | TimerNumber
| ) |  |

Stops the timer by disabling it.

It is the callers' responsibility to disconnect the interrupt handler of the timer from the interrupt source, typically an interrupt controller, and disable the interrupt within the interrupt controller.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.
  TimerNumber | is the timer counter of the device to operate on. Each device may contain multiple timer counters. The timer number is a zero based number with a range of 0 to (XTC_DEVICE_TIMER_COUNT - 1).

Returns
  None.

Note
  None.

References XIOModule::BaseAddress, XIOModule::CurrentTCSR, XIOModule::IsReady, XIOModule_WriteReg, XTC_CSR_ENABLE_TMR_MASK, XTC_DEVICE_TIMER_COUNT, and XTC_TCSR_OFFSET.

Referenced by IOModuleIntrExample(), and XIOModule_Timer_SelfTest().

void XIOModule_Uart_DisableInterrupt | ( | XIOModule * | InstancePtr | ) |

This function disables the UART interrupt.

After calling this function, data may still be received by the UART but no interrupt will be generated since the hardware device has no way to disable the receiver.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.

Returns
  None.

Note
  None.

References XIOModule::BaseAddress, XIOModule::CurrentIER, XIOModule::IsReady, and XIN_IER_OFFSET.

void XIOModule_Uart_EnableInterrupt | ( | XIOModule * | InstancePtr | ) |

This function enables the UART interrupts such that an interrupt will occur when data is received or data has been transmitted.

Parameters

  InstancePtr | is a pointer to the XIOModule instance.

Returns
  None.

Note
  None.

References XIOModule::BaseAddress, XIOModule::CurrentIER, XIOModule::IsReady, and XIN_IER_OFFSET.

void XIOModule_Uart_InterruptHandler | ( | XIOModule * | InstancePtr | ) |

This function is the interrupt handler for the UART.

It must be connected to an interrupt system by the user such that it is called when an interrupt for any UART lite occurs. This function does not save or restore the processor context such that the user must ensure this occurs.

Parameters

  InstancePtr | contains a pointer to the instance of the IOModule that the interrupt is for.

Returns
  None.

Note
  None.

References XIOModule::BaseAddress, XIOModule::SendBuffer, XIOModule_GetStatusReg, XUL_SR_RX_FIFO_VALID_DATA, and XUL_SR_TX_FIFO_FULL.

## Variable Documentation

XIOModule_Config XIOModule_ConfigTable[XPAR_XIOMODULE_NUM_INSTANCES]

This table contains configuration information for each iomodule device in the system.

The XIOModule driver must know when to acknowledge the interrupt. The entry which specifies this as a bit mask where each bit corresponds to a specific interrupt. A bit set indicates to ack it before servicing it. Generally, acknowledge before service is used when the interrupt signal is edge-sensitive, and after when the signal is level-sensitive.

Refer to the XIOModule_Config data structure in xiomodule.h for details on how this table should be initialized.

Referenced by XIOModule_DeviceInterruptHandler(), and XIOModule_LookupConfig().

XIOModule_Config XIOModule_ConfigTable[]

This table contains configuration information for each iomodule device in the system.

The XIOModule driver must know when to acknowledge the interrupt. The entry which specifies this as a bit mask where each bit corresponds to a specific interrupt. A bit set indicates to ack it before servicing it. Generally, acknowledge before service is used when the interrupt signal is edge-sensitive, and after when the signal is level-sensitive.

Refer to the XIOModule_Config data structure in xiomodule.h for details on how this table should be initialized.

Referenced by XIOModule_DeviceInterruptHandler(), and XIOModule_LookupConfig().