Added SBI functions support
This commit is contained in:
parent
3f6657fe00
commit
9da9b5045f
@ -10,6 +10,11 @@ void sbi_call(rv32_cpu_t* cpu, uint32_t extension_id, uint32_t func_id)
|
||||
{
|
||||
switch(func_id)
|
||||
{
|
||||
case SBI_FUNCTION_GET_SPEC_VERSION:
|
||||
// Format: [31(reserved,0) 7 bits(major) 24 bits(minor)]
|
||||
// Version 2.0
|
||||
cpu->regs.a0 = 0x2000000;
|
||||
break;
|
||||
case SBI_FUNCTION_GET_MVENDOR_ID:
|
||||
cpu->regs.a0 = 0;
|
||||
break;
|
||||
@ -25,6 +30,12 @@ void sbi_call(rv32_cpu_t* cpu, uint32_t extension_id, uint32_t func_id)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SBI_EXTENSION_SET_TIMER:
|
||||
{
|
||||
// TODO : Correctly implement that
|
||||
cpu->regs.a0 = 0;
|
||||
break;
|
||||
}
|
||||
case SBI_EXTENSION_LEGACY_CONSOLE_PUTCHAR:
|
||||
{
|
||||
printf("%c", cpu->regs.a0);
|
||||
|
@ -3,6 +3,17 @@
|
||||
|
||||
#include "cpu/rv32cpu.h"
|
||||
|
||||
/* SBI Base extension */
|
||||
#define SBI_EXTENSION_BASE 0x10
|
||||
#define SBI_FUNCTION_GET_SPEC_VERSION 0x0
|
||||
#define SBI_FUNCTION_GET_IMPL_ID 0x1
|
||||
#define SBI_FUNCTION_GET_IMPL_VERSION 0x2
|
||||
#define SBI_FUNCTION_PROBE_EXTENSION 0x3
|
||||
#define SBI_FUNCTION_GET_MVENDOR_ID 0x4
|
||||
#define SBI_FUNCTION_GET_MARCH_ID 0x5
|
||||
#define SBI_FUNCTION_GET_MIMPL_ID 0x6
|
||||
|
||||
#define SBI_EXTENSION_SET_TIMER 0x0
|
||||
#define SBI_EXTENSION_LEGACY_CONSOLE_PUTCHAR 0x1
|
||||
#define SBI_EXTENSION_LEGACY_SHUTDOWN 0x8
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user