RTEMS 6.1-rc5
Loading...
Searching...
No Matches
Macros | Functions
Uartlite_v3_5

Macros

#define XUARTLITE_L_H   /* by using protection macros */
 
#define XPAR_XUARTLITE_USE_DCR_BRIDGE   0
 
#define XUL_RX_FIFO_OFFSET   0 /* receive FIFO, read only */
 
#define XUL_TX_FIFO_OFFSET   4 /* transmit FIFO, write only */
 
#define XUL_STATUS_REG_OFFSET   8 /* status register, read only */
 
#define XUL_CONTROL_REG_OFFSET   12 /* control reg, write only */
 
#define XUL_CR_ENABLE_INTR   0x10 /* enable interrupt */
 
#define XUL_CR_FIFO_RX_RESET   0x02 /* reset receive FIFO */
 
#define XUL_CR_FIFO_TX_RESET   0x01 /* reset transmit FIFO */
 
#define XUL_SR_PARITY_ERROR   0x80
 
#define XUL_SR_FRAMING_ERROR   0x40
 
#define XUL_SR_OVERRUN_ERROR   0x20
 
#define XUL_SR_INTR_ENABLED   0x10 /* interrupt enabled */
 
#define XUL_SR_TX_FIFO_FULL   0x08 /* transmit FIFO full */
 
#define XUL_SR_TX_FIFO_EMPTY   0x04 /* transmit FIFO empty */
 
#define XUL_SR_RX_FIFO_FULL   0x02 /* receive FIFO full */
 
#define XUL_SR_RX_FIFO_VALID_DATA   0x01 /* data in receive FIFO */
 
#define XUL_FIFO_SIZE   16
 
#define XUL_STOP_BITS   1
 
#define XUL_PARITY_NONE   0
 
#define XUL_PARITY_ODD   1
 
#define XUL_PARITY_EVEN   2
 
#define XUartLite_In32   Xil_In32
 
#define XUartLite_Out32   Xil_Out32
 
#define XUartLite_WriteReg(BaseAddress, RegOffset, Data)    XUartLite_Out32((BaseAddress) + (RegOffset), (u32)(Data))
 
#define XUartLite_ReadReg(BaseAddress, RegOffset)    XUartLite_In32((BaseAddress) + (RegOffset))
 
#define XUartLite_SetControlReg(BaseAddress, Mask)    XUartLite_WriteReg((BaseAddress), XUL_CONTROL_REG_OFFSET, (Mask))
 
#define XUartLite_GetStatusReg(BaseAddress)    XUartLite_ReadReg((BaseAddress), XUL_STATUS_REG_OFFSET)
 
#define XUartLite_IsReceiveEmpty(BaseAddress)
 
#define XUartLite_IsTransmitFull(BaseAddress)
 
#define XUartLite_IsIntrEnabled(BaseAddress)
 
#define XUartLite_EnableIntr(BaseAddress)    XUartLite_SetControlReg((BaseAddress), XUL_CR_ENABLE_INTR)
 
#define XUartLite_DisableIntr(BaseAddress)    XUartLite_SetControlReg((BaseAddress), 0)
 

Functions

void XUartLite_SendByte (UINTPTR BaseAddress, u8 Data)
 
u8 XUartLite_RecvByte (UINTPTR BaseAddress)
 

Detailed Description

This header file contains identifiers and low-level driver functions (or macros) that can be used to access the device. High-level driver functions are defined in xuartlite.h.

MODIFICATION HISTORY:

Ver   Who  Date     Changes
----- ---- -------- -------------------------------------------------------
1.00b rpm  04/25/02 First release
1.00b rpm  07/07/03 Removed references to XUartLite_GetControlReg macro
                    since the control register is write-only
1.12a mta  03/21/07 Updated to new coding style
1.13a sv   01/21/08 Updated driver to support access through DCR bus
2.00a ktn  10/20/09 Updated to use HAL Processor APIs. The macros have been
          renamed to remove _m from the name.
3.2   sk   11/10/15 Used UINTPTR instead of u32 for Baseaddress CR# 867425.
                    Changed the prototypes of XUartLite_SendByte,
                    XUartLite_RecvByte APIs.

This file contains low-level driver functions that can be used to access the device. The user should refer to the hardware device specification for more details of the device operation.

MODIFICATION HISTORY:

