Software Drivers

xiomodule.h File Reference

#include "xparameters.h"
#include "xstatus.h"
#include "xiomodule_l.h"
#include "xil_types.h"

Classes

struct  XIOModule_Config
struct  XIOModule_Uart_Stats
struct  XIOModule_Buffer
struct  XIOModule_Timer_Stats
struct  XIOModule

Defines

#define IOMODULE_H
Configuration options

These options are used in XIOModule_SetOptions() to configure the device.



#define XTC_INT_MODE_OPTION   0
#define XTC_AUTO_RELOAD_OPTION   0x00000002UL
#define XIN_SVC_SGL_ISR_OPTION   1UL
#define XIN_SVC_ALL_ISRS_OPTION   2UL
Hardware configuration mnemonics

These mnemonics are used when accessing hardware configuration parameters.



#define XTC_PRESCALER_NONE   0
#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

Typedefs

typedef void(* XIOModule_Handler )(void *CallBackRef, unsigned int ByteCount)
typedef void(* XIOModule_Timer_Handler )(void *CallBackRef, u8 TimerNumber)

Functions

int XIOModule_Initialize (XIOModule *InstancePtr, u16 DeviceId)
int XIOModule_Timer_Initialize (XIOModule *InstancePtr, u16 DeviceId)
int XIOModule_Start (XIOModule *InstancePtr)
void XIOModule_Stop (XIOModule *InstancePtr)
int XIOModule_Connect (XIOModule *InstancePtr, u8 Id, XInterruptHandler Handler, void *CallBackRef)
void XIOModule_Disconnect (XIOModule *InstancePtr, u8 Id)
void XIOModule_Enable (XIOModule *InstancePtr, u8 Id)
void XIOModule_Disable (XIOModule *InstancePtr, u8 Id)
void XIOModule_Acknowledge (XIOModule *InstancePtr, u8 Id)
XIOModule_ConfigXIOModule_LookupConfig (u16 DeviceId)
int XIOModule_ConnectFastHandler (XIOModule *InstancePtr, u8 Id, XFastInterruptHandler Handler)
void XIOModule_SetNormalIntrMode (XIOModule *InstancePtr, u8 Id)
u32 XIOModule_DiscreteRead (XIOModule *InstancePtr, unsigned Channel)
void XIOModule_DiscreteWrite (XIOModule *InstancePtr, unsigned Channel, u32 Mask)
void XIOModule_DiscreteSet (XIOModule *InstancePtr, unsigned Channel, u32 Mask)
void XIOModule_DiscreteClear (XIOModule *InstancePtr, unsigned Channel, u32 Mask)
int XIOModule_CfgInitialize (XIOModule *InstancePtr, XIOModule_Config *Config, u32 EffectiveAddr)
void XIOModule_ResetFifos (XIOModule *InstancePtr)
unsigned int XIOModule_Send (XIOModule *InstancePtr, u8 *DataBufferPtr, unsigned int NumBytes)
unsigned int XIOModule_Recv (XIOModule *InstancePtr, u8 *DataBufferPtr, unsigned int NumBytes)
int XIOModule_IsSending (XIOModule *InstancePtr)
int XIOModule_SetBaudRate (XIOModule *InstancePtr, u32 BaudRate)
void XIOModule_GetStats (XIOModule *InstancePtr, XIOModule_Uart_Stats *StatsPtr)
void XIOModule_ClearStats (XIOModule *InstancePtr)
void XIOModule_VoidInterruptHandler ()
void XIOModule_InterruptHandler (XIOModule *InstancePtr)
void XIOModule_Uart_EnableInterrupt (XIOModule *InstancePtr)
void XIOModule_Uart_DisableInterrupt (XIOModule *InstancePtr)
void XIOModule_SetRecvHandler (XIOModule *InstancePtr, XIOModule_Handler FuncPtr, void *CallBackRef)
void XIOModule_SetSendHandler (XIOModule *InstancePtr, XIOModule_Handler FuncPtr, void *CallBackRef)
void XIOModule_Uart_InterruptHandler (XIOModule *InstancePtr)
int XIOModule_SetOptions (XIOModule *InstancePtr, u32 Options)
u32 XIOModule_GetOptions (XIOModule *InstancePtr)
int XIOModule_SelfTest (XIOModule *InstancePtr)
void XIOModule_Timer_Start (XIOModule *InstancePtr, u8 TimerNumber)
void XIOModule_Timer_Stop (XIOModule *InstancePtr, u8 TimerNumber)
u32 XIOModule_GetValue (XIOModule *InstancePtr, u8 TimerNumber)
void XIOModule_SetResetValue (XIOModule *InstancePtr, u8 TimerNumber, u32 ResetValue)
u32 XIOModule_GetCaptureValue (XIOModule *InstancePtr, u8 TimerNumber)
int XIOModule_IsExpired (XIOModule *InstancePtr, u8 TimerNumber)
void XIOModule_Reset (XIOModule *InstancePtr, u8 TimerNumber)
void XIOModule_Timer_SetOptions (XIOModule *InstancePtr, u8 TimerNumber, u32 Options)
u32 XIOModule_Timer_GetOptions (XIOModule *InstancePtr, u8 TimerNumber)
void XIOModule_Timer_GetStats (XIOModule *InstancePtr, XIOModule_Timer_Stats *StatsPtr)
void XIOModule_Timer_ClearStats (XIOModule *InstancePtr)
int XIOModule_Timer_SelfTest (XIOModule *InstancePtr, u8 IOModuleNumber)
void XIOModule_SetHandler (XIOModule *InstancePtr, XIOModule_Timer_Handler FuncPtr, void *CallBackRef)
void XIOModule_Timer_InterruptHandler (void *InstancePtr)
u32 XIOModule_IoReadWord (XIOModule *InstancePtr, u32 ByteOffset)
u16 XIOModule_IoReadHalfword (XIOModule *InstancePtr, u32 ByteOffset)
u8 XIOModule_IoReadByte (XIOModule *InstancePtr, u32 ByteOffset)
void XIOModule_IoWriteWord (XIOModule *InstancePtr, u32 ByteOffset, u32 Data)
void XIOModule_IoWriteHalfword (XIOModule *InstancePtr, u32 ByteOffset, u16 Data)
void XIOModule_IoWriteByte (XIOModule *InstancePtr, u32 ByteOffset, u8 Data)

