Software Drivers
Main Page | Data Structures | File List | Data Fields | Globals

xuartns550_options.c File Reference


Detailed Description

The implementation of the options functions for the XUartNs550 driver.

 MODIFICATION HISTORY:

 Ver   Who  Date     Changes
 ----- ---- -------- -----------------------------------------------
 1.00b jhl  03/11/02 Repartitioned driver for smaller files.
 1.00b rpm  04/12/05 Added critical section protection in ReadFcrRegister
 1.11a sv   03/20/07 Updated to use the new coding guidelines.
 1.13a sdm  07/10/09 Added receive line interrupt option to OptionsTable[].
 


Data Structures

struct  Mapping

Functions

u16 XUartNs550_GetOptions (XUartNs550 *InstancePtr)
int XUartNs550_SetOptions (XUartNs550 *InstancePtr, u16 Options)
u8 XUartNs550_GetFifoThreshold (XUartNs550 *InstancePtr)
int XUartNs550_SetFifoThreshold (XUartNs550 *InstancePtr, u8 TriggerLevel)
u8 XUartNs550_GetLastErrors (XUartNs550 *InstancePtr)
u8 XUartNs550_GetModemStatus (XUartNs550 *InstancePtr)
int XUartNs550_IsSending (XUartNs550 *InstancePtr)


Function Documentation

u8 XUartNs550_GetFifoThreshold XUartNs550 InstancePtr  ) 
 

This function gets the receive FIFO trigger level. The receive trigger level indicates the number of bytes in the receive FIFO that cause a receive data event (interrupt) to be generated.

Parameters:
InstancePtr is a pointer to the XUartNs550 instance .
Returns:
The current receive FIFO trigger level. Constants which define each trigger level are contained in the file xuartns550.h and named XUN_FIFO_TRIGGER_*.
Note:
None.

u8 XUartNs550_GetLastErrors XUartNs550 InstancePtr  ) 
 

This function returns the last errors that have occurred in the specified UART. It also clears the errors such that they cannot be retrieved again. The errors include parity error, receive overrun error, framing error, and break detection.

The last errors is an accumulation of the errors each time an error is discovered in the driver. A status is checked for each received byte and this status is accumulated in the last errors.

If this function is called after receiving a buffer of data, it will indicate any errors that occurred for the bytes of the buffer. It does not indicate which bytes contained errors.

Parameters:
InstancePtr is a pointer to the XUartNs550 instance.
Returns:
The last errors that occurred. The errors are bit masks that are contained in the file xuartns550.h and named XUN_ERROR_*.
Note:
None.

u8 XUartNs550_GetModemStatus XUartNs550 InstancePtr  ) 
 

This function gets the modem status from the specified UART. The modem status indicates any changes of the modem signals. This function allows the modem status to be read in a polled mode. The modem status is updated whenever it is read such that reading it twice may not yield the same results.

Parameters:
InstancePtr is a pointer to the XUartNs550 instance .
Returns:
The modem status which are bit masks that are contained in the file xuartns550.h and named XUN_MODEM_*.
Note:
The bit masks used for the modem status are the exact bits of the modem status register with no abstraction.

u16 XUartNs550_GetOptions XUartNs550 InstancePtr  ) 
 

Gets the options for the specified driver instance. The options are implemented as bit masks such that multiple options may be enabled or disabled simulataneously.

Parameters:
InstancePtr is a pointer to the XUartNs550 instance.
Returns:
The current options for the UART. The optionss are bit masks that are contained in the file xuartns550.h and named XUN_OPTION_*.
Note:
None.

int XUartNs550_IsSending XUartNs550 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 XUartNs550 instance.
Returns:
A value of TRUE if the UART is sending data, otherwise FALSE.
Note:
None.

int XUartNs550_SetFifoThreshold XUartNs550 InstancePtr,
u8  TriggerLevel
 

This functions sets the receive FIFO trigger level. The receive trigger level specifies the number of bytes in the receive FIFO that cause a receive data event (interrupt) to be generated. The FIFOs must be enabled to set the trigger level.

Parameters:
InstancePtr is a pointer to the XUartNs550 instance .
TriggerLevel contains the trigger level to set. Constants which define each trigger level are contained in the file xuartns550.h and named XUN_FIFO_TRIGGER_*.
Returns:
  • XST_SUCCESS if the trigger level was set
  • XST_UART_CONFIG_ERROR if the trigger level could not be set, either the hardware does not support the FIFOs or FIFOs are not enabled
Note:
None.

int XUartNs550_SetOptions XUartNs550 InstancePtr,
u16  Options
 

Sets the options for the specified driver instance. The options are implemented as bit masks such that multiple options may be enabled or disabled simultaneously.

The GetOptions function may be called to retrieve the currently enabled options. The result is ORed in the desired new settings to be enabled and ANDed with the inverse to clear the settings to be disabled. The resulting value is then used as the options for the SetOption function call.

Parameters:
InstancePtr is a pointer to the XUartNs550 instance.
Options contains the options to be set which are bit masks contained in the file xuartns550.h and named XUN_OPTION_*.
Returns:
  • XST_SUCCESS if the options were set successfully.
  • XST_UART_CONFIG_ERROR if the options could not be set because the hardware does not support FIFOs
Note:
None.