forked from M-Labs/artiq
add gpio_out syscall
This commit is contained in:
parent
37cd4e7e86
commit
301b7d51fa
|
@ -1,7 +1,8 @@
|
||||||
from llvm import core as lc
|
from llvm import core as lc
|
||||||
|
|
||||||
_syscalls = [
|
_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:
|
class Environment:
|
||||||
|
|
|
@ -55,13 +55,19 @@ static int download_kernel(void *buffer, int maxlength)
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printint(int x)
|
static void print_int(int x)
|
||||||
{
|
{
|
||||||
printf("%d\n", x);
|
printf("%d\n", x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void gpio_set(int channel, int level)
|
||||||
|
{
|
||||||
|
leds_out_write(!!level);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct symbol syscalls[] = {
|
static const struct symbol syscalls[] = {
|
||||||
{"__syscall_printint", printint},
|
{"__syscall_print_int", print_int},
|
||||||
|
{"__syscall_gpio_set", gpio_set},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue