Files
Firmwares/test_fw/test_fw.c
2025-11-14 15:24:08 +01:00

46 lines
972 B
C

#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;
}