diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2017-01-24 10:15:53 -0500 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2017-10-30 21:43:15 -0400 |
commit | f728559bf951b515be39d61f3ffd0eaae64b2b0d (patch) | |
tree | bacc0461d0fac54af57fe5938457998babab9323 /firmware/export/system.h | |
parent | 65e7617ab645b1680a31fbc6d8f231ca7408f05e (diff) | |
download | rockbox-f728559bf951b515be39d61f3ffd0eaae64b2b0d.tar.gz rockbox-f728559bf951b515be39d61f3ffd0eaae64b2b0d.zip |
Make atomic bit modification functions return previous value.
Change-Id: I19a94cf946735e1d9e51c3207cd82198fd4dfc1a
Diffstat (limited to 'firmware/export/system.h')
-rw-r--r-- | firmware/export/system.h | 17 |
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)) | |||
163 | uint32_t isolate_first_bit(uint32_t val) | 163 | uint32_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; |
167 | void bitmod16(volatile uint16_t *addr, uint16_t bits, uint16_t mask); | 167 | * return value is the previous value of *addr */ |
168 | void bitset16(volatile uint16_t *addr, uint16_t mask); | 168 | uint16_t bitmod16(volatile uint16_t *addr, uint16_t bits, uint16_t mask); |
169 | void bitclr16(volatile uint16_t *addr, uint16_t mask); | 169 | uint16_t bitset16(volatile uint16_t *addr, uint16_t mask); |
170 | 170 | uint16_t bitclr16(volatile uint16_t *addr, uint16_t mask); | |
171 | void bitmod32(volatile uint32_t *addr, uint32_t bits, uint32_t mask); | 171 | |
172 | void bitset32(volatile uint32_t *addr, uint32_t mask); | 172 | uint32_t bitmod32(volatile uint32_t *addr, uint32_t bits, uint32_t mask); |
173 | void bitclr32(volatile uint32_t *addr, uint32_t mask); | 173 | uint32_t bitset32(volatile uint32_t *addr, uint32_t mask); |
174 | uint32_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) |