diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-11-11 00:05:00 +0100 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-11-11 00:08:15 +0100 |
| commit | f7ad4d9216b488f76ed4b3c8e423cd926e134b9d (patch) | |
| tree | 39a83931c1c8a5e6d025623aba5e5826c7ef38e0 /src/loop | |
| parent | 7861a52adf92a083bb2aed4c35f98d8035dce032 (diff) | |
| download | wnix-f7ad4d9216b488f76ed4b3c8e423cd926e134b9d.tar.gz | |
WIP
Diffstat (limited to 'src/loop')
| -rw-r--r-- | src/loop/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/loop/src/run.c | 27 |
2 files changed, 28 insertions, 1 deletions
diff --git a/src/loop/CMakeLists.txt b/src/loop/CMakeLists.txt index 5d1e3e2..32b6179 100644 --- a/src/loop/CMakeLists.txt +++ b/src/loop/CMakeLists.txt @@ -18,3 +18,5 @@ add_library(loop) add_subdirectory(src) target_include_directories(loop PUBLIC include PRIVATE private_include) target_link_libraries(loop PUBLIC aio PRIVATE bin fs gfx init net) + +target_link_libraries(loop PRIVATE kprintf drv_ps1_bios) diff --git a/src/loop/src/run.c b/src/loop/src/run.c index ea3ef26..6c23365 100644 --- a/src/loop/src/run.c +++ b/src/loop/src/run.c @@ -25,15 +25,40 @@ #include <init.h> #include <net.h> + +#include <kprintf.h> +#include <time.h> +#include <drv/ps1/bios.h> int loop_run(void) { + static unsigned iterations; + if (fs_update() || aio_poll(loop_aio_head, 0) < 0 || init_run() - || net_update() + /*|| net_update()*/ || bin_update() || gfx_update()) return -1; + iterations++; + + static struct timespec ts; + struct timespec now; + + if (clock_gettime(CLOCK_REALTIME, &now)) + return -1; + + if (now.tv_sec - ts.tv_sec) + { + extern unsigned sio_read, valid_packets; + extern int sio_stat_overrun, sw_overrun; + + kprintf("%u ticks, read=%u, SIO=%d, SOV=%d, OK=%u\n", iterations, + sio_read, sio_stat_overrun, sw_overrun, valid_packets); + ts = now; + iterations = 0; + } + return 0; } |
