updates bsp and beautifies test_fw.c

This commit is contained in:
2025-11-21 17:43:36 +01:00
parent 109cc2a7ad
commit dd071a3d30
2 changed files with 13 additions and 9 deletions

View File

@@ -6,11 +6,15 @@
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
extern void _init(); void handle_m_time_interrupt() {
uint64_t time = get_aclint_mtime(aclint);
time += MTIMER_NEXT_TICK_INC;
set_aclint_mtimecmp(aclint, time);
puts("m_time_irq");
}
int main() { int main() {
// board_init(); puts("in main");
_init();
puts("after _init");
// avoid getting interrupt upon enabling MIP/MIE_MTI // avoid getting interrupt upon enabling MIP/MIE_MTI
set_aclint_mtimecmp(aclint, 0xffffffffffffffff); set_aclint_mtimecmp(aclint, 0xffffffffffffffff);
// enable global interrupt // enable global interrupt
@@ -27,7 +31,7 @@ int main() {
time = get_aclint_mtime(aclint); time = get_aclint_mtime(aclint);
printf("in main() get_aclint_mtime after set 9, return %lu \n", (uint32_t)time); printf("in main() get_aclint_mtime after set 9, return %lu \n", (uint32_t)time);
set_aclint_mtimecmp(aclint, (time + 300)); set_aclint_mtimecmp(aclint, (time + 3));
puts("set mtimecmp"); puts("set mtimecmp");
uint64_t timecmp = get_aclint_mtimecmp(aclint); uint64_t timecmp = get_aclint_mtimecmp(aclint);