iomodule
Vitis Drivers API Documentation
Overview

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...
 
struct  XIOModule_VectorTableEntry
 Defines the number of timer counters within a single hardware device. More...
 

Macros

#define XIOModule_UpdateStats(InstancePtr, StatusRegister)
 Update the statistics of the instance. 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

s32 XIOModule_Initialize (XIOModule *InstancePtr, u16 DeviceId)
 Initialize a specific interrupt controller instance/driver. More...
 
s32 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...
 
s32 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_ConfigXIOModule_LookupConfig (u16 DeviceId)
 Looks up the device configuration based on the unique device ID. More...
 
s32 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, u32 Channel)
 Read state of discretes for the specified GPI channel. More...
 
void XIOModule_DiscreteWrite (XIOModule *InstancePtr, u32 Channel, u32 Data)
 Write to discretes register for the specified GPO channel. More...
 
s32 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...
 
s32 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, u32 Channel, u32 Mask)
 Set output discrete(s) to logic 1 for the specified GPO channel. More...
 
void XIOModule_DiscreteClear (XIOModule *InstancePtr, u32 Channel, u32 Mask)
 Set output discrete(s) to logic 0 for the specified GPO channel. More...
 
s32 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...
 
u32 XIOModule_Send (XIOModule *InstancePtr, u8 *DataBufferPtr, u32 NumBytes)
 This functions sends the specified buffer of data using the UART in either polled or interrupt driven modes. More...
 
u32 XIOModule_Recv (XIOModule *InstancePtr, u8 *DataBufferPtr, u32 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...
 
s32 XIOModule_IsSending (XIOModule *InstancePtr)
 This function determines if the specified UART is sending data. More...
 
s32 XIOModule_SetBaudRate (XIOModule *InstancePtr, u32 BaudRate)
 Sets the baud rate for the specified UART. 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)
 The interrupt handler for the driver. 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...
 
s32 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...
 
s32 XIOModule_SelfTest (XIOModule *InstancePtr)
 Runs a self-test on the timer and interrupt controller driver/device. More...
 
void XIOModule_Timer_SetOptions (XIOModule *InstancePtr, u8 TimerNumber, u32 Options)
 Enables the specified options for the specified timer . More...
 
u32 XIOModel_Timer_GetOptions (XIOModule *InstancePtr, u8 TimerNumber)
 Get the options for the specified timer. More...
 
s32 XIOModule_Timer_SelfTest (XIOModule *InstancePtr, u8 TimerNumber)
 Runs a self-test on the timer driver/device. More...
 
int XIOModule_Intc_SelfTest (XIOModule *InstancePtr)
 Run a self-test on the interrupt controller 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 function is the primary interrupt handler for the driver. More...
 
void XIOModule_SetIntrSvcOption (UINTPTR BaseAddress, s32 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, s32 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...
 

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...
 

Macro Definition Documentation

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

Acknowledge specific interrupt(s) in the interrupt controller.

Parameters
BaseAddressis the base address of the device
AckMaskis 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
BaseAddressis the base address of the device
DisableMaskis 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
BaseAddressis the base address of the device
EnableMaskis 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
BaseAddressis 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
BaseAddressis 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)
#define XIOModule_GetStatusReg(BaseAddress)
Get the contents of the UART status register.
Definition: xiomodule_l.h:323

Check to see if the UART receiver has data.

Parameters
BaseAddressis 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)
#define XIOModule_GetStatusReg(BaseAddress)
Get the contents of the UART status register.
Definition: xiomodule_l.h:323

Check to see if the transmitter is full.

Parameters
BaseAddressis 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
BaseAddressis the base address of the GPI device.
RegOffsetis 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_UpdateStats (   InstancePtr,
  StatusRegister 
)
Value:
{ \
if ((StatusRegister) & XUL_SR_OVERRUN_ERROR) \
{ \
(InstancePtr)->Uart_Stats.ReceiveOverrunErrors++; \
} \
if ((StatusRegister) & XUL_SR_PARITY_ERROR) \
{ \
(InstancePtr)->Uart_Stats.ReceiveParityErrors++; \
} \
if ((StatusRegister) & XUL_SR_FRAMING_ERROR) \
{ \
(InstancePtr)->Uart_Stats.ReceiveFramingErrors++; \
} \
}

Update the statistics of the instance.

Parameters
InstancePtris a pointer to the XIOMOdule instance.
StatusRegistercontains the contents of the UART status register to update the statistics with.
Returns
None.
Note

Signature: void XIOModule_UpdateStats(XIOModule *InstancePtr, u32 StatusRegister)

Referenced by XIOModule_ReceiveBuffer().

