diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2021-05-08 11:55:12 -0400 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2021-05-08 11:55:12 -0400 |
commit | d2f50fb9259a3142fa6b319a7a735a0e19355d01 (patch) | |
tree | 920d579453ca23cbda5323b865b72e3a9d3c255d /source | |
parent | 4a0fb43d375bd095643ea50cf9b09dae6515b20e (diff) |
include dsp lib; split timers; user message
Diffstat (limited to 'source')
-rw-r--r-- | source/main.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/main.cpp b/source/main.cpp index e151a3d..aaf268a 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -99,6 +99,9 @@ static unsigned char elf_file_store[MAX_ELF_FILE_SIZE]; __attribute__((section(".convdata"))) static ELF::Entry elf_entry = nullptr; +static char userMessageBuffer[128]; +static unsigned char userMessageSize = 0; + __attribute__((section(".convcode"))) static void conversion_unprivileged_main(); @@ -187,6 +190,7 @@ THD_FUNCTION(communicationThread, arg) // 'S' - Stop conversion. // 's' - Get latest block of conversion results. // 't' - Get latest block of conversion input. + // 'u' - Get user message. // 'W' - Start signal generator (siggen). // 'w' - Stop siggen. @@ -361,6 +365,10 @@ THD_FUNCTION(communicationThread, arg) } break; + case 'u': + USBSerial::write(reinterpret_cast<uint8_t *>(userMessageBuffer), userMessageSize); + break; + case 'W': DAC::start(1, samplesSigGen.data(), samplesSigGen.size()); break; @@ -648,6 +656,17 @@ void port_syscall(struct port_extctx *ctxp, uint32_t n) case 3: ctxp->r0 = ADC::readAlt(0); break; + case 4: + { + const char *str = reinterpret_cast<const char *>(ctxp->r0); + auto src = str; + auto dst = userMessageBuffer; + while (*src) + *dst++ = *src++; + *dst = '\0'; + userMessageSize = src - str; + } + break; default: while (1); break; |