From 4a6fbecab34616a7b16a859f9458a21b339bb6b0 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sun, 2 Feb 2025 02:01:30 -0700 Subject: Have main() set `bootclock` --- cmd/sbc_harness/main.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cmd') diff --git a/cmd/sbc_harness/main.c b/cmd/sbc_harness/main.c index b17725d..4580acc 100644 --- a/cmd/sbc_harness/main.c +++ b/cmd/sbc_harness/main.c @@ -10,7 +10,9 @@ #include /* pico-sdk:hardware_flash: for flash_get_unique_id() */ #include +#include /* so we can set `bootclock` */ #include +#include #include #include #include @@ -131,6 +133,7 @@ COROUTINE init_cr(void *) { } int main() { + bootclock = rp2040_hwtimer(0); stdio_uart_init(); /* char *hdr = "=" * (80-strlen("info : MAIN: ")); */ infof("==================================================================="); -- cgit v1.2.3-2-g168b From cb0c00a240c0d803e7202433f9940a91db849a5c Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sun, 2 Feb 2025 02:42:00 -0700 Subject: libhw_generic: spi: Use libobj instead of vcall.h --- cmd/sbc_harness/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/sbc_harness/main.c b/cmd/sbc_harness/main.c index 4580acc..7b1d5c5 100644 --- a/cmd/sbc_harness/main.c +++ b/cmd/sbc_harness/main.c @@ -96,7 +96,8 @@ COROUTINE init_cr(void *) { 19, /* PIN_MOSI */ 18, /* PIN_CLK */ 17); /* PIN_CS */ - w5500_init(&globals.dev_w5500, "W5500", &globals.dev_spi, + w5500_init(&globals.dev_w5500, "W5500", + lo_box_rp2040_hwspi_as_spi(&globals.dev_spi), 21, /* PIN_INTR */ 20, /* PIN_RESET */ ((struct net_eth_addr){{ -- cgit v1.2.3-2-g168b From 06eed899486daeec8ad2718c74d70f91fa0dbb25 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sun, 2 Feb 2025 02:01:30 -0700 Subject: libhw_generic: net: Use libobj instead of vcall.h --- cmd/sbc_harness/main.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'cmd') diff --git a/cmd/sbc_harness/main.c b/cmd/sbc_harness/main.c index 7b1d5c5..ce80711 100644 --- a/cmd/sbc_harness/main.c +++ b/cmd/sbc_harness/main.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -43,15 +42,6 @@ static COROUTINE hello_world_cr(void *_chan) { cr_end(); } -static COROUTINE dhcp_cr(void *_chip) { - struct w5500 *chip = _chip; - cr_begin(); - - dhcp_client_main(chip, "harness"); - - cr_end(); -} - struct { struct rp2040_hwspi dev_spi; struct w5500 dev_w5500; @@ -60,11 +50,19 @@ struct { struct lib9p_srv srv; } globals; +static COROUTINE dhcp_cr(void *) { + cr_begin(); + + dhcp_client_main(lo_box_w5500_if_as_net_iface(&globals.dev_w5500), "harness"); + + cr_end(); +} + static COROUTINE read9p_cr(void *) { cr_begin(); lib9p_srv_read_cr(&globals.srv, - VCALL(&globals.dev_w5500, tcp_listen, CONFIG_9P_PORT)); + LO_CALL(lo_box_w5500_if_as_net_iface(&globals.dev_w5500), tcp_listen, CONFIG_9P_PORT)); cr_end(); } @@ -120,7 +118,7 @@ COROUTINE init_cr(void *) { coroutine_add("usb_common", usb_common_cr, NULL); coroutine_add("usb_keyboard", usb_keyboard_cr, &globals.keyboard_chan); coroutine_add("hello_world", hello_world_cr, &globals.keyboard_chan); - coroutine_add_with_stack_size(4*1024, "dhcp", dhcp_cr, &globals.dev_w5500); + coroutine_add_with_stack_size(4*1024, "dhcp", dhcp_cr, NULL); for (int i = 0; i < _CONFIG_9P_NUM_SOCKS; i++) { char name[] = {'r', 'e', 'a', 'd', '-', hexdig[i], '\0'}; coroutine_add(name, read9p_cr, NULL); -- cgit v1.2.3-2-g168b