[riot-notifications] [RIOT-OS/RIOT] core: add irq_is_enabled() function to irq interface (#11117)

Hauke Petersen notifications at github.com
Wed Mar 6 18:14:20 CET 2019

### Contribution description
I stumbled upon a bug in our `nimBLE` port, where I need to find out, if global interrupts are currently enabled (so far miss-use of `irq_is_in()`). So I noticed that this functionality was never included in our `core/irq.h` interface. This PR adds this function as `irq_is_enabled()` to RIOT.

Aside from my rather specific use case, this new function is also very useful for hardening code by including `assert(irq_is_enabled())` statements at certain critical points in the code...

Status of this PR:
- added the new function to the core interface
- added some simple test cases to the `tests/irq` test application
- implemented for
  - [x] cortexm_common (verified)
  - [x] native (verified)
  - [x] msp430 (untested)
  - [x] avr8 (untested)
  - [ ] esp32
  - [ ] esp8266
  - [ ] mips32
  - [ ] riscv
  - ...

If we want to go on with this PR, help for the remaining architectures would be highly appreciated! So please lets decide for the concept first, and only if we agree move to further implementations and testing...

### Testing procedure
run `tests/irq` on the target hardware

### Issues/PRs references
You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * core/irq.h: add irq_is_enabled() function
  * tests/irq: add enable/disable/restore sequence
  * cpu/cortexm_common: implement irq_is_enabled()
  * cpu/msp430: implement irq_is_enabled()
  * cpu/native: implement irq_is_enabled()
  * cpu/atmega_common: implement irq_is_enabled()

-- File Changes --

    M core/include/irq.h (11)
    M cpu/atmega_common/irq_arch.c (8)
    M cpu/cortexm_common/irq_arch.c (10)
    M cpu/msp430_common/irq.c (19)
    M cpu/native/irq_cpu.c (5)
    M tests/irq/main.c (43)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190306/dcd6957f/attachment.html>

More information about the notifications mailing list