#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
BaseAddressis the base address of the GPO device.
RegOffsetis the register offset from the base to write to.
Datais 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_SetBaudRate(), XIOModule_SetResetValue(), XIOModule_Timer_Initialize(), XIOModule_Timer_InterruptHandler(), XIOModule_Timer_SetOptions(), XIOModule_Timer_Start(), and XIOModule_Timer_Stop().

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
CallBackRefis 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.
TimerNumberis 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
InstancePtris a pointer to the XIOModule instance.
TimerNumberis 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, and XIOModule::IsReady.

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
InstancePtris a pointer to the XIOModule instance to be worked on.
Idcontains 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, and XIOModule::IsReady.

s32 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
InstancePtris a pointer to the XIOModule instance.
Configis 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.
EffectiveAddris 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_Buffer::NextBytePtr, XIOModule::ReceiveBuffer, XIOModule::RecvHandler, XIOModule_Buffer::RemainingBytes, XIOModule_Buffer::RequestedBytes, XIOModule::SendBuffer, XIOModule::SendHandler, and XIOModule_ClearStats().

Referenced by XIOModule_Initialize().

s32 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
InstancePtris a pointer to the XIOModule instance to be worked on.
Idcontains 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.
Handlerto the handler for that interrupt.
CallBackRefis 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_VectorTableEntry::CallBackRef, XIOModule::CfgPtr, XIOModule_VectorTableEntry::Handler, XIOModule_Config::HandlerTable, and XIOModule::IsReady.

s32 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
InstancePtris a pointer to the XIOModule instance.
Idcontains 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.
Handlerto 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_VectorTableEntry::CallBackRef, XIOModule::CfgPtr, XIOModule::CurrentIER, XIOModule::CurrentIMR, XIOModule_Config::FastIntr, XIOModule_VectorTableEntry::Handler, XIOModule_Config::HandlerTable, XIOModule::IsReady, and XIOModule_Config::VectorAddrWidth.

void XIOModule_DeviceInterruptHandler ( void *  DeviceId)

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
DeviceIdis 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_VectorTableEntry::CallBackRef, XIOModule_VectorTableEntry::Handler, XIOModule_AckIntr, XIOModule_ConfigTable, XIOModule_GetIntrStatus, and XIOModule_LookupConfig().

Referenced by IOModuleSetupIntrSystem(), 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
InstancePtris a pointer to the XIOModule instance to be worked on.
Idcontains 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, and XIOModule::IsReady.

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
InstancePtris a pointer to the XIOModule instance to be worked on.
Idcontains 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_VectorTableEntry::CallBackRef, XIOModule::CfgPtr, XIOModule::CurrentIER, XIOModule_VectorTableEntry::Handler, XIOModule_Config::HandlerTable, and XIOModule::IsReady.

void XIOModule_DiscreteClear ( XIOModule InstancePtr,
u32  Channel,
u32  Mask 
)

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

Parameters
InstancePtris a pointer to an XIOModule instance to be worked on.
Channelcontains the channel of the GPIO (1, 2, 3 or 4) to operate on.
Maskis 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,
u32  Channel 
)

Read state of discretes for the specified GPI channel.

Parameters
InstancePtris a pointer to an XIOModule instance to be worked on.
Channelcontains 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, and XIOModule_ReadReg.

void XIOModule_DiscreteSet ( XIOModule InstancePtr,
u32  Channel,
u32  Mask 
)

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

Parameters
InstancePtris a pointer to an XIOModule instance to be worked on.
Channelcontains the channel of the GPIO (1, 2, 3 or 4) to operate on.
Maskis 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,
u32  Channel,
u32  Data 
)

Write to discretes register for the specified GPO channel.

Parameters
InstancePtris a pointer to an XIOModule instance to be worked on.
Channelcontains the channel of the GPO (1, 2, 3 or 4) to operate on.
Datais 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
InstancePtris a pointer to the XIOModule instance to be worked on.
Idcontains 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, and XIOModule::IsReady.

Referenced by IOModuleIntrExample().

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
InstancePtris a pointer to the XIOModule instance.
TimerNumberis 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, and XIOModule::IsReady.

u32 XIOModule_GetOptions ( XIOModule InstancePtr)

Return the currently set options.

Parameters
InstancePtris 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
InstancePtris a pointer to the XIOModule instance.
StatsPtris 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
InstancePtris a pointer to the XIOModule instance.
TimerNumberis 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, and XIOModule_ReadReg.

Referenced by XIOModule_Timer_SelfTest().

