detach risc-v kernel code from gd32v lib
This commit is contained in:
parent
25f2aeef9e
commit
3ef8f4eae5
|
|
@ -1,5 +1,4 @@
|
|||
#include <tos.h>
|
||||
#include <riscv_encoding.h>
|
||||
#include <riscv_port.h>
|
||||
|
||||
__KERNEL__ void cpu_systick_init(k_cycle_t cycle_per_tick)
|
||||
|
|
@ -107,7 +106,7 @@ __KERNEL__ k_stack_t *cpu_task_stk_init(void *entry,
|
|||
regs->gp = (cpu_data_t)gp; // gp: global pointer
|
||||
regs->a0 = (cpu_data_t)arg; // a0: argument
|
||||
regs->ra = (cpu_data_t)0xACE00ACE; // ra: return address
|
||||
regs->mstatus = (cpu_data_t)(MSTATUS_MPP | MSTATUS_MPIE); // return to machine mode and enable interrupt
|
||||
regs->mstatus = (cpu_data_t)0x00001880; // return to machine mode and enable interrupt
|
||||
regs->epc = (cpu_data_t)entry;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include <tos.h>
|
||||
#include "riscv_encoding.h"
|
||||
#include "riscv_port.h"
|
||||
|
||||
__PORT__ void port_systick_config(uint32_t cycle_per_tick)
|
||||
|
|
|
|||
|
|
@ -15,8 +15,14 @@
|
|||
.extern k_curr_task
|
||||
.extern k_next_task
|
||||
|
||||
#define MSTATUS_MIE 0x00000008
|
||||
#define MSTATUS_MPP 0x00001800
|
||||
|
||||
#include "riscv_encoding.h"
|
||||
#define MIE_MTIE (1 << 7)
|
||||
|
||||
#define MIP_MTIP (1 << 7)
|
||||
|
||||
#define REGBYTES 4
|
||||
|
||||
.text
|
||||
.align 2
|
||||
|
|
@ -59,7 +65,6 @@ port_systick_pending_reset:
|
|||
csrc mip, t0
|
||||
ret
|
||||
|
||||
#define REGBYTES 4
|
||||
|
||||
.macro SAVE_CONTEXT
|
||||
addi sp, sp, -32*REGBYTES
|
||||
|
|
|
|||
Loading…
Reference in New Issue