Skip to content

Commit

Permalink
Add volatile qualifier
Browse files Browse the repository at this point in the history
This is needed to ensure that the memory mapped address it always read.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
  • Loading branch information
aggarg committed Oct 16, 2024
1 parent b3e6cff commit a5dcc18
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
[Oo]bj/
[Ll]og/
[Ll]ogs/
[Bb]uild/

# CodeWarrior temporary files
*.tdt
Expand Down
2 changes: 1 addition & 1 deletion FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/ns16550.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static void writeb( uint8_t b, uintptr_t addr )

void vOutNS16550( struct device *dev, unsigned char c )
{
uintptr_t addr = dev->addr;
volatile uintptr_t addr = dev->addr;

while ( (readb( addr + REG_LSR ) & LSR_THRE) == 0 ) {
/* busy wait */
Expand Down

0 comments on commit a5dcc18

Please sign in to comment.