s32 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
InstancePtris a pointer to the XIOModule instance to be worked on.
DeviceIdis 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_VectorTableEntry::CallBackRef, XIOModule::CfgPtr, XIOModule::CurrentIER, XIOModule::CurrentIMR, XIOModule_Config::FastIntr, XIOModule_Config::GpoInit, XIOModule::GpoValue, XIOModule_VectorTableEntry::Handler, XIOModule_Config::HandlerTable, XIOModule_Config::IoBaseAddress, XIOModule::IoBaseAddress, XIOModule::IsReady, XIOModule::IsStarted, XIOModule_Config::Options, XIOModule_Config::VectorAddrWidth, XIOModule_CfgInitialize(), XIOModule_LookupConfig(), and XIOModule_Timer_Initialize().

Referenced by 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
InstancePtris 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, and XIOModule::IsReady.

Referenced by XIOModule_SelfTest().

void XIOModule_InterruptHandler ( XIOModule InstancePtr)

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
InstancePtris a pointer to the XIOModule instance to be worked on.
Returns
None.
Note
None.

References XIOModule_Config::BaseAddress, 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
InstancePtris a pointer to an XIOModule instance to be worked on.
ByteOffsetis 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
InstancePtris a pointer to an XIOModule instance to be worked on.
ByteOffsetis 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
InstancePtris a pointer to an XIOModule instance to be worked on.
ByteOffsetis 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
InstancePtris a pointer to an XIOModule instance to be worked on.
ByteOffsetis a byte offset from the beginning of the IO Bus address area
Datais 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
InstancePtris a pointer to an XIOModule instance to be worked on.
ByteOffsetis a byte offset from the beginning of the IO Bus address area
Datais 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
InstancePtris a pointer to an XIOModule instance to be worked on.
ByteOffsetis a byte offset from the beginning of the IO Bus address area
Datais the value to be written to the IO Bus - 32-bit
Returns
None.

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

s32 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
InstancePtris a pointer to the XIOModule instance.
TimerNumberis 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, and XIOModule_ReadReg.

Referenced by IOModuleHandler().

s32 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
InstancePtris a pointer to the XIOModule instance.
Returns
A value of TRUE if the UART is sending data, otherwise FALSE.
Note
None.

References XIOModule::BaseAddress, and XIOModule_ReadReg.

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
DeviceIdis 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_DeviceInterruptHandler(), 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
InstancePtris a pointer to the XIOModule instance.
Returns
The number of bytes received.
Note
None.

References XIOModule::BaseAddress, XIOModule_Uart_Stats::CharactersReceived, XIOModule::CurrentIER, XIOModule_Buffer::NextBytePtr, XIOModule::ReceiveBuffer, XIOModule_Buffer::RemainingBytes, XIOModule::Uart_Stats, XIOModule_GetStatusReg, XIOModule_ReadReg, and XIOModule_UpdateStats.

Referenced by XIOModule_Recv().

