support GD32VF103C START board
This commit is contained in:
@@ -116,7 +116,7 @@ void cpu_trap_entry(cpu_data_t cause, cpu_context_t *regs)
|
||||
}
|
||||
|
||||
void SysTick_IRQHandler() {
|
||||
port_systick_config(k_cpu_cycle_per_tick);
|
||||
port_systick_config((uint32_t)k_cpu_cycle_per_tick);
|
||||
if (tos_knl_is_running()) {
|
||||
tos_knl_irq_enter();
|
||||
tos_tick_handler();
|
||||
|
@@ -1,10 +1,18 @@
|
||||
#include "riscv_encoding.h"
|
||||
#include <tos.h>
|
||||
|
||||
#if 0
|
||||
#define CLINT_CTRL_ADDR 0x2000000
|
||||
#define CLINT_MSIP 0x0000
|
||||
#define CLINT_MTIMECMP 0x4000
|
||||
#define CLINT_MTIME 0xBFF8
|
||||
#else
|
||||
#include "gd32vf103.h"
|
||||
#define CLINT_CTRL_ADDR 0xD1000000
|
||||
#define CLINT_MSIP 0x0FFC
|
||||
#define CLINT_MTIMECMP 0x0008
|
||||
#define CLINT_MTIME 0x0000
|
||||
#endif
|
||||
|
||||
__PORT__ void port_systick_config(uint32_t cycle_per_tick)
|
||||
{
|
||||
@@ -35,6 +43,8 @@ __PORT__ void port_systick_config(uint32_t cycle_per_tick)
|
||||
*(volatile uint32_t *)(CLINT_CTRL_ADDR + CLINT_MTIMECMP + 0) = 0xFFFFFFFF;
|
||||
*(volatile uint32_t *)(CLINT_CTRL_ADDR + CLINT_MTIMECMP + 4) = 0xFFFFFFFF & (mtimecmp >> 32);
|
||||
*(volatile uint32_t *)(CLINT_CTRL_ADDR + CLINT_MTIMECMP + 0) = 0xFFFFFFFF & (mtimecmp >> 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
__PORT__ void port_systick_priority_set(uint32_t prio)
|
||||
|
@@ -250,8 +250,8 @@ irq_entry:
|
||||
call cpu_trap_entry
|
||||
j restore
|
||||
irq:
|
||||
slli a0, a0, 1
|
||||
srli a0, a0, 1
|
||||
slli a0, a0, 16
|
||||
srli a0, a0, 16
|
||||
call cpu_irq_entry
|
||||
restore:
|
||||
RESTORE_CONTEXT
|
||||
|
Reference in New Issue
Block a user