![]() |
uartlite
Vitis Drivers API Documentation
|
Data Structures | |
| struct | XUartLite_Stats |
| Statistics for the XUartLite driver. More... | |
| struct | XUartLite_Buffer |
| Buffer descriptor for send and receive operations. More... | |
| struct | XUartLite_Config |
| Holds configuration information for the UART Lite device. More... | |
| struct | XUartLite |
| Driver instance data for the UART Lite. More... | |
Macros | |
| #define | XUartLite_UpdateStats(InstancePtr, StatusRegister) |
| Updates the statistics of the instance. More... | |
| #define | XUartLite_WriteReg(BaseAddress, RegOffset, Data) XUartLite_Out32((BaseAddress) + (RegOffset), (u32)(Data)) |
| Writes a value to a UartLite register. More... | |
| #define | XUartLite_ReadReg(BaseAddress, RegOffset) XUartLite_In32((BaseAddress) + (RegOffset)) |
| Reads a value from a UartLite register. More... | |
| #define | XUartLite_SetControlReg(BaseAddress, Mask) XUartLite_WriteReg((BaseAddress), XUL_CONTROL_REG_OFFSET, (Mask)) |
| Sets the contents of the control register. More... | |
| #define | XUartLite_GetStatusReg(BaseAddress) XUartLite_ReadReg((BaseAddress), XUL_STATUS_REG_OFFSET) |
| Returns the contents of the status register. More... | |
| #define | XUartLite_IsReceiveEmpty(BaseAddress) |
| Checks if the receiver has data. More... | |
| #define | XUartLite_IsTransmitFull(BaseAddress) |
| Checks if the transmitter is full. More... | |
| #define | XUartLite_IsIntrEnabled(BaseAddress) |
| Checks if the interrupt is enabled. More... | |
| #define | XUartLite_EnableIntr(BaseAddress) XUartLite_SetControlReg((BaseAddress), XUL_CR_ENABLE_INTR) |
| Enables the device interrupt. More... | |
| #define | XUartLite_DisableIntr(BaseAddress) XUartLite_SetControlReg((BaseAddress), 0) |
| Disables the device interrupt. More... | |
Typedefs | |
| typedef void(* | XUartLite_Handler )(void *CallBackRef, unsigned int ByteCount) |
| Defines the callback function type for send and receive operations. More... | |
Functions | |
| int | XUartLite_CfgInitialize (XUartLite *InstancePtr, XUartLite_Config *Config, UINTPTR EffectiveAddr) |
| Initializes a XUartLite instance. More... | |
| unsigned int | XUartLite_Send (XUartLite *InstancePtr, u8 *DataBufferPtr, unsigned int NumBytes) |
| Sends the specified buffer of data using the UART. More... | |
| unsigned int | XUartLite_Recv (XUartLite *InstancePtr, u8 *DataBufferPtr, unsigned int NumBytes) |
| Receives a specified number of bytes of data from the UART. More... | |
| void | XUartLite_ResetFifos (XUartLite *InstancePtr) |
| Resets the FIFOs, both transmit and receive, of the UART. More... | |
| int | XUartLite_IsSending (XUartLite *InstancePtr) |
| Determines if the specified UART is sending data. More... | |
| unsigned int | XUartLite_SendBuffer (XUartLite *InstancePtr) |
| Sends a previously specified buffer of data to the UART. More... | |
| unsigned int | XUartLite_ReceiveBuffer (XUartLite *InstancePtr) |
| Receives a previously specified buffer of data from the UART. More... | |
| u8 | XUartLite_GetSR (XUartLite *InstancePtr) |
| Reads the status register and updates the error stats before returning the status register value. More... | |
| int | XUartLite_Initialize (XUartLite *InstancePtr, UINTPTR BaseAddress) |
| Initializes a XUartLite instance. More... | |
| XUartLite_Config * | XUartLite_LookupConfig (UINTPTR BaseAddress) |
| Looks up the device configuration based on the unique device ID or base address. More... | |
| void | XUartLite_GetStats (XUartLite *InstancePtr, XUartLite_Stats *StatsPtr) |
| Returns a snapshot of the current statistics in the structure specified. More... | |
| void | XUartLite_ClearStats (XUartLite *InstancePtr) |
| Zeros the statistics for the given instance. More... | |
| int | XUartLite_SelfTest (XUartLite *InstancePtr) |
| Runs a self-test on the device hardware. More... | |
| void | XUartLite_EnableInterrupt (XUartLite *InstancePtr) |
| Enables the UART interrupt. More... | |
| void | XUartLite_DisableInterrupt (XUartLite *InstancePtr) |
| Disables the UART interrupt. More... | |
| void | XUartLite_SetRecvHandler (XUartLite *InstancePtr, XUartLite_Handler FuncPtr, void *CallBackRef) |
| Sets the receive callback handler. More... | |
| void | XUartLite_SetSendHandler (XUartLite *InstancePtr, XUartLite_Handler FuncPtr, void *CallBackRef) |
| Sets the send callback handler. More... | |
| void | XUartLite_InterruptHandler (XUartLite *InstancePtr) |
| Handles interrupts for the UART Lite driver. More... | |
| void | XUartLite_SendByte (UINTPTR BaseAddress, u8 Data) |
| Sends a single byte using the UART. More... | |
| u8 | XUartLite_RecvByte (UINTPTR BaseAddress) |
| Receives a single byte using the UART. More... | |
Variables | |
| XUartLite_Config | XUartLite_ConfigTable [XPAR_XUARTLITE_NUM_INSTANCES] |
| Holds the configuration table for UART Lite devices. More... | |
| XUartLite_Config | XUartLite_ConfigTable [] |
| Holds the configuration entry for each UART Lite instance. More... | |
DCR bus bridge configuration | |
Set to 1 if the UartLite device is accessed through a DCR bus connected to a bridge. | |
| #define | XPAR_XUARTLITE_USE_DCR_BRIDGE 0 |
| DCR bus bridge access flag. More... | |
UART Lite register offsets | |
| #define | XUL_RX_FIFO_OFFSET 0 |
| Receive FIFO, read only. More... | |
| #define | XUL_TX_FIFO_OFFSET 4 |
| Transmit FIFO, write only. More... | |
| #define | XUL_STATUS_REG_OFFSET 8 |
| Status register, read only. More... | |
| #define | XUL_CONTROL_REG_OFFSET 12 |
| Control register, write only. More... | |
Control register bit positions | |
| #define | XUL_CR_ENABLE_INTR 0x10 |
| Enable interrupt. More... | |
| #define | XUL_CR_FIFO_RX_RESET 0x02 |
| Reset receive FIFO. More... | |
| #define | XUL_CR_FIFO_TX_RESET 0x01 |
| Reset transmit FIFO. More... | |
Status register bit positions | |
| #define | XUL_SR_PARITY_ERROR 0x80 |
| Parity error detected. More... | |
| #define | XUL_SR_FRAMING_ERROR 0x40 |
| Framing error detected. More... | |
| #define | XUL_SR_OVERRUN_ERROR 0x20 |
| Overrun error detected. More... | |
| #define | XUL_SR_INTR_ENABLED 0x10 |
| Interrupt enabled. More... | |
| #define | XUL_SR_TX_FIFO_FULL 0x08 |
| Transmit FIFO full. More... | |
| #define | XUL_SR_TX_FIFO_EMPTY 0x04 |
| Transmit FIFO empty. More... | |
| #define | XUL_SR_RX_FIFO_FULL 0x02 |
| Receive FIFO full. More... | |
| #define | XUL_SR_RX_FIFO_VALID_DATA 0x01 |
| Data in receive FIFO. More... | |
FIFO and serial line constants | |
| #define | XUL_FIFO_SIZE 16 |
| Transmit/receive FIFO size in bytes. More... | |
| #define | XUL_STOP_BITS 1 |
| Stop bits, fixed at 1. More... | |
Parity definitions | |
| #define | XUL_PARITY_NONE 0 |
| No parity. More... | |
| #define | XUL_PARITY_ODD 1 |
| Odd parity. More... | |
| #define | XUL_PARITY_EVEN 2 |
| Even parity. More... | |
I/O access method macros | |
Define the appropriate I/O access method to memory mapped I/O or DCR. | |
| #define | XUartLite_In32 Xil_In32 |
| Memory-mapped 32-bit input operation. More... | |
| #define | XUartLite_Out32 Xil_Out32 |
| Memory-mapped 32-bit output operation. More... | |
| #define XPAR_XUARTLITE_USE_DCR_BRIDGE 0 |
DCR bus bridge access flag.
| #define XUartLite_DisableIntr | ( | BaseAddress | ) | XUartLite_SetControlReg((BaseAddress), 0) |
Disables the device interrupt.
The control register cannot be read, so this macro just clears all bits. Since the only other ones are the FIFO reset bits, this works without side effects.
| [in] | BaseAddress | Base address of the device. |
| #define XUartLite_EnableIntr | ( | BaseAddress | ) | XUartLite_SetControlReg((BaseAddress), XUL_CR_ENABLE_INTR) |
Enables the device interrupt.
The control register cannot be read, so this macro just writes the enable interrupt bit and clears all others. Since the only other ones are the FIFO reset bits, this works without side effects.
| [in] | BaseAddress | Base address of the device. |
| #define XUartLite_GetStatusReg | ( | BaseAddress | ) | XUartLite_ReadReg((BaseAddress), XUL_STATUS_REG_OFFSET) |
Returns the contents of the status register.
Use the XUL_SR_* constants defined above to interpret the bit-mask returned.
| [in] | BaseAddress | Base address of the device. |
Referenced by XUartLite_GetSR().
| #define XUartLite_In32 Xil_In32 |
Memory-mapped 32-bit input operation.
| #define XUartLite_IsIntrEnabled | ( | BaseAddress | ) |
Checks if the interrupt is enabled.
| [in] | BaseAddress | Base address of the device. |
| #define XUartLite_IsReceiveEmpty | ( | BaseAddress | ) |
Checks if the receiver has data.
| [in] | BaseAddress | Base address of the device. |
Referenced by XUartLite_RecvByte().
| #define XUartLite_IsTransmitFull | ( | BaseAddress | ) |
Checks if the transmitter is full.
| [in] | BaseAddress | Base address of the device. |
Referenced by XUartLite_SendByte().
| #define XUartLite_Out32 Xil_Out32 |
Memory-mapped 32-bit output operation.
| #define XUartLite_ReadReg | ( | BaseAddress, | |
| RegOffset | |||
| ) | XUartLite_In32((BaseAddress) + (RegOffset)) |
Reads a value from a UartLite register.
A 32 bit read is performed.
| [in] | BaseAddress | Base address of the UartLite device. |
| [in] | RegOffset | Register offset from the base to read from. |
Referenced by XUartLite_ReceiveBuffer(), and XUartLite_RecvByte().
| #define XUartLite_SetControlReg | ( | BaseAddress, | |
| Mask | |||
| ) | XUartLite_WriteReg((BaseAddress), XUL_CONTROL_REG_OFFSET, (Mask)) |
Sets the contents of the control register.
Use the XUL_CR_* constants defined above to create the bit-mask to be written to the register.
| [in] | BaseAddress | Base address of the device. |
| [in] | Mask | The 32-bit value to write to the control register. |
| #define XUartLite_UpdateStats | ( | InstancePtr, | |
| StatusRegister | |||
| ) |
Updates the statistics of the instance.
| [in] | InstancePtr | Pointer to the XUartLite instance. |
| [in] | StatusRegister | Contents of the UART status register to update the statistics with. |
Referenced by XUartLite_GetSR().
| #define XUartLite_WriteReg | ( | BaseAddress, | |
| RegOffset, | |||
| Data | |||
| ) | XUartLite_Out32((BaseAddress) + (RegOffset), (u32)(Data)) |
Writes a value to a UartLite register.
A 32 bit write is performed.
| [in] | BaseAddress | Base address of the UartLite device. |
| [in] | RegOffset | Register offset from the base to write to. |
| [in] | Data | Data written to the register. |
Referenced by XUartLite_CfgInitialize(), XUartLite_DisableInterrupt(), XUartLite_EnableInterrupt(), XUartLite_ReceiveBuffer(), XUartLite_Recv(), XUartLite_ResetFifos(), XUartLite_Send(), XUartLite_SendBuffer(), and XUartLite_SendByte().
| #define XUL_CONTROL_REG_OFFSET 12 |
Control register, write only.
Referenced by XUartLite_CfgInitialize(), XUartLite_DisableInterrupt(), XUartLite_EnableInterrupt(), XUartLite_ReceiveBuffer(), XUartLite_Recv(), XUartLite_ResetFifos(), XUartLite_Send(), and XUartLite_SendBuffer().
| #define XUL_CR_ENABLE_INTR 0x10 |
Enable interrupt.
Referenced by XUartLite_EnableInterrupt(), XUartLite_ReceiveBuffer(), XUartLite_Recv(), XUartLite_Send(), and XUartLite_SendBuffer().
| #define XUL_CR_FIFO_RX_RESET 0x02 |
Reset receive FIFO.
Referenced by XUartLite_ResetFifos().
| #define XUL_CR_FIFO_TX_RESET 0x01 |
Reset transmit FIFO.
Referenced by XUartLite_ResetFifos().
| #define XUL_FIFO_SIZE 16 |
Transmit/receive FIFO size in bytes.
Fixed to 16 in the UartLite IP, not configurable, and not used by the driver.
| #define XUL_PARITY_EVEN 2 |
Even parity.
| #define XUL_PARITY_NONE 0 |
No parity.
| #define XUL_PARITY_ODD 1 |
Odd parity.
| #define XUL_RX_FIFO_OFFSET 0 |
Receive FIFO, read only.
Referenced by XUartLite_ReceiveBuffer(), and XUartLite_RecvByte().
| #define XUL_SR_FRAMING_ERROR 0x40 |
Framing error detected.
| #define XUL_SR_INTR_ENABLED 0x10 |
Interrupt enabled.
Referenced by XUartLite_ResetFifos().
| #define XUL_SR_OVERRUN_ERROR 0x20 |
Overrun error detected.
| #define XUL_SR_PARITY_ERROR 0x80 |
Parity error detected.
| #define XUL_SR_RX_FIFO_FULL 0x02 |
Receive FIFO full.
Referenced by XUartLite_InterruptHandler().
| #define XUL_SR_RX_FIFO_VALID_DATA 0x01 |
Data in receive FIFO.
Referenced by XUartLite_InterruptHandler(), and XUartLite_ReceiveBuffer().
| #define XUL_SR_TX_FIFO_EMPTY 0x04 |
Transmit FIFO empty.
Referenced by XUartLite_InterruptHandler(), XUartLite_IsSending(), and XUartLite_SelfTest().
| #define XUL_SR_TX_FIFO_FULL 0x08 |
Transmit FIFO full.
Referenced by XUartLite_SendBuffer().
| #define XUL_STATUS_REG_OFFSET 8 |
Status register, read only.
| #define XUL_STOP_BITS 1 |
Stop bits, fixed at 1.
Baud, parity, and data bits are fixed on a per-instance basis.
| #define XUL_TX_FIFO_OFFSET 4 |
Transmit FIFO, write only.
Referenced by XUartLite_SendBuffer(), and XUartLite_SendByte().
| typedef void(* XUartLite_Handler)(void *CallBackRef, unsigned int ByteCount) |
Defines the callback function type for send and receive operations.
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.
| int XUartLite_CfgInitialize | ( | XUartLite * | InstancePtr, |
| XUartLite_Config * | Config, | ||
| UINTPTR | EffectiveAddr | ||
| ) |
Initializes a XUartLite instance.
The receive and transmit FIFOs of the UART are not flushed, so you may want to flush them. The hardware device does not have any way to disable the receiver such that any valid data may be present in the receive FIFO. This function disables the UART interrupt. The baudrate and format of the data are fixed in the hardware at hardware build time.
| [out] | InstancePtr | Pointer to the XUartLite instance. |
| [in] | Config | Reference to a structure containing information about a specific UART Lite 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. |
| [in] | EffectiveAddr | Device base address in the virtual memory address space. The caller is responsible for keeping the address mapping from EffectiveAddr to the device physical base address unchanged once this function is invoked. Unexpected errors may occur if the address mapping changes after this function is called. If address translation is not used, use Config->BaseAddress for this parameters, passing the physical address instead. |
References XUartLite::IsReady, XUartLite_Buffer::NextBytePtr, XUartLite::ReceiveBuffer, XUartLite::RecvHandler, XUartLite::RegBaseAddress, XUartLite_Buffer::RemainingBytes, XUartLite_Buffer::RequestedBytes, XUartLite::SendBuffer, XUartLite::SendHandler, XUartLite_ClearStats(), XUartLite_WriteReg, and XUL_CONTROL_REG_OFFSET.
Referenced by XUartLite_Initialize().
| void XUartLite_ClearStats | ( | XUartLite * | InstancePtr | ) |
Zeros the statistics for the given instance.
| [in,out] | InstancePtr | Pointer to the XUartLite instance. |
References XUartLite_Stats::CharactersReceived, XUartLite_Stats::CharactersTransmitted, XUartLite::IsReady, XUartLite_Stats::ReceiveFramingErrors, XUartLite_Stats::ReceiveInterrupts, XUartLite_Stats::ReceiveOverrunErrors, XUartLite_Stats::ReceiveParityErrors, XUartLite::Stats, and XUartLite_Stats::TransmitInterrupts.
Referenced by XUartLite_CfgInitialize().
| void XUartLite_DisableInterrupt | ( | XUartLite * | InstancePtr | ) |
Disables the UART interrupt.
After calling this function, data may still be received by the UART but no interrupt is generated since the hardware device has no way to disable the receiver.
| [in] | InstancePtr | Pointer to the XUartLite instance. |
References XUartLite::IsReady, XUartLite::RegBaseAddress, XUartLite_WriteReg, and XUL_CONTROL_REG_OFFSET.
| void XUartLite_EnableInterrupt | ( | XUartLite * | InstancePtr | ) |
Enables the UART interrupt.
An interrupt occurs when data is received or data has been transmitted. The device contains 16 byte receive and transmit FIFOs such that an interrupt is generated anytime there is data in the receive FIFO and when the transmit FIFO transitions from not empty to empty.
| [in] | InstancePtr | Pointer to the XUartLite instance. |
References XUartLite::IsReady, XUartLite::RegBaseAddress, XUartLite_WriteReg, XUL_CONTROL_REG_OFFSET, and XUL_CR_ENABLE_INTR.
Referenced by UartLiteIntrExample().
| u8 XUartLite_GetSR | ( | XUartLite * | InstancePtr | ) |
Reads the status register and updates the error stats before returning the status register value.
The status register is a clear on read register, so the errors if occurred have to be recorded every time the status register is read. This function is designed to be an internal function for the XUartLite component such that it may be called from wherever the status register needs to be read from the other driver functions.
| [in] | InstancePtr | Pointer to the XUartLite instance. |
References XUartLite::RegBaseAddress, XUartLite_GetStatusReg, and XUartLite_UpdateStats.
Referenced by XUartLite_InterruptHandler(), XUartLite_IsSending(), XUartLite_ReceiveBuffer(), XUartLite_Recv(), XUartLite_ResetFifos(), XUartLite_SelfTest(), XUartLite_Send(), and XUartLite_SendBuffer().
| void XUartLite_GetStats | ( | XUartLite * | InstancePtr, |
| XUartLite_Stats * | StatsPtr | ||
| ) |
Returns a snapshot of the current statistics in the structure specified.
| [in] | InstancePtr | Pointer to the XUartLite instance. |
| [out] | StatsPtr | Pointer to a XUartLiteStats structure to where the statistics are to be copied. |
References XUartLite_Stats::CharactersReceived, XUartLite_Stats::CharactersTransmitted, XUartLite::IsReady, XUartLite_Stats::ReceiveFramingErrors, XUartLite_Stats::ReceiveInterrupts, XUartLite_Stats::ReceiveOverrunErrors, XUartLite_Stats::ReceiveParityErrors, XUartLite::Stats, and XUartLite_Stats::TransmitInterrupts.
| int XUartLite_Initialize | ( | XUartLite * | InstancePtr, |
| UINTPTR | BaseAddress | ||
| ) |
Initializes a XUartLite instance.
The receive and transmit FIFOs of the UART are not flushed, so they may be flushed if desired. The hardware device does not have any way to disable the receiver such that any valid data may be present in the receive FIFO. This function disables the UART interrupt. The baudrate and format of the data are fixed in the hardware at hardware build time.
| [in] | InstancePtr | Pointer to the XUartLite instance. |
| [in] | BaseAddress | Base address of the device. |
References XUartLite_Config::RegBaseAddr, XUartLite_CfgInitialize(), and XUartLite_LookupConfig().
Referenced by UartLiteIntrExample(), UartLitePolledExample(), and UartLiteSelfTestExample().
| void XUartLite_InterruptHandler | ( | XUartLite * | InstancePtr | ) |
Handles interrupts for the UART Lite driver.
It must be connected to an interrupt system 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 caller must ensure this occurs.
| [in] | InstancePtr | Pointer to the instance of the UART that the interrupt is for. |
References XUartLite_Buffer::RequestedBytes, XUartLite::SendBuffer, XUartLite_GetSR(), XUL_SR_RX_FIFO_FULL, XUL_SR_RX_FIFO_VALID_DATA, and XUL_SR_TX_FIFO_EMPTY.
Referenced by UartLiteIntrExample().
| int XUartLite_IsSending | ( | XUartLite * | InstancePtr | ) |
Determines if the specified UART is sending data.
If the transmitter register is not empty, it is sending data.
| [in] | InstancePtr | Pointer to the XUartLite instance. |
References XUartLite_GetSR(), and XUL_SR_TX_FIFO_EMPTY.
| XUartLite_Config * XUartLite_LookupConfig | ( | UINTPTR | BaseAddress | ) |
Looks up the device configuration based on the unique device ID or base address.
The XUartLite_ConfigTable[] contains the configuration info for each device in the system.
| [in] | BaseAddress | Base address of the device. |
References XUartLite_Config::Name, and XUartLite_ConfigTable.
Referenced by UartLiteIntrExample(), and XUartLite_Initialize().
| unsigned int XUartLite_ReceiveBuffer | ( | XUartLite * | InstancePtr | ) |
Receives a previously specified buffer of data from the UART.
The buffer is specified beforehand by setting up the instance variables of the instance. This function is designed to be an internal function for the XUartLite component such that it may be called from a shell function that sets up the buffer or from an interrupt handler.
It attempts to receive a specified number of bytes of data from the UART and store it into the specified buffer. It is designed for either polled or interrupt driven modes. It is non-blocking such that it returns if there is no data already received by the UART.
In a polled mode, this function only receives 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 starts receiving and then the interrupt handler of the driver continues until the buffer has been received. A callback function, as specified by the application, is called to indicate the completion of receiving the buffer or when any receive errors or timeouts occur.
| [in,out] | InstancePtr | Pointer to the XUartLite instance. |
References XUartLite_Stats::CharactersReceived, XUartLite_Buffer::NextBytePtr, ReceiveBuffer, XUartLite::ReceiveBuffer, XUartLite::RegBaseAddress, XUartLite_Buffer::RemainingBytes, XUartLite::Stats, XUartLite_GetSR(), XUartLite_ReadReg, XUartLite_WriteReg, XUL_CONTROL_REG_OFFSET, XUL_CR_ENABLE_INTR, XUL_RX_FIFO_OFFSET, and XUL_SR_RX_FIFO_VALID_DATA.
Referenced by XUartLite_Recv().
| unsigned int XUartLite_Recv | ( | XUartLite * | InstancePtr, |
| u8 * | DataBufferPtr, | ||
| unsigned int | NumBytes | ||
| ) |
Receives a specified number of bytes of data from the UART.
This function attempts to receive the data and store it into the specified buffer. It is designed for either polled or interrupt driven modes. It is non-blocking such that it returns if no data has already been received by the UART.
In a polled mode, this function only receives as much data as the UART can buffer in the FIFO. 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 starts receiving and then the interrupt handler of the driver continues receiving data until the buffer has been received. A callback function, as specified by the application, is called to indicate the completion of receiving the buffer or when any receive errors or timeouts occur.
| [in,out] | InstancePtr | Pointer to the XUartLite instance. |
| [out] | DataBufferPtr | Pointer to buffer to receive data into. |
| [in] | NumBytes | Number of bytes to receive. A value of zero stops a previous receive operation that is in progress in interrupt mode. |
References XUartLite::IsReady, XUartLite_Buffer::NextBytePtr, XUartLite::ReceiveBuffer, XUartLite::RegBaseAddress, XUartLite_Buffer::RemainingBytes, XUartLite_Buffer::RequestedBytes, XUartLite_GetSR(), XUartLite_ReceiveBuffer(), XUartLite_WriteReg, XUL_CONTROL_REG_OFFSET, and XUL_CR_ENABLE_INTR.
Referenced by UartLiteIntrExample(), and UartLitePolledExample().
| u8 XUartLite_RecvByte | ( | UINTPTR | BaseAddress | ) |
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.
| [in] | BaseAddress | Base address of the device. |
References XUartLite_IsReceiveEmpty, XUartLite_ReadReg, and XUL_RX_FIFO_OFFSET.
Referenced by UartLiteLowLevelExample().
| void XUartLite_ResetFifos | ( | XUartLite * | InstancePtr | ) |
Resets the FIFOs, both transmit and receive, of the UART.
The FIFOs are emptied. Since the UART does not have any way to disable it from receiving data, it may be necessary for the application to reset the FIFOs to get rid of any unwanted data.
| [in] | InstancePtr | Pointer to the XUartLite instance. |
References XUartLite::IsReady, XUartLite::RegBaseAddress, XUartLite_GetSR(), XUartLite_WriteReg, XUL_CONTROL_REG_OFFSET, XUL_CR_FIFO_RX_RESET, XUL_CR_FIFO_TX_RESET, and XUL_SR_INTR_ENABLED.
Referenced by XUartLite_SelfTest().
| int XUartLite_SelfTest | ( | XUartLite * | InstancePtr | ) |
Runs a self-test on the device hardware.
Since there is no way to perform a loopback in the hardware, this test can only check the state of the status register to verify it is correct. This test assumes that the hardware device is still in its reset state, but has been initialized with the Initialize function.
| [in] | InstancePtr | Pointer to the XUartLite instance. |
References XUartLite::IsReady, XUartLite_GetSR(), XUartLite_ResetFifos(), and XUL_SR_TX_FIFO_EMPTY.
Referenced by UartLiteIntrExample(), UartLitePolledExample(), and UartLiteSelfTestExample().
| unsigned int XUartLite_Send | ( | XUartLite * | InstancePtr, |
| u8 * | DataBufferPtr, | ||
| unsigned int | NumBytes | ||
| ) |
Sends the specified buffer of data using the UART.
This function operates in either polled or interrupt driven modes. It is non-blocking such that it returns before the data has been sent by the UART. If the UART is busy sending data, it returns and indicates zero bytes were sent.
In a polled mode, this function only sends as much data as the UART can buffer in the FIFO. The application may need to call it repeatedly to send a buffer.
In interrupt mode, this function starts sending the specified buffer and then the interrupt handler of the driver continues sending data until the buffer has been sent. A callback function, as specified by the application, is called to indicate the completion of sending the buffer.
| [in,out] | InstancePtr | Pointer to the XUartLite instance. |
| [in] | DataBufferPtr | Pointer to a buffer of data to send. |
| [in] | NumBytes | Number of bytes to send. A value of zero stops a previous send operation that is in progress in interrupt mode. Any data that was already put into the transmit FIFO is sent. |
References XUartLite::IsReady, XUartLite_Buffer::NextBytePtr, XUartLite::RegBaseAddress, XUartLite_Buffer::RemainingBytes, XUartLite_Buffer::RequestedBytes, XUartLite::SendBuffer, XUartLite_GetSR(), XUartLite_SendBuffer(), XUartLite_WriteReg, XUL_CONTROL_REG_OFFSET, and XUL_CR_ENABLE_INTR.
Referenced by UartLiteIntrExample(), and UartLitePolledExample().
| unsigned int XUartLite_SendBuffer | ( | XUartLite * | InstancePtr | ) |
Sends a previously specified buffer of data to the UART.
The buffer is specified beforehand by setting up the instance variables of the instance. This function is designed to be an internal function for the XUartLite component such that it may be called from a shell function that sets up the buffer or from an interrupt handler.
It sends the specified buffer of data to the UART in either polled or interrupt driven modes. It is non-blocking such that it returns before the data has been sent by the UART.
In a polled mode, this function only sends as much data as the UART can buffer, either in the transmitter or in the FIFO if present and enabled. The application may need to call it repeatedly to send a buffer.
In interrupt mode, this function starts sending the specified buffer and then the interrupt handler of the driver continues until the buffer has been sent. A callback function, as specified by the application, is called to indicate the completion of sending the buffer.
| [in,out] | InstancePtr | Pointer to the XUartLite instance. |
References XUartLite_Stats::CharactersTransmitted, XUartLite_Buffer::NextBytePtr, XUartLite::RegBaseAddress, XUartLite_Buffer::RemainingBytes, SendBuffer, XUartLite::SendBuffer, XUartLite::Stats, XUartLite_GetSR(), XUartLite_WriteReg, XUL_CONTROL_REG_OFFSET, XUL_CR_ENABLE_INTR, XUL_SR_TX_FIFO_FULL, and XUL_TX_FIFO_OFFSET.
Referenced by XUartLite_Send().
| void XUartLite_SendByte | ( | UINTPTR | BaseAddress, |
| u8 | Data | ||
| ) |
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.
| [in] | BaseAddress | Base address of the device. |
| [in] | Data | Byte of data to send. |
References XUartLite_IsTransmitFull, XUartLite_WriteReg, and XUL_TX_FIFO_OFFSET.
Referenced by UartLiteLowLevelExample().
| void XUartLite_SetRecvHandler | ( | XUartLite * | InstancePtr, |
| XUartLite_Handler | FuncPtr, | ||
| void * | CallBackRef | ||
| ) |
Sets the receive callback handler.
This function sets the handler called when an event (interrupt) occurs in the driver. The handler allows application-specific processing.
| [in,out] | InstancePtr | Pointer to the XUartLite instance. |
| [in] | FuncPtr | Pointer to the callback function. |
| [in] | CallBackRef | Upper layer callback reference passed back when the callback function is invoked. |
References XUartLite::IsReady, XUartLite::RecvCallBackRef, and XUartLite::RecvHandler.
Referenced by UartLiteIntrExample().
| void XUartLite_SetSendHandler | ( | XUartLite * | InstancePtr, |
| XUartLite_Handler | FuncPtr, | ||
| void * | CallBackRef | ||
| ) |
Sets the send callback handler.
This function sets the handler called when an event (interrupt) occurs in the driver. The handler allows application-specific processing.
| [in,out] | InstancePtr | Pointer to the XUartLite instance. |
| [in] | FuncPtr | Pointer to the callback function. |
| [in] | CallBackRef | Upper layer callback reference passed back when the callback function is invoked. |
References XUartLite::IsReady, XUartLite::SendCallBackRef, and XUartLite::SendHandler.
Referenced by UartLiteIntrExample().
| XUartLite_Config XUartLite_ConfigTable[XPAR_XUARTLITE_NUM_INSTANCES] |
Holds the configuration table for UART Lite devices.
Holds the configuration entry for each UART Lite instance.
Referenced by XUartLite_LookupConfig().
| XUartLite_Config XUartLite_ConfigTable[] |
Holds the configuration entry for each UART Lite instance.
Holds the configuration entry for each UART Lite instance.
Referenced by XUartLite_LookupConfig().