u32 XIOModule_Recv ( XIOModule InstancePtr,
u8 *  DataBufferPtr,
u32  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
InstancePtris a pointer to the XIOModule instance.
DataBufferPtris pointer to buffer for data to be received into.
NumBytesis 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_Buffer::NextBytePtr, XIOModule::ReceiveBuffer, XIOModule_Buffer::RemainingBytes, XIOModule_Buffer::RequestedBytes, 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
BaseAddressis the base address of the device
Returns
The byte of data received.
Note
None.

References XIOModule_IsReceiveEmpty.

void XIOModule_RegisterHandler ( UINTPTR  BaseAddress,
s32  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
BaseAddressis the base address of the interrupt controller whose vector table will be modified.
InterruptIdis the interrupt ID to be associated with the input handler.
Handleris 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.
CallBackRefis 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_VectorTableEntry::CallBackRef, XIOModule_VectorTableEntry::Handler, and 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
InstancePtris a pointer to the XIOModule instance.
TimerNumberis 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, and XIOModule_WriteReg.

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
InstancePtris a pointer to the XIOModule instance .
Returns
None.
Note
None.

References XIOModule::IsReady.

s32 XIOModule_SelfTest ( XIOModule InstancePtr)

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

Parameters
InstancePtris a pointer to the XIOMOdule instance.
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::PitPrescaler, XIOModule_Config::PitReadable, XIOModule_Config::PitSize, XIOModule_Config::PitUsed, XIOModule_Intc_SelfTest(), and XIOModule_Timer_SelfTest().

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

u32 XIOModule_Send ( XIOModule InstancePtr,
u8 *  DataBufferPtr,
u32  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
InstancePtris a pointer to the XIOModule instance.
DataBufferPtris pointer to a buffer of data to be sent.
NumBytescontains 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_Buffer::NextBytePtr, XIOModule_Buffer::RemainingBytes, XIOModule_Buffer::RequestedBytes, XIOModule::SendBuffer, 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
InstancePtris 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_Buffer::NextBytePtr, XIOModule_Buffer::RemainingBytes, XIOModule::SendBuffer, XIOModule::Uart_Stats, XIOModule_GetStatusReg, and XIOModule_WriteReg.

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
BaseAddressis the base address of the device
Datais the byte of data to send
Returns
None.
Note
None.

References XIOModule_IsTransmitFull.

s32 XIOModule_SetBaudRate ( XIOModule InstancePtr,
u32  BaudRate 
)

Sets the baud rate for the specified UART.

Checks the input value for validity and also verifies that the requested rate can be configured to within the 3 percent error range for RS-232 communications. If the provided rate is not valid, the current setting is unchanged.

This function is designed to be an internal function only used within the XIOModule component. It is necessary for initialization and for the user available function that sets the data format.

Parameters
InstancePtris a pointer to the XIOModule instance.
BaudRateto be set in the hardware.
Returns
  • XST_SUCCESS if everything configures as expected
    • XST_UART_BAUD_ERROR if the requested rate is not available because there was too much error due to the input clock
Note
None.

References XIOModule::BaseAddress, XIOModule_Config::BaudRate, XIOModule::CfgPtr, XIOModule::CurrentUBRR, XIOModule_Config::InputClockHz, XIOModule::IsReady, and XIOModule_WriteReg.

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
InstancePtris a pointer to the XIOModule instance.
CallBackRefis the upper layer callback reference passed back when the callback function is invoked.
FuncPtris 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_VectorTableEntry::Handler, XIOModule::Handler, XIOModule_Config::HandlerTable, XIOModule::IsReady, and XIOModule_Timer_InterruptHandler().

Referenced by IOModuleIntrExample().

void XIOModule_SetIntrSvcOption ( UINTPTR  BaseAddress,
s32  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
BaseAddressis the unique identifier for a device.
Optionis 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
InstancePtris a pointer to the XIOModule instance.
Idcontains 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_VectorTableEntry::CallBackRef, XIOModule::CfgPtr, XIOModule::CurrentIER, XIOModule::CurrentIMR, XIOModule_Config::FastIntr, XIOModule_VectorTableEntry::Handler, XIOModule_Config::HandlerTable, XIOModule::IsReady, and XIOModule_Config::VectorAddrWidth.

s32 XIOModule_SetOptions ( XIOModule InstancePtr,
u32  Options 
)

Set the options for the interrupt controller driver.

Parameters
InstancePtris a pointer to the XIOModule instance to be worked on.
Optionsto 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, and XIOModule_Config::Options.

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
InstancePtris a pointer to the XIOModule instance.
FuncPtris the pointer to the callback function.
CallBackRefis 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
InstancePtris a pointer to the XIOModule instance.
TimerNumberis 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).
ResetValuecontains the value to be used to reset the timer counter.
Returns
None.
Note
None.

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

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
InstancePtris a pointer to the XIOModule instance .
FuncPtris the pointer to the callback function.
CallBackRefis 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.

s32 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
InstancePtris 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().

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
InstancePtris a pointer to the XIOModule instance to be worked on.
Returns
None.
Note
None.

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

s32 XIOModule_Timer_Initialize ( XIOModule InstancePtr,
u16  DeviceId 
)

Initializes a specific timer instance/driver.

Initialize fields of the XIOModule structure, then reset the timer

Parameters
InstancePtris a pointer to the XIOModule instance.
DeviceIdis 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(), and XIOModule_WriteReg.

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
InstancePtrcontains 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, XIOModule_ReadReg, and XIOModule_WriteReg.

Referenced by XIOModule_SetHandler().

s32 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
InstancePtris a pointer to the XIOMOdule instance.
TimerNumberis 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(), and XIOModule_Timer_Stop().

Referenced by XIOModule_SelfTest().

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
InstancePtris a pointer to the XIOModule instance.
TimerNumberis 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).
Optionscontains 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, and XIOModule_WriteReg.

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
InstancePtris a pointer to the XIOModule instance.
TimerNumberis 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, and XIOModule_WriteReg.

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
InstancePtris a pointer to the XIOModule instance.
TimerNumberis 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, and XIOModule_WriteReg.

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
InstancePtris a pointer to the XIOModule instance.
Returns
None.
Note
None.

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

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
InstancePtris a pointer to the XIOModule instance.
Returns
None.
Note
None.

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

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
InstancePtrcontains a pointer to the instance of the IOModule that the interrupt is for.
Returns
None.
Note
None.

References XIOModule::BaseAddress, XIOModule_Buffer::RequestedBytes, XIOModule::SendBuffer, and XIOModule_GetStatusReg.

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