diff options
author | Uros Majstorovic <majstor@majstor.org> | 2022-08-09 23:07:38 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2022-08-09 23:07:38 +0200 |
commit | b45c75151af9e31c2016fa30dc071f9695d6369c (patch) | |
tree | 590651bd3c37d0cb74a7414637b370d286368ff0 | |
parent | 76ed6228dc0b88840d01f99761ca09323bf11c51 (diff) |
fixed test
-rw-r--r-- | fw/fe310/test/Makefile | 33 | ||||
-rw-r--r-- | fw/fe310/test/app/app_root.c | 4 | ||||
-rw-r--r-- | fw/fe310/test/app/app_status.c | 6 | ||||
-rw-r--r-- | fw/fe310/test/cam.c | 16 | ||||
-rw-r--r-- | fw/fe310/test/cell_dev.c | 4 | ||||
-rw-r--r-- | fw/fe310/test/cell_pdp.c | 14 | ||||
-rw-r--r-- | fw/fe310/test/fs.c | 8 | ||||
-rw-r--r-- | fw/fe310/test/main.c | 52 | ||||
-rw-r--r-- | fw/fe310/test/modem.c | 8 | ||||
-rw-r--r-- | fw/fe310/test/phone.c | 12 | ||||
-rw-r--r-- | fw/fe310/test/test.c | 12 | ||||
-rw-r--r-- | fw/fe310/test/wifi.c | 16 |
12 files changed, 99 insertions, 86 deletions
diff --git a/fw/fe310/test/Makefile b/fw/fe310/test/Makefile new file mode 100644 index 0000000..fedd417 --- /dev/null +++ b/fw/fe310/test/Makefile @@ -0,0 +1,33 @@ +include ../common.mk +DEPS = main.o mem.o cell_dev.o phone.o modem.o cam.o fs.o test.o + +lib_eos = eve eos eos-soc eos-dev eos-net eos-ext eos-bsp +lib_ecp = + +# DEPS += ecp.o ecp_init.o audio.o +# lib_ecp += ecp ecpcr ecptr ecptm ecpdir ecpvconn + +CFLAGS += -I$(bsp_dir)/include -I$(bsp_dir)/drivers -I$(ext_dir)/crypto -I$(ext_dir)/fsfat -I$(ecp_dir)/src -I$(ecp_dir)/src/platform/fe310 -I.. +LDFLAGS = app/*.o $(CFLAGS) -L.. -L$(ecp_dir)/build-fe310 -Wl,--gc-sections -nostartfiles -nostdlib -Wl,--start-group -lc -lm -lgcc $(LIBS_ECP) $(LIBS_EOS) -Wl,--end-group -T../bsp/default.lds +LDFLAGS = app/*.o $(CFLAGS) -L.. -L$(ecp_dir)/build-fe310 -Wl,--gc-sections -nostartfiles -nostdlib -Wl,--start-group -lc -lm -lgcc $(addprefix -l,$(lib_eos)) $(addprefix -l,$(lib_ecp)) -Wl,--end-group -T../bsp/default.lds +TARGET = phone + + +all: $(TARGET) + +app_: + (cd app && $(MAKE)) || exit; + +%.o: %.c + $(CC) $(CFLAGS) -c $< + +$(TARGET): app_ $(DEPS) + $(CC) $(DEPS) $(LDFLAGS) -o $@ + +clean: + (cd app && $(MAKE) clean) || exit; + rm -f *.o *.a $(TARGET) + +upload: $(TARGET) + ../bsp/upload --elf ./$(TARGET) --openocd $(RISCV_OPENOCD_HOME)/bin/openocd --gdb $(RISCV_HOME)/bin/riscv64-unknown-elf-gdb --openocd-config ../bsp/openocd.cfg + diff --git a/fw/fe310/test/app/app_root.c b/fw/fe310/test/app/app_root.c index e6de2d1..18ca284 100644 --- a/fw/fe310/test/app/app_root.c +++ b/fw/fe310/test/app/app_root.c @@ -1,6 +1,6 @@ #include <stdlib.h> -#include <net.h> +#include <dev/net.h> #include <eve/eve.h> #include <eve/eve_kbd.h> @@ -10,8 +10,6 @@ #include <eve/screen/page.h> #include <eve/screen/form.h> -#include <eve/widget/widgets.h> - #include "app_status.h" #include "app_root.h" diff --git a/fw/fe310/test/app/app_status.c b/fw/fe310/test/app/app_status.c index cc25599..bbe906d 100644 --- a/fw/fe310/test/app/app_status.c +++ b/fw/fe310/test/app/app_status.c @@ -4,8 +4,8 @@ #include <string.h> #include <eos.h> -#include <net.h> -#include <cell.h> +#include <dev/net.h> +#include <net/cell.h> #include <eve/eve.h> #include <eve/eve_kbd.h> @@ -15,8 +15,6 @@ #include <eve/screen/page.h> #include <eve/screen/form.h> -#include <eve/widget/widgets.h> - #include "app_root.h" #include "app_status.h" diff --git a/fw/fe310/test/cam.c b/fw/fe310/test/cam.c index 766884b..7e84cdf 100644 --- a/fw/fe310/test/cam.c +++ b/fw/fe310/test/cam.c @@ -4,11 +4,11 @@ #include <string.h> #include <eos.h> -#include <cam.h> #include <board.h> +#include <soc/i2c.h> -#include <i2c.h> -#include <i2c/ov2640.h> +#include <dev/cam.h> +#include <dev/ov2640.h> #include <eve/eve.h> #include <eve/eve_kbd.h> @@ -18,8 +18,6 @@ #include <eve/screen/page.h> #include <eve/screen/form.h> -#include <eve/widget/widgets.h> - #include "app/app_root.h" #include "cam.h" @@ -125,12 +123,12 @@ void fbuf_print(uint8_t *fbuf, size_t size) { } void app_cam(EVEWindow *window, EVEViewStack *stack) { - EVEWidgetSpec spec[] = { + EVEFormSpec spec[] = { { .widget.type = EVE_WIDGET_TYPE_FREE, .widget.g.h = CAM_W, - .widget.spec.free.draw = image_draw, - .widget.spec.free.touch = image_touch, + .widget.tspec.free.draw = image_draw, + .widget.tspec.free.touch = image_touch, }, }; EVEForm *form = eve_form_create(window, stack, spec, 1, NULL, NULL, app_cam_close); @@ -140,11 +138,9 @@ void app_cam(EVEWindow *window, EVEViewStack *stack) { eos_time_sleep(100); eos_i2c_speed(100000); - eos_i2c_start(); rv = eos_ov2640_init(); if (!rv) rv = eos_ov2640_set_pixfmt(PIXFORMAT_JPEG); if (!rv) rv = eos_ov2640_set_framesize(FRAMESIZE_VGA); - eos_i2c_stop(); eos_i2c_speed(EOS_I2C_SPEED); if (!rv) { diff --git a/fw/fe310/test/cell_dev.c b/fw/fe310/test/cell_dev.c index 492ba22..9598bc4 100644 --- a/fw/fe310/test/cell_dev.c +++ b/fw/fe310/test/cell_dev.c @@ -4,8 +4,8 @@ #include <string.h> #include <eos.h> -#include <net.h> -#include <cell.h> +#include <dev/net.h> +#include <net/cell.h> #include <eve/eve.h> #include <eve/eve_kbd.h> diff --git a/fw/fe310/test/cell_pdp.c b/fw/fe310/test/cell_pdp.c index 724cca7..e67ddb2 100644 --- a/fw/fe310/test/cell_pdp.c +++ b/fw/fe310/test/cell_pdp.c @@ -4,8 +4,8 @@ #include <string.h> #include <eos.h> -#include <net.h> -#include <cell.h> +#include <dev/net.h> +#include <net/cell.h> #include <eve/eve.h> #include <eve/eve_kbd.h> @@ -15,8 +15,6 @@ #include <eve/screen/page.h> #include <eve/screen/form.h> -#include <eve/widget/widgets.h> - #include "app/app_root.h" #include "app/app_status.h" @@ -63,27 +61,27 @@ static void cell_pdp_handler(unsigned char type, unsigned char *buffer, uint16_t } void app_cell_pdp(EVEWindow *window, EVEViewStack *stack) { - EVEWidgetSpec spec[] = { + EVEFormSpec spec[] = { { .label.g.w = APP_SCREEN_W / 3, .label.title = "APN:", .widget.type = EVE_WIDGET_TYPE_STR, - .widget.spec.str.str_size = 128, + .widget.tspec.str.str_size = 128, }, { .label.g.w = APP_SCREEN_W / 3, .label.title = "User:", .widget.type = EVE_WIDGET_TYPE_STR, - .widget.spec.str.str_size = 128, + .widget.tspec.str.str_size = 128, }, { .label.g.w = APP_SCREEN_W / 3, .label.title = "Pass:", .widget.type = EVE_WIDGET_TYPE_STR, - .widget.spec.str.str_size = 128, + .widget.tspec.str.str_size = 128, }, }; diff --git a/fw/fe310/test/fs.c b/fw/fe310/test/fs.c index 1dce3af..0b3d4dc 100644 --- a/fw/fe310/test/fs.c +++ b/fw/fe310/test/fs.c @@ -4,7 +4,7 @@ #include <string.h> #include <eos.h> -#include <sdc_crypto.h> +#include <dev/sdc_crypto.h> #include <eve/eve.h> #include <eve/eve_kbd.h> #include <eve/eve_font.h> @@ -13,8 +13,6 @@ #include <eve/screen/page.h> #include <eve/screen/form.h> -#include <eve/widget/widgets.h> - #include <aes/aes.h> #include <ff.h> @@ -35,11 +33,11 @@ static AESCtx ctx_crypt; static AESCtx ctx_essiv; void app_fs(EVEWindow *window, EVEViewStack *stack) { - EVEWidgetSpec spec[] = { + EVEFormSpec spec[] = { { .label.title = "Text", .widget.type = EVE_WIDGET_TYPE_STR, - .widget.spec.str.str_size = TEXT_SIZE, + .widget.tspec.str.str_size = TEXT_SIZE, }, }; EVEForm *form = eve_form_create(window, stack, spec, 1, NULL, NULL, app_fs_close); diff --git a/fw/fe310/test/main.c b/fw/fe310/test/main.c index 2fc1a04..f292ecf 100644 --- a/fw/fe310/test/main.c +++ b/fw/fe310/test/main.c @@ -3,9 +3,12 @@ #include <unistd.h> #include <string.h> +#include <prci_driver.h> + #include <eos.h> -#include <timer.h> -#include <pwr.h> +#include <soc/timer.h> +#include <soc/pwr.h> +#include <dev/eve.h> #include <eve/eve.h> #include <eve/eve_kbd.h> @@ -15,10 +18,6 @@ #include <eve/screen/page.h> #include <eve/screen/form.h> -#include <eve/widget/widgets.h> - -#include <prci_driver.h> - #include "app/app_root.h" #include "cell_dev.h" @@ -30,57 +29,57 @@ #include "fs.h" #include "test.h" -const uint32_t _eos_touch_matrix[6] = {0xf7ac,0x440,0x3e704,0xfffff718,0x108a3,0xfff76d42}; +static const uint32_t touch_matrix[6] = {0xf7ac,0x440,0x3e704,0xfffff718,0x108a3,0xfff76d42}; void app_home_page(EVEWindow *window, EVEViewStack *stack) { - EVEWidgetSpec spec[] = { + EVEFormSpec spec[] = { /* { .widget.type = EVE_WIDGET_TYPE_PAGE, .widget.g.w = APP_SCREEN_W, - .widget.spec.page.title = "Phone", - .widget.spec.page.constructor = app_phone + .widget.tspec.page.title = "Phone", + .widget.tspec.page.constructor = app_phone }, { .widget.type = EVE_WIDGET_TYPE_PAGE, .widget.g.w = APP_SCREEN_W, - .widget.spec.page.title = "WiFi", - .widget.spec.page.constructor = app_wifi + .widget.tspec.page.title = "WiFi", + .widget.tspec.page.constructor = app_wifi }, { .widget.type = EVE_WIDGET_TYPE_PAGE, .widget.g.w = APP_SCREEN_W, - .widget.spec.page.title = "Cellular data", - .widget.spec.page.constructor = app_cell_pdp + .widget.tspec.page.title = "Cellular data", + .widget.tspec.page.constructor = app_cell_pdp }, { .widget.type = EVE_WIDGET_TYPE_PAGE, .widget.g.w = APP_SCREEN_W, - .widget.spec.page.title = "Modem", - .widget.spec.page.constructor = app_modem + .widget.tspec.page.title = "Modem", + .widget.tspec.page.constructor = app_modem }, { .widget.type = EVE_WIDGET_TYPE_PAGE, .widget.g.w = APP_SCREEN_W, - .widget.spec.page.title = "Camera", - .widget.spec.page.constructor = app_cam + .widget.tspec.page.title = "Camera", + .widget.tspec.page.constructor = app_cam }, - */ { .widget.type = EVE_WIDGET_TYPE_PAGE, .widget.g.w = APP_SCREEN_W, - .widget.spec.page.title = "File system", - .widget.spec.page.constructor = app_fs + .widget.tspec.page.title = "File system", + .widget.tspec.page.constructor = app_fs }, + */ { .widget.type = EVE_WIDGET_TYPE_PAGE, .widget.g.w = APP_SCREEN_W, - .widget.spec.page.title = "Test", - .widget.spec.page.constructor = app_test + .widget.tspec.page.title = "Test", + .widget.tspec.page.constructor = app_test }, }; - EVEForm *form = eve_form_create(window, stack, spec, 2, NULL, NULL, NULL); + EVEForm *form = eve_form_create(window, stack, spec, 1, NULL, NULL, NULL); } void print_mem(void); @@ -88,16 +87,19 @@ void print_mem(void); int main() { eos_init(); // eos_run_once(); + eos_eve_set_touch_matrix(touch_matrix); printf("FREQ:%lu\n", PRCI_get_cpu_freq()); printf("\nREADY.\n"); - app_root_init(app_home_page, 0x10); + app_root_init(app_home_page, 0x20); + /* app_phone_init(); app_wifi_init(); app_cell_dev_init(); app_cell_pdp_init(); app_fs_init(); + */ // audio_start(); // app_ecp_init(); diff --git a/fw/fe310/test/modem.c b/fw/fe310/test/modem.c index 89ff32a..0921be9 100644 --- a/fw/fe310/test/modem.c +++ b/fw/fe310/test/modem.c @@ -4,9 +4,9 @@ #include <string.h> #include <eos.h> -#include <uart.h> -#include <net.h> -#include <cell.h> +#include <soc/uart.h> +#include <dev/net.h> +#include <net/cell.h> #include <eve/eve.h> #include <eve/eve_kbd.h> @@ -17,8 +17,6 @@ #include <eve/screen/page.h> #include <eve/screen/form.h> -#include <eve/widget/widgets.h> - #include "app/app_root.h" #include "modem.h" diff --git a/fw/fe310/test/phone.c b/fw/fe310/test/phone.c index 0027d77..cc70549 100644 --- a/fw/fe310/test/phone.c +++ b/fw/fe310/test/phone.c @@ -4,9 +4,9 @@ #include <string.h> #include <eos.h> -#include <i2s.h> -#include <net.h> -#include <cell.h> +#include <soc/i2s.h> +#include <dev/net.h> +#include <net/cell.h> #include <eve/eve.h> #include <eve/eve_kbd.h> @@ -16,8 +16,6 @@ #include <eve/screen/page.h> #include <eve/screen/form.h> -#include <eve/widget/widgets.h> - #include "app/app_root.h" #include "app/app_status.h" @@ -85,12 +83,12 @@ static void cell_voice_handler(unsigned char type, unsigned char *buffer, uint16 } void app_phone(EVEWindow *window, EVEViewStack *stack) { - EVEWidgetSpec spec[] = { + EVEFormSpec spec[] = { { .label.title = "Phone:", .widget.type = EVE_WIDGET_TYPE_STR, - .widget.spec.str.str_size = 128, + .widget.tspec.str.str_size = 128, }, }; diff --git a/fw/fe310/test/test.c b/fw/fe310/test/test.c index fddbbc1..fc080d2 100644 --- a/fw/fe310/test/test.c +++ b/fw/fe310/test/test.c @@ -5,8 +5,8 @@ #include <eos.h> -#include <i2c.h> -#include <i2c/bq25895.h> +#include <soc/i2c.h> +#include <dev/bq25895.h> #include <eve/eve.h> #include <eve/eve_kbd.h> #include <eve/eve_font.h> @@ -15,8 +15,6 @@ #include <eve/screen/page.h> #include <eve/screen/form.h> -#include <eve/widget/widgets.h> - #include "app/app_root.h" #include "test.h" @@ -34,15 +32,13 @@ int app_test_uievt(EVEForm *form, uint16_t evt, void *param) { int rv, ret = 0, i; switch (evt) { - case EVE_UIEVT_PAGE_TOUCH: + case EVE_UIEVT_GEST_TOUCH: printf("PAGE TOUCH\n"); printf("BQ25895:\n"); - eos_i2c_start(); for (i=0; i<0x15; i++) { rv = reg_read(i, &data); if (!rv) printf("REG%02x: %02x\n", i, data); } - eos_i2c_stop(); break; default: @@ -53,7 +49,7 @@ int app_test_uievt(EVEForm *form, uint16_t evt, void *param) { } void app_test(EVEWindow *window, EVEViewStack *stack) { - EVEWidgetSpec spec[] = { + EVEFormSpec spec[] = { { .widget.type = EVE_WIDGET_TYPE_SPACER, .widget.g.h = 1, diff --git a/fw/fe310/test/wifi.c b/fw/fe310/test/wifi.c index e7522e3..92be3db 100644 --- a/fw/fe310/test/wifi.c +++ b/fw/fe310/test/wifi.c @@ -4,8 +4,8 @@ #include <string.h> #include <eos.h> -#include <net.h> -#include <wifi.h> +#include <dev/net.h> +#include <net/wifi.h> #include <eve/eve.h> #include <eve/eve_kbd.h> @@ -15,8 +15,6 @@ #include <eve/screen/page.h> #include <eve/screen/form.h> -#include <eve/widget/widgets.h> - #include "app/app_root.h" #include "app/app_status.h" @@ -28,7 +26,7 @@ static void wifi_scan_handler(unsigned char type, unsigned char *buffer, uint16_ EVEForm *form = (EVEForm *)window->view; EVESelectWidget *select = (EVESelectWidget *)eve_page_widget(&form->p, 0); - eve_selectw_option_set(select, buffer + 1, size - 1); + eve_selectw_set_option(select, buffer + 1, size - 1); eos_net_free(buffer, 0); app_root_refresh(); @@ -45,14 +43,14 @@ static void wifi_disconnect_handler(unsigned char type, unsigned char *buffer, u } void app_wifi(EVEWindow *window, EVEViewStack *stack) { - EVEWidgetSpec spec[] = { + EVEFormSpec spec[] = { { .label.g.w = APP_SCREEN_W, .label.title = "Select network:", .widget.type = EVE_WIDGET_TYPE_SELECT, .widget.g.w = APP_SCREEN_W, - .widget.spec.select.option_size = 1500, + .widget.tspec.select.option_size = 1500, }, { .widget.type = EVE_WIDGET_TYPE_SPACER, @@ -63,7 +61,7 @@ void app_wifi(EVEWindow *window, EVEViewStack *stack) { .label.title = "Password:", .widget.type = EVE_WIDGET_TYPE_STR, - .widget.spec.str.str_size = 128, + .widget.tspec.str.str_size = 128, }, }; @@ -74,7 +72,7 @@ void app_wifi(EVEWindow *window, EVEViewStack *stack) { void app_wifi_action(EVEForm *form) { EVESelectWidget *sel = (EVESelectWidget *)eve_page_widget(&form->p, 0); EVEStrWidget *str = (EVEStrWidget *)eve_page_widget(&form->p, 2); - char *ssid = eve_selectw_option_get_select(sel); + char *ssid = eve_selectw_option_selected(sel); if (ssid) { eos_wifi_auth(ssid, str->str, NULL); |