Usage of Xilinix Built in UART Function to Bitmask certain Value

81 Views Asked by At

I am using the Xilinx uartps data sheet in order to write functions to disable and enable Flow Control For UART. I found the appropriate bitmask defined in the data sheet, however I am not sure which built in function I should call with this mask in order to pass this bit mask to.

Flow Control Bit Mask

I thought initially it may be this function, Set Options Function

However upon closer inspection, it takes a u16 as an argument and the bitmask I want to use is a u20. Anyone familiar with this library, what function do I call with the bit mask in order enable flow control

Here is a link to the datasheet as well.

https://xilinx.github.io/embeddedsw.github.io/uartps/doc/html/api/group__uartps__v3__11.html#gad74cdb596f414bee06ebd9159f496cef

1

There are 1 best solutions below

0
On

You are correct in what you are using. The masks have a hex "0" more than the 16bits they should represent, but if you look at the options, this bit is never used.

Configuration options #define XUARTPS_OPTION_SET_BREAK 0x0080U These constants specify the options that may be set or retrieved with the driver, each is a unique bit mask such that multiple options may be specified.

#define     XUARTPS_OPTION_STOP_BREAK   0x0040U
    Stops break transmission.
 
#define     XUARTPS_OPTION_RESET_TMOUT   0x0020U
    Reset the receive timeout.
 
#define     XUARTPS_OPTION_RESET_TX   0x0010U
    Reset the transmitter.
 
#define     XUARTPS_OPTION_RESET_RX   0x0008U
    Reset the receiver.
 
#define     XUARTPS_OPTION_ASSERT_RTS   0x0004U
    Assert the RTS bit.
 
#define     XUARTPS_OPTION_ASSERT_DTR   0x0002U
    Assert the DTR bit.
 
#define     XUARTPS_OPTION_SET_FCM   0x0001U
    Turn on flow control mode. 

This means that you might get a warning when using such flags, but you'll get the result you want anyway.