diff options
author | Ivan Dimitrov <ivand@hobbylab.org> | 2017-09-06 21:08:31 +0300 |
---|---|---|
committer | Ivan Dimitrov <ivand@hobbylab.org> | 2017-09-06 21:08:31 +0300 |
commit | 33cdaf686752b3a97894b6d6e144135334e0d022 (patch) | |
tree | 72aebf93c9bf3fe3f03417cbaf4cf8a3e203b043 | |
parent | 2a3565cd9ac708bd57f6fded98b1b8add6ee195d (diff) | |
download | cforth-33cdaf686752b3a97894b6d6e144135334e0d022.tar.gz |
Usage notes are added
-rw-r--r-- | src/cpu/arm/cortex-m3/bitband.fth | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cpu/arm/cortex-m3/bitband.fth b/src/cpu/arm/cortex-m3/bitband.fth index ec4cf6b..e919cf4 100644 --- a/src/cpu/arm/cortex-m3/bitband.fth +++ b/src/cpu/arm/cortex-m3/bitband.fth @@ -5,16 +5,21 @@ \ using a single LDR instruction. It also enables individual bits to be toggled \ without performing a read-modify-write sequence of instructions. +\ Usage: +\ variable x +\ 0 x ! +\ x 0 BITBAND 1 swap c! x @ . + 1 #28 shift 1- constant BITBAND.BASEMASK_ \ covers the offset BITBAND.BASEMASK_ invert constant BITBAND.BASEMASK \ covers only the page \ bit_word_offset is the position of the target bit in the bit-band memory region. $2000000 constant BITBAND.OFFSET -: BITBAND ( addr bit -- aliasaddress ) +: BITBAND ( addr bit -- aliasaddress ) $4 * \ offest caused by the bit swap dup \ we need to split the addr is two parts - \ get the bit_band_base - the starting address of the alias region. + \ get the bit_band_base - the starting address of the alias region. BITBAND.BASEMASK and swap \ get the byte_offset - the number of the byte in the bit-band region that |