diff options
author | Karl Palsson <karlp@etactica.com> | 2021-09-24 12:24:08 +0200 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2022-01-26 23:40:29 +0100 |
commit | db8607216cf2d75fdf77aec524c6af91984ca48d (patch) | |
tree | 74fd585bc0ded3ab218c96e41941ed69c8fb93c2 | |
parent | 9cdb6ccf05015fe5c4b87e975a86740677584a2a (diff) |
debug: add overload for writing floats to stimulus ports
Overload all the things!
Signed-off-by: Karl Palsson <karlp@etactica.com>
-rw-r--r-- | cortex_m/debug.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cortex_m/debug.h b/cortex_m/debug.h index 7117309..d935d7b 100644 --- a/cortex_m/debug.h +++ b/cortex_m/debug.h @@ -6,6 +6,7 @@ struct ITM_reg_t { union { + volatile float f32; volatile uint32_t u32; volatile uint16_t u16; volatile uint8_t u8; @@ -52,6 +53,14 @@ struct ITM_reg_t { ; this->STIM[stim].u32 = data; } + void stim_blocking(unsigned stim, float data) { + if (!(this->TER[0] & (1<<stim))) { + return; + } + while (!(this->STIM[stim].u32 & 1)) + ; + this->STIM[stim].f32 = data; + } }; struct DWT_reg_t { |