mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 21:52:48 +00:00
refactors all the ugly "pendingX" atomic operations into a single "Event" subsystem/interface thing with two operations moves all existing code to use this instead also changes the "bkpt" macro to also indicate unreachable code
27 lines
553 B
C
27 lines
553 B
C
#pragma once
|
|
|
|
#include <types.h>
|
|
|
|
typedef struct {
|
|
void (*reset)(void);
|
|
u32 (*test)(u32 param, u32 clear);
|
|
} EventInterface;
|
|
|
|
const EventInterface *getEventIRQ(void);
|
|
const EventInterface *getEventMCU(void);
|
|
|
|
static inline void eventReset(const EventInterface *ei) {
|
|
ei->reset();
|
|
}
|
|
|
|
static inline u32 eventTest(const EventInterface *ei, u32 param, u32 clear) {
|
|
return ei->test(param, clear);
|
|
}
|
|
|
|
static inline u32 eventWait(const EventInterface *ei, u32 param, u32 clear) {
|
|
while(1) {
|
|
u32 ret = ei->test(param, clear);
|
|
if (ret) return ret;
|
|
}
|
|
}
|