1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/include
bors[bot] 1b352d69f7
Merge #17066
17066: sys/irq: Add C++ wrapper using RAII r=maribu a=jenswet

### Contribution description

This adds a C++ wrapper around the `irq.h` API. The wrapper uses RAII to accomplish a convenient and bug resistent use.
 
A little background: I'm currently writing my master thesis on using C++ for embedded development, at the working group that `@maribu` is part of. For that I will try to add better C++ support to several parts of RIOT and then do some benchmarking and metrics to compare it with the C implementation. For example, I also plan to add a wrapper around i2c, a std::cout drop-in replacement and probably some more about networks or threads.

### Testing procedure

I've added a unit test to verify that the IRQ wrapper calls the original `irq` functions as expected. As C++ and wrapper testing isn't done much so far in this project, I've added two additional headers to ease testing:
1.  #17076 - fake functions framework, already merged
2. As there is no framework for C++ unit tests yet, I've added something for this too. Unfortunately the existing frameworks like GoogleTest, CppUTest or CppUnit don't easily compile for embedded or are difficult to integrate in to the RIOT build process. That's why I wrote some (simple) helper functions and macros inspired by the above frameworks. That allows to create C++ tests based on a fixture class with set up and tear down methods. It also allows some simple assertions and is easily extendable for other use cases. It wraps some of the fff functionality too.

Both of this is obviously not required for the initial reason of this PR. But I'd like to provide unit tests for the features that I suggest to introduce where possible. So I'd appreciate some feedback on that too. If you'd prefer a PR without or different tests please let me know.

You can run the test `irq_cpp` locally or on the CI to test the implementation.

Please feel free to give feedback or suggest improvements!

