diff options
Diffstat (limited to 'cmd/sbc_harness/main.c')
-rw-r--r-- | cmd/sbc_harness/main.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/cmd/sbc_harness/main.c b/cmd/sbc_harness/main.c index 25b122c..5630e83 100644 --- a/cmd/sbc_harness/main.c +++ b/cmd/sbc_harness/main.c @@ -39,6 +39,13 @@ #include "config.h" +#ifndef _CONFIG_9P_MAX_CONNS + #error config.h must define _CONFIG_9P_MAX_CONNS +#endif +#ifndef _CONFIG_9P_MAX_REQS + #error config.h must define _CONFIG_9P_MAX_REQS +#endif + /* file tree ******************************************************************/ enum { PATH_BASE = __COUNTER__ }; @@ -153,13 +160,21 @@ static COROUTINE read9p_cr(void *) { lo_interface net_iface iface = lo_box_w5500_if_as_net_iface(&globals.dev_w5500); lo_interface net_stream_listener listener = LO_CALL(iface, tcp_listen, LIB9P_DEFAULT_PORT_9FS); - lib9p_srv_read_cr(&globals.srv, listener); + lib9p_srv_accept_and_read_loop(&globals.srv, listener); + + cr_end(); +} + +static COROUTINE write9p_cr(void *) { + cr_begin(); + + lib9p_srv_worker_loop(&globals.srv); cr_end(); } const char *const hexdig = "0123456789ABCDEF"; -static_assert(CONFIG_9P_SRV_MAX_REQS*_CONFIG_9P_NUM_SOCKS <= 16); +static_assert(_CONFIG_9P_MAX_REQS <= 16); COROUTINE init_cr(void *) { cr_begin(); @@ -215,13 +230,13 @@ COROUTINE init_cr(void *) { coroutine_add("usb_keyboard", usb_keyboard_cr, &globals.keyboard_chan); //coroutine_add("hello_world", hello_world_cr, &globals.keyboard_chan); coroutine_add("dhcp", dhcp_cr, NULL); - for (int i = 0; i < _CONFIG_9P_NUM_SOCKS; i++) { + for (int i = 0; i < _CONFIG_9P_MAX_CONNS; i++) { char name[] = {'r', 'e', 'a', 'd', '-', hexdig[i], '\0'}; coroutine_add(name, read9p_cr, NULL); } - for (int i = 0; i < CONFIG_9P_SRV_MAX_REQS*_CONFIG_9P_NUM_SOCKS; i++) { + for (int i = 0; i < _CONFIG_9P_MAX_REQS; i++) { char name[] = {'w', 'r', 'i', 't', 'e', '-', hexdig[i], '\0'}; - coroutine_add(name, lib9p_srv_write_cr, &globals.srv); + coroutine_add(name, write9p_cr, NULL); } cr_exit(); @@ -234,4 +249,5 @@ int main() { infof("==================================================================="); coroutine_add("init", init_cr, NULL); coroutine_main(); + assert_notreached("all coroutines exited"); } |