Question 2
Consider the following code snippet:
#define TIMER_BASE 0x40010000
void configure_timer(){ uint32_t *config_reg = (uint32_t*)(TIMER_BASE + 0x00); uint8_t *status_reg = (uint8_t*)(TIMER_BASE + 0x04); uint16_t *counter_reg = (uint16_t*)(TIMER_BASE + 0x08);
*config_reg = 0x1; while((*status_reg & 0x1) == 0); *counter_reg = 0xFFFF;}What are the sizes of the config_reg, status_reg, and counter_reg registers, respectively?
Sizes of all the registers are 4-byte.
Sizes of ‘config_reg‘, ‘status_reg‘, and ‘counter_reg‘ are 4-byte, 1-byte, and 2- byte respectively.
Sizes of ‘config_reg‘, ‘status_reg‘, and ‘counter_reg‘ are 2-byte, 1-byte, and 2- byte respectively.
Sizes of ‘config_reg‘, ‘status_reg‘, and ‘counter_reg‘ are 1-byte, 2-byte, and 4- byte respectively.