Ver   Who  Date     Changes
----- ---- -------- -----------------------------------------------
1.00b rpm  04/25/02 First release
1.12a rpm  07/16/07 Fixed arg type for RecvByte
2.00a ktn  10/20/09 The macros have been renamed to remove _m from the name.
3.2   sk   11/10/15 Used UINTPTR instead of u32 for Baseaddress CR# 867425.
                    Changed the prototypes of XUartLite_SendByte,
                    XUartLite_RecvByte APIs.

Macro Definition Documentation

◆ XUartLite_DisableIntr

#define XUartLite_DisableIntr (   BaseAddress)     XUartLite_SetControlReg((BaseAddress), 0)

Disable the device interrupt. We cannot read the control register, so we just clear all bits. Since the only other ones are the FIFO reset bits, this works without side effects.

Parameters
BaseAddressis the base address of the device
Returns
None.
Note
C-style Signature: void XUartLite_DisableIntr(u32 BaseAddress);

◆ XUartLite_EnableIntr

#define XUartLite_EnableIntr (   BaseAddress)     XUartLite_SetControlReg((BaseAddress), XUL_CR_ENABLE_INTR)

Enable the device interrupt. We cannot read the control register, so we just write the enable interrupt bit and clear all others. Since the only other ones are the FIFO reset bits, this works without side effects.

Parameters
BaseAddressis the base address of the device
Returns
None.
Note
C-style Signature: void XUartLite_EnableIntr(u32 BaseAddress);

◆ XUartLite_GetStatusReg

#define XUartLite_GetStatusReg (   BaseAddress)     XUartLite_ReadReg((BaseAddress), XUL_STATUS_REG_OFFSET)

Get the contents of the 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 XUartLite_GetStatusReg(u32 BaseAddress);

◆ XUartLite_IsIntrEnabled

#define XUartLite_IsIntrEnabled (   BaseAddress)
Value:
((XUartLite_GetStatusReg((BaseAddress)) & XUL_SR_INTR_ENABLED) == \
XUL_SR_INTR_ENABLED)
#define XUartLite_GetStatusReg(BaseAddress)
Definition: uartlite_l.h:207

Check to see if the interrupt is enabled.

Parameters
BaseAddressis the base address of the device
Returns
TRUE if the interrupt is enabled, FALSE otherwise.
Note
C-style Signature: int XUartLite_IsIntrEnabled(u32 BaseAddress);

◆ XUartLite_IsReceiveEmpty

#define XUartLite_IsReceiveEmpty (   BaseAddress)
Value:
((XUartLite_GetStatusReg((BaseAddress)) & XUL_SR_RX_FIFO_VALID_DATA) != \
XUL_SR_RX_FIFO_VALID_DATA)

Check to see if the 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 XUartLite_IsReceiveEmpty(u32 BaseAddress);

◆ XUartLite_IsTransmitFull

#define XUartLite_IsTransmitFull (   BaseAddress)
Value:
((XUartLite_GetStatusReg((BaseAddress)) & XUL_SR_TX_FIFO_FULL) == \
XUL_SR_TX_FIFO_FULL)

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 XUartLite_IsTransmitFull(u32 BaseAddress);

◆ XUartLite_ReadReg

#define XUartLite_ReadReg (   BaseAddress,
  RegOffset 
)     XUartLite_In32((BaseAddress) + (RegOffset))

Read a value from a UartLite register. A 32 bit read is performed.

Parameters
BaseAddressis the base address of the UartLite device.
RegOffsetis the register offset from the base to read from.
Returns
Data read from the register.
Note
C-style signature: u32 XUartLite_ReadReg(u32 BaseAddress, u32 RegOffset)

◆ XUartLite_SetControlReg

#define XUartLite_SetControlReg (   BaseAddress,
  Mask 
)     XUartLite_WriteReg((BaseAddress), XUL_CONTROL_REG_OFFSET, (Mask))

Set the contents of the control register. Use the XUL_CR_* constants defined above to create the bit-mask to be written to the register.

Parameters
BaseAddressis the base address of the device
Maskis the 32-bit value to write to the control register
Returns
None.
Note
C-style Signature: void XUartLite_SetControlReg(u32 BaseAddress, u32 Mask);

◆ XUartLite_WriteReg

#define XUartLite_WriteReg (   BaseAddress,
  RegOffset,
  Data 
)     XUartLite_Out32((BaseAddress) + (RegOffset), (u32)(Data))

Write a value to a UartLite register. A 32 bit write is performed.

Parameters
BaseAddressis the base address of the UartLite 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 XUartLite_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data)

Function Documentation

◆ XUartLite_RecvByte()

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

◆ XUartLite_SendByte()

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