Detailed Description


Define Documentation

#define IOMODULE_H
#define XIN_SVC_ALL_ISRS_OPTION   2UL
#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.
 
#define XTC_AUTO_RELOAD_OPTION   0x00000002UL
#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.
 
#define XTC_PRESCALER_EXTERNAL   9
#define XTC_PRESCALER_FIT1   1
#define XTC_PRESCALER_FIT2   2
#define XTC_PRESCALER_FIT3   3
#define XTC_PRESCALER_FIT4   4
#define XTC_PRESCALER_NONE   0

Mnemonics for the Programmable Interval Timer hardware configuration.

 XTC_PRESCALER_*	Define the prescaler configured in hardware.
 
#define XTC_PRESCALER_PIT1   5
#define XTC_PRESCALER_PIT2   6
#define XTC_PRESCALER_PIT3   7
#define XTC_PRESCALER_PIT4   8

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

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

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.

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.
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.
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.
u32 XIOModule_DiscreteRead ( XIOModule InstancePtr,
unsigned  Channel 
)

Read state of discretes for the specified GPI channnel.

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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
int XIOModule_SelfTest ( XIOModule InstancePtr  ) 
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.
int XIOModule_SetBaudRate ( XIOModule InstancePtr,
u32  BaudRate 
)
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.

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.
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.
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)
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.
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)
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.
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.
void XIOModule_Timer_ClearStats ( XIOModule InstancePtr  ) 
u32 XIOModule_Timer_GetOptions ( XIOModule InstancePtr,
u8  TimerNumber 
)
void XIOModule_Timer_GetStats ( XIOModule InstancePtr,
XIOModule_Timer_Stats StatsPtr 
)
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.
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.
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.

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