12 Commits

Author SHA1 Message Date
Karl Palsson
ba9cb7dc5d minor stylecheck cleanups 2016-02-29 21:30:31 +00:00
fenugrec
1d36685759 Cortex: interrupt handling to use uint32_t instead of bool.
This is more in line with the actual hardware (u32 registers), and will still
work if PRIMASK or FAULTMASK ever have more than 1 bit defined.
The functions cm_is_masked_interrupts() and cm_is_masked_faults() are
unchanged, since returning 'bool' fits with the function naming.

Fixes most of github issue #475. What remains "unfixed" is the absence
of functions to simply 'get' the u32 value of PRIMASK and FAULTMASK registers.
2016-02-28 18:02:57 +00:00
fenugrec
ad5ec6af08 Cortex-M defines : fix potential issue where PRIMASK and FAULTMASK operations could be optimized out by gcc.
This adds the "volatile" keyword to all the inline assembly. gcc docs say "You can prevent an asm instruction from being deleted by writing the keyword volatile after the asm.". Testing (see comments of github issue #475) shows that indeed gcc can remove some inline asm, in at least this situation:
-multiple calls to cm_is_masked_interrupts() in the same scope/context
- -Os or -O2 optimization
This is problem because the value of PRIMASK could change between two calls to cm_is_masked_interrupts().
Adding the volatile keyword fixes this, and probably costs less than adding a full barrier (like adding "memory" to the clobber list).
2016-01-10 11:13:25 -05:00
Karl Palsson
aac78ba464 cm3: include stdint.h and stdbool.h
While there might be other places that are missing this include, this
particular file is clearly missing them, and has resulted in a few separate bug
reports.  Fix it right now, in the name of continuous improvement.

Fixes #310 and #427
2015-04-29 01:30:47 +00:00
Ondrej Palenicek
377f782d23 Removed extra underscore. 2015-02-05 18:27:29 -08:00
Frantisek Burian
d96343d487 [FIX] Fix the ATOMIC suport. 2014-02-18 02:03:09 +01:00
Piotr Esden-Tempski
a909b5ca9e [Style] Global style fix run. 2014-01-03 01:07:30 +01:00
BuFran
aa9b94ee1d [Stylecheck] Correct style in the CM3 addition 2014-01-02 21:06:05 +01:00
Frantisek Burian
8e96592f55 [CM3] Add atomic operation support
Tested with -O0, -O2 and -Os generating correct code with gcc-arm-embedded 2013q2.
note -std=c99 or newer needed
2014-01-02 21:06:05 +01:00
Frantisek Burian
17fc71a462 [CM3] Add support for Cortex M interrupt masks
FIX: add doxygen documentation to the module
2014-01-02 21:06:05 +01:00
Frantisek Burian
065b47f8ba [CM3] Add core interrupt masking for easy creation of atomic blocks 2014-01-02 21:06:05 +01:00
Ben Gamari
d2ce9c0827 cortex: Add cc_[en|dis]able_interrupts 2013-07-07 17:21:29 -07:00