Co-authored-by: Jens Wetterich <jens@wetterich-net.de>
2023-01-15 18:17:00 +00:00
..
bhp sys/bhp_msg: add IPC based Bottom Half Processor 2022-08-19 12:01:30 +02:00
can drivers/mcp2515: apply the filter to a target mailbox 2022-06-30 10:07:24 +02:00
checksum sys/checksum: update CRC-16 documentation 2022-10-07 13:01:38 +02:00
congure congure_abe: initial import of TCP ABE congestion control 2022-10-17 16:44:39 +02:00
cppunit core/irq: Add C++ wrapper 2023-01-13 13:58:07 +01:00
crypto sys/includes: replace kernel_defines.h 2022-11-22 13:39:35 +01:00
ecc doc: fix unbalaced grouping 2022-09-14 15:05:25 +02:00
embUnit sys/embUnit: replace RIOT_FILE_RELATIVE with __FILE__ 2022-11-19 01:48:42 +01:00
entropy_source
event doc: add deprecation notice on deprecated pseudo-modules 2022-10-06 10:53:10 +02:00
fido2 fido2/ctap: uncrustify files 2022-09-23 16:42:52 +02:00
fs pkg/littlefs2: fix unaligned memory access 2022-08-18 18:54:37 +02:00
hashes sys/hash/pbkdf2: Accept passwd as void * instead of uint8_t * 2022-11-18 13:51:32 +01:00
isrpipe
net Merge #18459 #18724 #19081 #19082 #19136 2023-01-13 13:50:55 +00:00
riotboot sys/riotboot: use BTN0_MODE for default value of BTN_BOOTLOADER_INVERTED 2022-11-30 19:28:14 +01:00
senml sys/senml: add SenML modules 2022-02-11 12:38:21 +01:00
suit suit: start worker thread on demand 2022-09-05 07:46:56 +02:00
sys
test_utils sys/test_utils: replace RIOT_FILE_RELATIVE with __FILE__ 2022-11-19 01:48:42 +01:00
usb doc: sort all stdio implementations into sys_stdio group 2023-01-13 11:08:22 +01:00
xtimer doc: fix unbalaced grouping 2022-09-14 15:05:25 +02:00
ztimer ztimer/convert: pass-thru start/stop ops to lower timer 2022-11-22 00:25:34 +01:00
ztimer64 ztimer(64): make xtimer_compat documetation visible (defgroup) 2022-08-09 14:26:49 +02:00
analog_util.h
app_metadata.h treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
architecture.h sys/architecture: introduce uinttxtptr_t 2022-07-13 23:19:33 +02:00
atomic_utils.h core/lib: Add macros/utils.h header 2023-01-07 09:47:44 +01:00
auto_init_utils.h sys/includes: replace kernel_defines.h 2022-11-22 13:39:35 +01:00
auto_init.h pkg/lwip: Start rework of netif initialisation 2021-08-20 14:56:46 +02:00
base64.h
bcd.h
benchmark.h sys/benchmark: wrap BENCHMARK_FUNC in do {} while (0) 2022-02-11 14:24:38 +01:00
bhp.h sys/bhp: add initial support for generic Bottom Half Processor 2022-08-11 10:57:53 +02:00
bit.h sys/bit: add bit_checkXX() functions 2021-06-02 14:07:17 +02:00
bitfield.h sys/bitfield: don't use ambiguous 'size of the bitfield' 2022-12-13 13:09:31 +01:00
bloom.h codespell: fix remaining issues 2022-09-16 14:00:35 +02:00
byteorder.h treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
c11_atomics_compat.hpp doc: Improve C++ documentation 2021-12-15 18:58:23 +01:00
cb_mux.h
chunked_ringbuffer.h sys/chunked_ringbuffer: move config to CONFIG_ namespace 2022-03-04 09:35:39 +01:00
clif.h sys/clif: Fixing out of bounds read under certain conditions 2022-10-26 13:44:01 +02:00
clk.h sys: introduce coreclk utility function 2021-12-15 12:41:36 +01:00
color.h
congure.h
cppunit.hpp core/irq: Add C++ wrapper 2023-01-13 13:58:07 +01:00
dbgpin.h sys/includes: replace kernel_defines.h 2022-11-22 13:39:35 +01:00
debug_irq_disable.h cpu/cortexm_common: measure time spent with IRQ disabled 2022-11-24 21:27:20 +01:00
div.h
eepreg.h
embUnit.h sys/include: remove kernel_defines.h where not needed 2022-11-22 13:39:35 +01:00
entropy_source.h
event.h sys/event: ensure that a queue has a waiter before waiting for flags 2022-04-14 17:10:24 +02:00
evtimer_mbox.h
evtimer_msg.h
evtimer.h sys/includes: replace kernel_defines.h 2022-11-22 13:39:35 +01:00
fmt_table.h
fmt.h sys/fmt: add print_bytes_hex() 2022-11-15 22:05:42 +01:00
frac.h
fuzzing.h
hashes.h treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
iolist.h sys/iolist: introduce iolist_to_buffer() 2022-05-02 23:23:52 +02:00
irq.hpp core/irq: Add C++ wrapper 2023-01-13 13:58:07 +01:00
isrpipe.h sys/isrpipe: add isrpipe_write 2021-12-07 13:00:58 +01:00
luid.h
matstat.h
memarray.h
mineplex.h
od.h
phydat.h sys/includes: replace kernel_defines.h 2022-11-22 13:39:35 +01:00
pipe.h
pm_layered.h sys/pm_layered: align pm_blocker_t for speed 2022-11-04 16:50:52 +01:00
progress_bar.h sys/progress_bar: add Konfig configuration 2021-04-07 12:05:00 +02:00
ps.h treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
ptrtag.h
puf_sram.h sys/puf_sram: cleanup header 2022-12-05 16:13:21 +01:00
random.h random: use void * in random_bytes() 2022-07-26 19:46:14 +02:00
rtc_utils.h sys/rtc_utils: small doc fix of rtc_mktime 2022-06-12 15:49:01 +02:00
saul_reg.h drivers/saul: use const qualifier for data to write 2022-05-23 08:35:27 +02:00
sched_round_robin.h sys/sched_round_robin: Add a round robin scheduler module 2021-11-11 13:18:52 +01:00
schedstatistics.h schedstatistics: Convert to ztimer 2021-12-07 16:31:15 +01:00
sema_inv.h
sema.h sys/sema: use sema_ztimer64 to implement old sema api 2022-03-10 14:19:44 +01:00
senml.h sys/includes: replace kernel_defines.h 2022-11-22 13:39:35 +01:00
seq.h
shell_lock.h sys/shell: add pseudomodule shell_lock_auto_locking 2022-06-08 12:53:48 +02:00
shell.h sys/includes: replace kernel_defines.h 2022-11-22 13:39:35 +01:00
stdio_base.h sys/includes: replace kernel_defines.h 2022-11-22 13:39:35 +01:00
stdio_nimble.h doc: sort all stdio implementations into sys_stdio group 2023-01-13 11:08:22 +01:00
stdio_rtt.h doc: sort all stdio implementations into sys_stdio group 2023-01-13 11:08:22 +01:00
stdio_semihosting.h doc: sort all stdio implementations into sys_stdio group 2023-01-13 11:08:22 +01:00
stdio_uart.h doc: sort all stdio implementations into sys_stdio group 2023-01-13 11:08:22 +01:00
string_utils.h sys/includes: replace kernel_defines.h 2022-11-22 13:39:35 +01:00
suit.h suit: replace SUIT_URL_MAX with CONFIG_SOCK_URLPATH_MAXLEN 2022-06-01 13:00:51 +02:00
time_units.h sys/include/time_units.h: add more constants 2022-05-05 11:31:45 +02:00
timex.h sys: factor out US_PER_SEC etc from timex.h into time_units.h 2021-12-15 14:33:20 +01:00
tiny_strerror.h sys/tiny_strerror: add tiny_strerror_minimal 2022-10-18 23:30:15 +02:00
tm.h sys/include: remove kernel_defines.h where not needed 2022-11-22 13:39:35 +01:00
trace.h
trickle.h treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
tsrb.h sys/tsrb: add tsrb_clear 2021-12-06 11:53:59 +01:00
unaligned.h
universal_address.h treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
uri_parser.h sys/uri_parser: Adding the port as uint16 2022-09-08 11:32:49 +02:00
usb_board_reset_internal.h
usb_board_reset.h
usb.h sys/usb: Set USB model to $(BOARD) by default 2022-08-29 16:39:05 +02:00
ut_process.h ut_process: initial import of a URI template processor 2021-09-16 18:18:48 +02:00
utlist.h sys/utlist: include stddef.h 2022-02-12 18:30:58 +01:00
uuid.h treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
vfs_default.h cpu/sam0_common: add SD Host Controller implementation 2022-05-31 11:07:20 +02:00
vfs_util.h sys/vfs_util: add recursive unlink 2022-08-03 22:09:21 +02:00
vfs.h vfs: drop unused abs_path parameter 2022-09-29 22:01:37 +02:00
volatile_utils.h
xtimer.h sys/ztimer: add ztimer64_xtimer_compat 2022-02-24 09:10:58 +01:00
zptr.h
ztimer64.h sys/ztimer: add ztimer64_xtimer_compat 2022-02-24 09:10:58 +01:00
ztimer.h ztimer: introduce ztimer_mutex_unlock_after() 2023-01-13 00:08:55 +01:00