diff options
author | jaseg <git@jaseg.net> | 2018-07-17 15:43:26 +0200 |
---|---|---|
committer | jaseg <git@jaseg.net> | 2018-07-17 15:43:26 +0200 |
commit | 6df66b77ba5b27bce5630694742f2dac57b8d3eb (patch) | |
tree | fc14370fdea41b6d7a672758aa89886b9107f78c /shared | |
parent | 90ce052d82daa86e1e86ab4dac7fbba0cdda8680 (diff) | |
download | olsndot-6df66b77ba5b27bce5630694742f2dac57b8d3eb.tar.gz olsndot-6df66b77ba5b27bce5630694742f2dac57b8d3eb.tar.bz2 olsndot-6df66b77ba5b27bce5630694742f2dac57b8d3eb.zip |
Isolate usb-serial-rs485 tree
Diffstat (limited to 'shared')
-rw-r--r-- | shared/README.md | 2 | ||||
-rw-r--r-- | shared/trace.c | 54 | ||||
-rw-r--r-- | shared/trace.h | 30 | ||||
-rw-r--r-- | shared/trace_stdio.c | 34 | ||||
-rw-r--r-- | shared/usart_stdio.c | 34 |
5 files changed, 0 insertions, 154 deletions
diff --git a/shared/README.md b/shared/README.md deleted file mode 100644 index 530a0f8..0000000 --- a/shared/README.md +++ /dev/null @@ -1,2 +0,0 @@ -This directory contains target independent code reused by 2 or more test -projects. _only_ target independent code diff --git a/shared/trace.c b/shared/trace.c deleted file mode 100644 index 9e05d9a..0000000 --- a/shared/trace.c +++ /dev/null @@ -1,54 +0,0 @@ -#include <stdint.h> -#include <libopencm3/cm3/common.h> -#include <libopencm3/cm3/memorymap.h> -#include <libopencm3/cm3/itm.h> -#include "trace.h" - -void trace_send_blocking8(int stimulus_port, char c) { - if (!(ITM_TER[0] & (1<<stimulus_port))) { - return; - } - while (!(ITM_STIM8(stimulus_port) & ITM_STIM_FIFOREADY)) - ; - ITM_STIM8(stimulus_port) = c; -} - -void trace_send8(int stimulus_port, char val) { - if (!(ITM_TER[0] & (1<<stimulus_port))) { - return; - } - ITM_STIM8(stimulus_port) = val; -} - -void trace_send_blocking16(int stimulus_port, uint16_t val) { - if (!(ITM_TER[0] & (1<<stimulus_port))) { - return; - } - while (!(ITM_STIM16(stimulus_port) & ITM_STIM_FIFOREADY)) - ; - ITM_STIM16(stimulus_port) = val; -} - -void trace_send16(int stimulus_port, uint16_t val) { - if (!(ITM_TER[0] & (1<<stimulus_port))) { - return; - } - ITM_STIM16(stimulus_port) = val; -} - - -void trace_send_blocking32(int stimulus_port, uint32_t val) { - if (!(ITM_TER[0] & (1<<stimulus_port))) { - return; - } - while (!(ITM_STIM32(stimulus_port) & ITM_STIM_FIFOREADY)) - ; - ITM_STIM32(stimulus_port) = val; -} - -void trace_send32(int stimulus_port, uint32_t val) { - if (!(ITM_TER[0] & (1<<stimulus_port))) { - return; - } - ITM_STIM32(stimulus_port) = val; -} diff --git a/shared/trace.h b/shared/trace.h deleted file mode 100644 index b18cc11..0000000 --- a/shared/trace.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * trace support - * Karl Palsson <karlp@tweak.net.au> - */ - -#ifndef TRACE_H -#define TRACE_H - -#include <stdint.h> - -#ifdef __cplusplus -extern "C" { -#endif - -void trace_send_blocking8(int stimulus_port, char c); -void trace_send8(int stimulus_port, char c); - -void trace_send_blocking16(int stimulus_port, uint16_t val); -void trace_send16(int stimulus_port, uint16_t val); - -void trace_send_blocking32(int stimulus_port, uint32_t val); -void trace_send32(int stimulus_port, uint32_t val); - - -#ifdef __cplusplus -} -#endif - -#endif /* TRACE_H */ - diff --git a/shared/trace_stdio.c b/shared/trace_stdio.c deleted file mode 100644 index 2710942..0000000 --- a/shared/trace_stdio.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * support for stdio output to a trace port - * Karl Palsson, 2014 <karlp@remake.is> - */ - -#include <errno.h> -#include <stdio.h> -#include <unistd.h> - -#include "trace.h" - -#ifndef STIMULUS_STDIO -#define STIMULUS_STDIO 0 -#endif - -int _write(int file, char *ptr, int len); -int _write(int file, char *ptr, int len) -{ - int i; - - if (file == STDOUT_FILENO || file == STDERR_FILENO) { - for (i = 0; i < len; i++) { - if (ptr[i] == '\n') { - trace_send_blocking8(STIMULUS_STDIO, '\r'); - } - trace_send_blocking8(STIMULUS_STDIO, ptr[i]); - } - return i; - } - errno = EIO; - return -1; -} - - diff --git a/shared/usart_stdio.c b/shared/usart_stdio.c deleted file mode 100644 index 6a6866e..0000000 --- a/shared/usart_stdio.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * support for stdio output to a usart - * Karl Palsson, 2015 <karlp@tweak.net.au> - */ - -#include <errno.h> -#include <stdio.h> -#include <unistd.h> - -#include <libopencm3/stm32/usart.h> - -#ifndef STDIO_USART -#define STDIO_USART USART1 -#endif - -int _write(int file, char *ptr, int len); -int _write(int file, char *ptr, int len) -{ - int i; - - if (file == STDOUT_FILENO || file == STDERR_FILENO) { - for (i = 0; i < len; i++) { - if (ptr[i] == '\n') { - usart_send_blocking(STDIO_USART, '\r'); - } - usart_send_blocking(STDIO_USART, ptr[i]); - } - return i; - } - errno = EIO; - return -1; -} - - |