#include "rpp/rpp.h"
#if rppCONFIG_INCLUDE_SDR == 1
-#include <stdio.h> // vsnprintf() & (printf() & putchar())
+#include <stdio.h> // vsnprintf()
#include <ctype.h> // isprint()
#include <string.h> // strncmp()
#include <stdarg.h> // va_start, va_end
#if rppCONFIG_DRV == 1
#include "drv/drv.h"
-#else
+#elif defined(FREERTOS_POSIX)
#include <stdlib.h> // malloc()
-#define rpp_sci_putc putchar
-#define rpp_sci_printf printf
+#include "lib/os/rpp_support.c"
#endif
static const char* prompt = "--> ";
while(TRUE) {
// Get one character from the user
- #if rppCONFIG_DRV == 1
if(rpp_sci_read_nb(1, &input) != SUCCESS) {
- #else // FIXME: In POSIX simulation this line doesn't work.
- if(rpp_sci_read_nb(1, &input) != SUCCESS) {
- #endif
- vTaskDelay(10);
+ vTaskDelay(100 / portTICK_RATE_MS);
continue;
}
// Stop flushing if one character is received
if(show_flushing) {
rpp_sdr_show(FALSE);
- vTaskDelay(10);
+ vTaskDelay(100 / portTICK_RATE_MS);
rpp_sci_printf("%s", newline);
rpp_sci_printf("%s", prompt);
continue;
memory_size = RPP_SDR_ADDR_END - RPP_SDR_ADDR_START + 1;
memory_start = (uint8_t*)RPP_SDR_ADDR_START;
memory_end = (uint8_t*)RPP_SDR_ADDR_END;
- #else
+ #elif defined(FREERTOS_POSIX)
memory_size = 1024*1024; // Allocate 1MB for test
memory_start = (uint8_t*)malloc(memory_size);
memory_end = (uint8_t*)(memory_start + memory_size - 1);
return FAILURE;
}
+ // Don't even try if memory is full
+ if(memory_current == memory_end) {
+ return FAILURE;
+ }
+
/// Format user string
char str[MAX_BUFFER_LEN];
int length = -1;