splits low_level_init to allow usage of c file

this also makes threadx hook into the isrs
This commit is contained in:
2026-04-10 13:10:50 +02:00
parent 21f95341af
commit b16a0ed956
3 changed files with 55 additions and 91 deletions

View File

@@ -3,8 +3,6 @@
#include "riscv-traps.h"
#include <stdint.h>
#include <stdio.h>
#include <tx_api.h>
#include <tx_port.h>
#if __riscv_xlen == 64
#define INTERRUPT_BIT 0x8000000000000000ull
@@ -16,7 +14,6 @@
#define OS_IS_SOFT_INT(mcause) (mcause == (0x3 | INTERRUPT_BIT))
#define OS_IS_EXT_INT(mcause) (mcause == (0xb | INTERRUPT_BIT))
extern void _tx_timer_interrupt(void);
extern uintptr_t exception(uintptr_t mcause, uintptr_t mepc, uintptr_t mtval);
void (*irq_handler[__riscv_xlen])();
@@ -33,23 +30,13 @@ void trap_handler(uintptr_t mcause, uintptr_t mepc, uintptr_t mtval) {
if(OS_IS_INTERRUPT(mcause)) {
unsigned irq_id = mcause&(__riscv_xlen-1);
switch(irq_id){
case RISCV_INT_MTI:
#ifdef NX_DEBUG
printf("Timer interrupt being handled (pc=%lx)\n", mepc);
#endif
hwtimer_handler();
_tx_timer_interrupt();
break;
/*
#ifdef TX_THREAD_SMP_INTER_CORE_INTERRUPT
case RISCV_INT_MSI:
set_aclint_msip(aclint, csr_read_mhartid(), 0);
break;
#endif
case RISCV_INT_MEI:
puts("[INTERRUPT]: handler ext irq error!\n");
while(1)
;
break;
*/
default:
if(irq_handler[irq_id])
irq_handler[irq_id]();