Porting PicoTCP WIP
This commit is contained in:
@ -16,12 +16,35 @@
|
||||
#include "sysdefs/proc.h"
|
||||
#include "sysdefs/fs.h"
|
||||
#include "time/time.h"
|
||||
#include "pico_stack.h"
|
||||
|
||||
#define PROC_REAPER_FREQ 30
|
||||
|
||||
uint64_t pids = 0;
|
||||
uint64_t sched_ticks = 0;
|
||||
|
||||
uint64_t uptime_ms = 0;
|
||||
uint64_t last_secs = 0;
|
||||
|
||||
uint64_t get_wallclock_secs(void) {
|
||||
Time t;
|
||||
time_get(&t);
|
||||
return time_totalhours(&t) * 3600 + t.minute * 60 + t.second;
|
||||
}
|
||||
|
||||
void update_time(void) {
|
||||
uint64_t now_s = get_wallclock_secs();
|
||||
uint64_t delta_s;
|
||||
|
||||
if (now_s >= last_secs)
|
||||
delta_s = now_s - last_secs;
|
||||
else
|
||||
delta_s = 0;
|
||||
|
||||
uptime_ms += (uint64_t)delta_s * 1000;
|
||||
last_secs = now_s;
|
||||
}
|
||||
|
||||
Procs PROCS;
|
||||
|
||||
bool proc_checkelf(uint8_t *elf) {
|
||||
@ -223,6 +246,8 @@ void proc_reaper(void) {
|
||||
void proc_sched(void *cpustate) {
|
||||
hal_intr_disable();
|
||||
sched_ticks++;
|
||||
update_time();
|
||||
pico_stack_tick();
|
||||
|
||||
IntrStackFrame *frame = cpustate;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user