diff options
author | Karl Palsson <karlp@tweak.net.au> | 2015-10-16 21:56:42 +0000 |
---|---|---|
committer | Karl Palsson <karlp@tweak.net.au> | 2015-10-17 02:15:58 +0000 |
commit | 8d538b3935842204c7a545184df302958fc2015d (patch) | |
tree | 94feaf5cb9d44ba2cfb2ada45e2cd9e9cdcaf7ee /shared/trace.c | |
parent | 0bcc5d5efd70ed4564c141a7f38f78f52ea088a0 (diff) | |
download | olsndot-8d538b3935842204c7a545184df302958fc2015d.tar.gz olsndot-8d538b3935842204c7a545184df302958fc2015d.tar.bz2 olsndot-8d538b3935842204c7a545184df302958fc2015d.zip |
stub adc on/off test code.
Needs a pot on PA0, should get the temperature input working as well.
Diffstat (limited to 'shared/trace.c')
-rw-r--r-- | shared/trace.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/shared/trace.c b/shared/trace.c new file mode 100644 index 0000000..9e05d9a --- /dev/null +++ b/shared/trace.c @@ -0,0 +1,54 @@ +#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; +} |