X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Ftest%2Fao_lisp_os.h;h=9b021900d818a17358c816cae7e4e4f905054bed;hb=65fb0ad8693407cc9bd114424c1f51b6aa6befc3;hp=19bd4f64df3237b9a593ec1e470d2c037b4e4fe4;hpb=137898e3431d887e75b09d8c1ce57297a1558e43;p=fw%2Faltos diff --git a/src/test/ao_lisp_os.h b/src/test/ao_lisp_os.h index 19bd4f64..9b021900 100644 --- a/src/test/ao_lisp_os.h +++ b/src/test/ao_lisp_os.h @@ -22,8 +22,17 @@ #include #include +#define AO_LISP_POOL_TOTAL 3072 +#define AO_LISP_SAVE 1 +#define DBG_MEM_STATS 1 + extern int ao_lisp_getc(void); +static inline void +ao_lisp_os_flush() { + fflush(stdout); +} + static inline void ao_lisp_abort(void) { @@ -36,13 +45,24 @@ ao_lisp_os_led(int led) printf("leds set to 0x%x\n", led); } +#define AO_LISP_JIFFIES_PER_SECOND 100 + static inline void -ao_lisp_os_delay(int delay) +ao_lisp_os_delay(int jiffies) { struct timespec ts = { - .tv_sec = delay / 1000, - .tv_nsec = (delay % 1000) * 1000000, + .tv_sec = jiffies / AO_LISP_JIFFIES_PER_SECOND, + .tv_nsec = (jiffies % AO_LISP_JIFFIES_PER_SECOND) * (1000000000L / AO_LISP_JIFFIES_PER_SECOND) }; nanosleep(&ts, NULL); } + +static inline int +ao_lisp_os_jiffy(void) +{ + struct timespec tp; + clock_gettime(CLOCK_MONOTONIC, &tp); + return tp.tv_sec * AO_LISP_JIFFIES_PER_SECOND + (tp.tv_nsec / (1000000000L / AO_LISP_JIFFIES_PER_SECOND)); +} + #endif