C Microkernel Realtime eXecutive
Realtime Operating System for Cortex-M based microcontrollers
 
Loading...
Searching...
No Matches
emulator.h
1#pragma once
2
3#include <stdint.h>
4
30void generate_interrupt(unsigned irq_no);
31
32typedef struct {
33 void (*emu_write_cb)(volatile void * addr);
34 void (*emu_read_cb)(const volatile void * addr);
36
63#define CMRX_PERIPHERAL_EMULATOR(peripheral_type, name, read_cb, write_cb) \
64_Static_assert(sizeof(Full_ ## peripheral_type) == sizeof(peripheral_type), "Type describing peripheral and type that gives full access to it must both have the same size!");\
65typedef struct __attribute__((packed)) {\
66 CMRX_Peripheral_Emulator_t emu;\
67 union {\
68 peripheral_type device;\
69 Full_ ## peripheral_type device_full;\
70 };\
71} Emu_ ## peripheral_type;\
72\
73Emu_ ## peripheral_type name = {\
74 .emu = { .emu_write_cb = write_cb, .emu_read_cb = read_cb }\
75}
Definition emulator.h:32