Question
Embedded System Programming You have register addresses defined #define UART_STATUS (*((volatile u32*)(0xE0001000U + 0x002CU))) #define UART_BAUD (*((volatile u32*)(0xE0001000U + 0x0018U))) #define RX (*((volatile u32*)(0xE0001000U +0x0030U)))
Embedded System Programming
You have register addresses defined
#define UART_STATUS (*((volatile u32*)(0xE0001000U + 0x002CU)))
#define UART_BAUD (*((volatile u32*)(0xE0001000U + 0x0018U)))
#define RX (*((volatile u32*)(0xE0001000U +0x0030U)))
and you have bits from bit0 to bit16 in usart status register where the second bit (bit1, RXEMPTY) is set if the receive buffer RX_FIFO is empty. RX_FIFO is eight bit wide value (bits [0:7] in RX)
#define TNFUL 0x00004000U /**< TX FIFO Nearly Full Status */
#define TTRIG 0x00002000U /**< TX FIFO Trigger Status */
#define FLOWDEL 0x00001000U /**< RX FIFO fill over flow delay */
#define TACTIVE 0x00000800U /**< TX active */
#define RACTIVE 0x00000400U /**< RX active */
#define TXFULL 0x00000010U /**< TX FIFO full */
#define TXEMPTY 0x00000008U /**< TX FIFO empty */
#define RXFULL 0x00000004U /**< RX FIFO full */
#define RXEMPTY 0x00000002U /**< RX FIFO empty */
#define RXOVR 0x00000001U /**< RX FIFO fill over trigger */
Construct a function that checks if FIFO is not empty, and if not save the contents in your own receive buffer. Fill buffer until you get a character q to RX_buffer.
Construct preferably macro to check RXEMPTY bit in UART_STATUS or if you cannot use directly in code bit manipulation.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started