summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2017-01-24 10:15:53 -0500
committerMichael Sevakis <jethead71@rockbox.org>2017-10-30 21:43:15 -0400
commitf728559bf951b515be39d61f3ffd0eaae64b2b0d (patch)
treebacc0461d0fac54af57fe5938457998babab9323 /firmware/export
parent65e7617ab645b1680a31fbc6d8f231ca7408f05e (diff)
downloadrockbox-f728559bf951b515be39d61f3ffd0eaae64b2b0d.tar.gz
rockbox-f728559bf951b515be39d61f3ffd0eaae64b2b0d.zip
Make atomic bit modification functions return previous value.
Change-Id: I19a94cf946735e1d9e51c3207cd82198fd4dfc1a
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/system.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/firmware/export/system.h b/firmware/export/system.h
index 911c9edf4b..c7f5a8112c 100644
--- a/firmware/export/system.h
+++ b/firmware/export/system.h
@@ -163,14 +163,15 @@ static inline __attribute__((always_inline))
163uint32_t isolate_first_bit(uint32_t val) 163uint32_t isolate_first_bit(uint32_t val)
164 { return val & -val; } 164 { return val & -val; }
165 165
166/* Functions to set and clear register or variable bits atomically */ 166/* Functions to set and clear register or variable bits atomically;
167void bitmod16(volatile uint16_t *addr, uint16_t bits, uint16_t mask); 167 * return value is the previous value of *addr */
168void bitset16(volatile uint16_t *addr, uint16_t mask); 168uint16_t bitmod16(volatile uint16_t *addr, uint16_t bits, uint16_t mask);
169void bitclr16(volatile uint16_t *addr, uint16_t mask); 169uint16_t bitset16(volatile uint16_t *addr, uint16_t mask);
170 170uint16_t bitclr16(volatile uint16_t *addr, uint16_t mask);
171void bitmod32(volatile uint32_t *addr, uint32_t bits, uint32_t mask); 171
172void bitset32(volatile uint32_t *addr, uint32_t mask); 172uint32_t bitmod32(volatile uint32_t *addr, uint32_t bits, uint32_t mask);
173void bitclr32(volatile uint32_t *addr, uint32_t mask); 173uint32_t bitset32(volatile uint32_t *addr, uint32_t mask);
174uint32_t bitclr32(volatile uint32_t *addr, uint32_t mask);
174 175
175/* gcc 3.4 changed the format of the constraints */ 176/* gcc 3.4 changed the format of the constraints */
176#if (__GNUC__ >= 3) && (__GNUC_MINOR__ > 3) || (__GNUC__ >= 4) 177#if (__GNUC__ >= 3) && (__GNUC_MINOR__ > 3) || (__GNUC__ >= 4)