add test_fw
This commit is contained in:
45
test_fw/test_fw.c
Normal file
45
test_fw/test_fw.c
Normal file
@@ -0,0 +1,45 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "platform.h"
|
||||
#include "encoding.h"
|
||||
#include <string.h>
|
||||
|
||||
extern void _init();
|
||||
int main() {
|
||||
//board_init();
|
||||
_init();
|
||||
puts("after _init");
|
||||
|
||||
// set only MPP
|
||||
__asm__ volatile (
|
||||
"csrs mstatus, %0"
|
||||
:
|
||||
: "r"(MSTATUS_MPP | MSTATUS_MIE)
|
||||
: "memory"
|
||||
);
|
||||
|
||||
puts("after enable MSTATUS_MIE/MPP");
|
||||
/*
|
||||
// enable MIE
|
||||
write_csr(mie,MIE_MTIE | MIE_MSIE | MIE_MEIE);
|
||||
puts("after enable MIE");
|
||||
*/
|
||||
|
||||
uint64_t time = get_aclint_mtime(aclint);
|
||||
printf("in main() get_aclint_mtime return %d \n ",time);
|
||||
set_aclint_mtime(aclint, 9);
|
||||
time = get_aclint_mtime(aclint);
|
||||
printf("in main() get_aclint_mtime after set 9, return %d \n ",time);
|
||||
|
||||
set_aclint_mtimecmp(aclint, (time+3));
|
||||
puts("set mtimecmp");
|
||||
|
||||
uint64_t timecmp = get_aclint_mtimecmp(aclint);
|
||||
printf("in main() get_aclint_mtimecmp return %d \n ",timecmp);
|
||||
|
||||
puts(" finshed ");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user