Skip to content

Commit

Permalink
sw: Thread-safe putchar() function
Browse files Browse the repository at this point in the history
  • Loading branch information
colluca committed Jul 19, 2024
1 parent 8d9229d commit d0c0e2f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions target/snitch_cluster/sw/runtime/rtl/src/putchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ void _putchar(char character) {
buf->hdr.syscall_mem[2] = (uintptr_t)&buf->data; // buffer
buf->hdr.syscall_mem[3] = buf->hdr.size; // length

snrt_mutex_acquire(snrt_mutex());
tohost = (uintptr_t)buf->hdr.syscall_mem;
while (fromhost == 0)
;
fromhost = 0;
snrt_mutex_release(snrt_mutex());

buf->hdr.size = 0;
}
Expand Down

0 comments on commit d0c0e2f

Please sign in to comment.