forked from M-Labs/artiq
1
0
Fork 0

add gpio_out syscall

This commit is contained in:
Sebastien Bourdeauducq 2014-07-05 22:46:43 +02:00
parent 37cd4e7e86
commit 301b7d51fa
2 changed files with 10 additions and 3 deletions

View File

@ -1,7 +1,8 @@
from llvm import core as lc
_syscalls = [
("printint", lc.Type.void(), [lc.Type.int()])
("print_int", lc.Type.void(), [lc.Type.int()]),
("gpio_set", lc.Type.void(), [lc.Type.int(), lc.Type.int()])
]
class Environment:

View File

@ -55,13 +55,19 @@ static int download_kernel(void *buffer, int maxlength)
return length;
}
static void printint(int x)
static void print_int(int x)
{
printf("%d\n", x);
}
static void gpio_set(int channel, int level)
{
leds_out_write(!!level);
}
static const struct symbol syscalls[] = {
{"__syscall_printint", printint},
{"__syscall_print_int", print_int},
{"__syscall_gpio_set", gpio_set},
{NULL, NULL}
};