soc/runtime: add RTIO support

This commit is contained in:
Sebastien Bourdeauducq 2014-07-20 18:28:56 -06:00
parent 1885a87187
commit 043c4345e5
1 changed files with 15 additions and 3 deletions

View File

@ -119,14 +119,24 @@ static int rpc(int rpc_num, int n_args, ...)
return receive_int(); return receive_int();
} }
static void gpio_set(int channel, int level) static void gpio_set(int channel, int value)
{ {
leds_out_write(!!level); leds_out_write(value);
}
static void rtio_set(int timestamp, int channel, int value)
{
rtio_chan_sel_write(channel);
rtio_o_timestamp_write(timestamp);
rtio_o_value_write(value);
while(!rtio_o_writable_read());
rtio_o_we_write(1);
} }
static const struct symbol syscalls[] = { static const struct symbol syscalls[] = {
{"__syscall_rpc", rpc}, {"__syscall_rpc", rpc},
{"__syscall_gpio_set", gpio_set}, {"__syscall_gpio_set", gpio_set},
{"__syscall_rtio_set", rtio_set},
{NULL, NULL} {NULL, NULL}
}; };
@ -150,7 +160,9 @@ int main(void)
if(length > 0) { if(length > 0) {
if(load_elf(syscalls, kbuf, length, kcode, sizeof(kcode))) { if(load_elf(syscalls, kbuf, length, kcode, sizeof(kcode))) {
flush_cpu_icache(); flush_cpu_icache();
rtio_reset_write(0);
k(); k();
rtio_reset_write(1);
send_sync(); send_sync();
send_char(MSGTYPE_KERNEL_FINISHED); send_char(MSGTYPE_KERNEL_FINISHED);
} }