projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos/lisp: split set/def. Add def support to lambdas
[fw/altos]
/
src
/
test
/
ao_lisp_os.h
diff --git
a/src/test/ao_lisp_os.h
b/src/test/ao_lisp_os.h
index c979697eba5bae34f5a8363a6c6b68ed8a805b9f..ebd16bb47e011cd9388fbc117772cfb960284295 100644
(file)
--- a/
src/test/ao_lisp_os.h
+++ b/
src/test/ao_lisp_os.h
@@
-22,6
+22,10
@@
#include <stdlib.h>
#include <time.h>
#include <stdlib.h>
#include <time.h>
+#define AO_LISP_POOL_TOTAL 16384
+#define AO_LISP_SAVE 1
+#define DBG_MEM_STATS 1
+
extern int ao_lisp_getc(void);
static inline void
extern int ao_lisp_getc(void);
static inline void
@@
-41,13
+45,24
@@
ao_lisp_os_led(int led)
printf("leds set to 0x%x\n", led);
}
printf("leds set to 0x%x\n", led);
}
+#define AO_LISP_JIFFIES_PER_SECOND 100
+
static inline void
static inline void
-ao_lisp_os_delay(int
delay
)
+ao_lisp_os_delay(int
jiffies
)
{
struct timespec ts = {
{
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);
}
};
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
#endif