diff options
| author | Evan Lojewski <github@meklort.com> | 2020-02-17 20:47:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-17 20:47:13 -0700 |
| commit | 23b478f335cd622049ad17f1f7ca4f0641200705 (patch) | |
| tree | 2243e00ad65259233171f3fbc97eb898c806af3e /libs/printf | |
| parent | d2419a287fc52929c351fb7fed54bae323fedc54 (diff) | |
| download | bcm5719-ortega-23b478f335cd622049ad17f1f7ca4f0641200705.tar.gz bcm5719-ortega-23b478f335cd622049ad17f1f7ca4f0641200705.zip | |
printf: Remove nvm access from the ape as it triggers a race condition when the rx cpu is restarted. (#35)
Rather than print directly, the APE now using the host debug console only for printf.
The RX cpu (function 0 only) uses the debug console and forwards it over SPI when new data is available.
Diffstat (limited to 'libs/printf')
| -rw-r--r-- | libs/printf/ape_putchar.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libs/printf/ape_putchar.c b/libs/printf/ape_putchar.c index 550222e..ea96a89 100644 --- a/libs/printf/ape_putchar.c +++ b/libs/printf/ape_putchar.c @@ -44,26 +44,24 @@ #include <printf.h> #include <em100_putchar.h> -#include <APE_DEBUG.h> +#include <APE_SHM.h> void _putchar(char character) { - uint32_t write_pointer = DEBUG.WritePointer.r32; + uint32_t write_pointer = SHM.RcpuWritePointer.r32; uint32_t word_pointer = write_pointer / 4; uint32_t byte_index = write_pointer % 4; uint32_t byte_mask = 0xFF << (byte_index * 8); - uint32_t new_word = DEBUG.Buffer[word_pointer].r32 & ~byte_mask; + uint32_t new_word = SHM.RcpuPrintfBuffer[word_pointer].r32 & ~byte_mask; new_word |= character << (byte_index * 8); - DEBUG.Buffer[word_pointer].r32 = new_word; + SHM.RcpuPrintfBuffer[word_pointer].r32 = new_word; write_pointer++; - if(write_pointer >= sizeof(DEBUG.Buffer)) + if(write_pointer >= sizeof(SHM.RcpuPrintfBuffer)) { write_pointer = 0; } - DEBUG.WritePointer.r32 = write_pointer; - - em100_putchar(character); + SHM.RcpuWritePointer.r32 = write_pointer; } |

