Save progress

This commit is contained in:
2023-01-06 22:15:03 +01:00
parent b9b3656180
commit 5e7aa29e9c
6 changed files with 57 additions and 26 deletions

View File

@@ -19,6 +19,18 @@ namespace JabyEngine {
__declare_io_port_global(ComplexBitMap<uint32_t>, Status, 0x1F801070);
__declare_io_port_global(ComplexBitMap<uint32_t>, Mask, 0x1F801074);
static bool is_irq(Bit<uint32_t> irq) {
return Status.read().is_bit_set(irq);
}
static void ack_irg(Bit<uint32_t> irq) {
//Status.write(Status.read().clear_bit(irq));
}
static void enable_irq(Bit<uint32_t> irq) {
//Mask.write(Mask.read().set_bit(irq));
}
}
}

View File

@@ -10,14 +10,15 @@ namespace JabyEngine {
__io_port_inherit_complex_bit_map(CounterMode);
static constexpr auto SyncEnable = Bit<uint32_t>(0);
static constexpr auto FreeRun = !SyncEnable;
static constexpr auto SyncMode = BitRange<uint32_t>::from_to(1, 2);
static constexpr auto ResetAfterTarget = Bit<uint32_t>(3);
static constexpr auto IRQAtTarget = Bit<uint32_t>(4);
static constexpr auto IRQAtMax = Bit<uint32_t>(5);
static constexpr auto IRQOneShot = !Bit<uint32_t>(6);
static constexpr auto IRQEveryTime = Bit<uint32_t>(6);
static constexpr auto IRQPulse = !Bit<uint32_t>(7);
static constexpr auto IRQOneShot = !IRQEveryTime;
static constexpr auto IRQToggle = Bit<uint32_t>(7);
static constexpr auto IRQPulse = !IRQToggle;
static constexpr auto ClockSource = BitRange<uint32_t>::from_to(8, 9);
static constexpr auto HasIRQRequest = Bit<uint32_t>(10);
static constexpr auto IsTargetReached = Bit<uint32_t>(11);

View File

@@ -37,17 +37,19 @@ enum __syscall_PriorityChain {
DefInt = 3
};
static __constexpr const uint32_t SkipHandler = 0;
static __constexpr const uint32_t ExecuteHandler = 1;
enum InterruptVerifierResult {
SkipHandler = 0,
ExecuteHandler = 1
};
typedef uint32_t (*InterruptVerifier)();
typedef InterruptVerifierResult (*InterruptVerifier)();
typedef uint32_t (*InterruptHandler)(uint32_t);
struct __no_align __syscall_InterruptElement {
struct __syscall_InterruptElement* next;
InterruptHandler handler_function;
InterruptVerifier verifier_function;
uint32_t notUsed;
struct __no_align InterrupCallback {
struct InterrupCallback* next;
InterruptHandler handler_function;
InterruptVerifier verifier_function;
uint32_t notUsed;
};
#ifdef __cplusplus
@@ -99,18 +101,18 @@ static __always_inline void __syscall_ReturnFromException() {
__syscall_function_cast(__syscall_Table_B, void(*)())();
}
static __always_inline int __syscall_SysEnqIntRP(enum __syscall_PriorityChain prio, struct __syscall_InterruptElement* interElm) {
static __always_inline int __syscall_SysEnqIntRP(enum __syscall_PriorityChain prio, struct InterrupCallback* interElm) {
register uint32_t FuncID asm("t1") = 0x02;
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
return __syscall_function_cast(__syscall_Table_C, int(*)(enum __syscall_PriorityChain prio, struct __syscall_InterruptElement *interElm))(prio, interElm);
return __syscall_function_cast(__syscall_Table_C, int(*)(enum __syscall_PriorityChain prio, struct InterrupCallback *interElm))(prio, interElm);
}
static __always_inline int __syscall_SysDeqIntRP(enum __syscall_PriorityChain prio, struct __syscall_InterruptElement *interElm) {
static __always_inline int __syscall_SysDeqIntRP(enum __syscall_PriorityChain prio, struct InterrupCallback *interElm) {
register uint32_t FuncID asm("t1") = 0x03;
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
return __syscall_function_cast(__syscall_Table_C, int(*)(enum __syscall_PriorityChain prio, struct __syscall_InterruptElement *interElm))(prio, interElm);
return __syscall_function_cast(__syscall_Table_C, int(*)(enum __syscall_PriorityChain prio, struct InterrupCallback *interElm))(prio, interElm);
}
static __always_inline uint32_t __syscall_EnterCriticalSection() {