You are given a pointer to a UART_ControlRegister struct representing a 32-bit hardware register.
The struct has the following bitfields:
struct UART_ControlRegister {
unsigned int baudrate : 4; // Bits 0-3
unsigned int tx_enable : 1; // Bit 4
unsigned int rx_enable : 1; // Bit 5
unsigned int tx_irq_en : 1; // Bit 6
unsigned int rx_irq_en : 1; // Bit 7
unsigned int parity_en : 1; // Bit 8
unsigned int stop_bits : 1; // Bit 9
unsigned int reserved : 22; // Bits 10-31
};
Example
Output:
baudrate = 9
tx_enable = 1
rx_enable = 1
tx_irq_en = 1
rx_irq_en = 0
parity_en = 1
stop_bits = 0
Input
Expected Output
baudrate = 9 tx_enable = 1 rx_enable = 1 tx_irq_en = 1 rx_irq_en = 0 parity_en = 1 stop_bits = 0