[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT/PLAT_RASPI PATCH 14/14] plats/raspi: Adding independent LVGL driver compile option
Adding independent LVGL driver compile option plus a few minor changes. Signed-off-by: Santiago Pagani <santiagopagani@xxxxxxxxx> --- Config.uk | 22 ++++++++++++++++------ Makefile.uk | 7 +++++++ entry.S | 2 ++ include/raspi/sysregs.h | 20 +++++++++++++++----- lfb.c | 18 +++++++++++------- mbox.c | 1 + setup.c | 2 +- start.S | 21 +++++++++++++++++++-- touchscreen.c | 5 ++++- 9 files changed, 76 insertions(+), 22 deletions(-) diff --git a/Config.uk b/Config.uk index 618d51d..836283d 100644 --- a/Config.uk +++ b/Config.uk @@ -11,21 +11,18 @@ menu "Console Options" config RASPI_PRINTF_SERIAL_CONSOLE bool "Serial console for printf" default y - depends on ARCH_ARM_64 help Choose serial console for printf config RASPI_KERNEL_SERIAL_CONSOLE bool "Serial console for the kernel prints" default n - depends on ARCH_ARM_64 help Choose serial console for the kernel printing config RASPI_DEBUG_SERIAL_CONSOLE bool "Serial console for the debug prints" default n - depends on ARCH_ARM_64 help Choose serial console for the debug printing endmenu @@ -34,19 +31,32 @@ menu "Devices" config RASPI_LCD bool "DSI LCD screen" default n - depends on ARCH_ARM_64 + +choice + prompt "LCD print driver" + default RASPI_LVGL_DRIVER if (LIBLVGL) + default RASPI_SIMPLE_LCD_PRINT_FUNCTIONS + depends on RASPI_LCD + + config RASPI_SIMPLE_LCD_PRINT_FUNCTIONS + bool "Simple LCD print functions" + + config RASPI_LVGL_DRIVER + bool "LVGL LCD driver" + depends on LIBLVGL +endchoice config RASPI_TOUCHSCREEN bool "Touch screen" default n - depends on ARCH_ARM_64 + depends on RASPI_LCD + depends on LIBLVGL endmenu menu "Profiling" config RASPI_WATERMARK_STACK bool "Watermark Stack" default n - depends on ARCH_ARM_64 endmenu endif diff --git a/Makefile.uk b/Makefile.uk index 967a1c0..1c0e4c0 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -19,6 +19,13 @@ LIBRASPIPLAT_CINCLUDES-y += -I$(LIBRASPIPLAT_BASE)/include LIBRASPIPLAT_CINCLUDES-y += -I$(UK_PLAT_COMMON_BASE)/include LIBRASPIPLAT_CINCLUDES-y += -I$(UK_PLAT_DRIVERS_BASE)/include +# When running WAMR on the Raspberry Pi, we add support to WAMR for clock_gettime +# using the Raspberry Pi's system timer. Therefore, WAMR will need to include +# the raspi/time.h header to use the get_system_timer() function. +ifeq ($(CONFIG_PLAT_RASPI),y) +CINCLUDES-$(CONFIG_LIBWAMR) += -I$(LIBRASPIPLAT_BASE)/include +endif + LIBRASPIPLAT_ASFLAGS += -DRASPIPLAT LIBRASPIPLAT_CFLAGS += -DRASPIPLAT LIBRASPIPLAT_CXXFLAGS += -DRASPIPLAT diff --git a/entry.S b/entry.S index 4b7ff6c..a9d0deb 100644 --- a/entry.S +++ b/entry.S @@ -298,6 +298,7 @@ fiq_invalid_el0_32: error_invalid_el0_32: handle_invalid_entry ERROR_INVALID_EL0_32 +.align 6 el1_sync: kernel_entry mrs x0, ESR_EL1 @@ -305,6 +306,7 @@ el1_sync: bl show_invalid_entry_message_el1_sync b err_hang +.align 6 el1_irq: kernel_entry bl ukplat_irq_handle diff --git a/include/raspi/sysregs.h b/include/raspi/sysregs.h index f1d73e3..ef673c7 100644 --- a/include/raspi/sysregs.h +++ b/include/raspi/sysregs.h @@ -54,12 +54,22 @@ // *************************************** // SCTLR_EL1, System Control Register (EL1), Page 2654 of AArch64-Reference-Manual. // *************************************** -#define SCTLR_EL1_WFE_NORMAL (1 << 18) -#define SCTLR_EL1_WFI_NORMAL (1 << 16) -#define SCTLR_EL1_MMU_ENABLED (1 << 0) +#define SCTLR_EL1_WFE_NORMAL (1 << 18) +#define SCTLR_EL1_WFI_NORMAL (1 << 16) +#define SCTLR_EL1_INSTRUCTION_CACHE_ENABLED (1 << 12) +#define SCTLR_EL1_DATA_AND_UNIFIED_CACHE_ENABLED (1 << 2) +#define SCTLR_EL1_MMU_ENABLED (1 << 0) + +#define SCTLR_EL1_VALUE_MMU_AND_CACHES_DISABLED (SCTLR_EL1_WFE_NORMAL | SCTLR_EL1_WFI_NORMAL) +#define SCTLR_EL1_VALUE_MMU_ENABLED (SCTLR_EL1_WFE_NORMAL | SCTLR_EL1_WFI_NORMAL | SCTLR_EL1_MMU_ENABLED) +#define SCTLR_EL1_VALUE_MMU_AND_CACHES_ENABLED (SCTLR_EL1_WFE_NORMAL | SCTLR_EL1_WFI_NORMAL | SCTLR_EL1_INSTRUCTION_CACHE_ENABLED | SCTLR_EL1_DATA_AND_UNIFIED_CACHE_ENABLED | SCTLR_EL1_MMU_ENABLED) + +#define SCTLR_EL1_KVM_VALUE \ + ((1 << 26) | (1 << 18) | (1 << 16) | (1 << 15) | (1 << 14) | (1 << 12) | (1 << 8) | (1 << 4) | (1 << 3) | \ + (1 << 2) | (1 << 0) | (1 << 5) | \ + (1 << 11) | (1 << 20) | (1 << 22) | (1 << 23) | (1 << 28) | (1 << 29)) + -#define SCTLR_EL1_VALUE_MMU_DISABLED (SCTLR_EL1_WFE_NORMAL | SCTLR_EL1_WFI_NORMAL) -#define SCTLR_EL1_VALUE_MMU_ENABLED (SCTLR_EL1_WFE_NORMAL | SCTLR_EL1_WFI_NORMAL | SCTLR_EL1_MMU_ENABLED) #define SCTLR_EL2_VALUE (0) // *************************************** diff --git a/lfb.c b/lfb.c index b0ed92a..b2b49aa 100644 --- a/lfb.c +++ b/lfb.c @@ -27,10 +27,13 @@ #include <uk/print.h> #include <raspi/mbox.h> -#if CONFIG_LIBLVGL -#define LV_CONF_INCLUDE_SIMPLE +#if CONFIG_RASPI_LVGL_DRIVER +#ifndef LV_CONF_INCLUDE_SIMPLE + #define LV_CONF_INCLUDE_SIMPLE +#endif #include <lvgl.h> -#else +#endif +#if CONFIG_RASPI_SIMPLE_LCD_PRINT_FUNCTIONS #include <raspi/pixmaps.h> #endif @@ -42,7 +45,7 @@ static unsigned int width, height, pitch; static unsigned char *lfb; -#if CONFIG_LIBLVGL +#if CONFIG_RASPI_LVGL_DRIVER static lv_disp_buf_t lv_disp_buf; static lv_color_t lv_color_buf[SCREEN_WIDTH * 10]; static lv_disp_drv_t disp_drv; @@ -122,7 +125,7 @@ void lfb_init(void) } -#if CONFIG_LIBLVGL +#if CONFIG_RASPI_LVGL_DRIVER lv_init(); lv_disp_buf_init(&lv_disp_buf, lv_color_buf, NULL, SCREEN_WIDTH * 10); @@ -130,7 +133,8 @@ void lfb_init(void) disp_drv.flush_cb = lvgl_disp_flush; disp_drv.buffer = &lv_disp_buf; lv_disp_drv_register(&disp_drv); -#else +#endif +#if CONFIG_RASPI_SIMPLE_LCD_PRINT_FUNCTIONS letters_data [0x20 - LETTER_MIN] = (char *)letter_space_data; // 0x20 letters_data [0x21 - LETTER_MIN] = (char *)letter_exclamationmark_data; // 0x21 letters_data [0x22 - LETTER_MIN] = (char *)letter_quote_data; // 0x22 @@ -231,7 +235,7 @@ void lfb_init(void) } -#if !CONFIG_LIBLVGL +#if CONFIG_RASPI_SIMPLE_LCD_PRINT_FUNCTIONS #define HEADER_PIXEL(data,pixel) {\ pixel[2] = (((data[0] - 33) << 2) | ((data[1] - 33) >> 4)); \ pixel[1] = ((((data[1] - 33) & 0xF) << 4) | ((data[2] - 33) >> 2)); \ diff --git a/mbox.c b/mbox.c index a19b0e9..196e0de 100644 --- a/mbox.c +++ b/mbox.c @@ -26,6 +26,7 @@ #include <raspi/mbox.h> #include <raspi/sysregs.h> +#include <uk/arch/lcpu.h> /* mailbox message buffer */ volatile unsigned int __attribute__((aligned(16))) mbox[MBOX_BUFFER_LENGTH]; diff --git a/setup.c b/setup.c index 6081cc6..48353a0 100644 --- a/setup.c +++ b/setup.c @@ -47,7 +47,7 @@ #include <uk/print.h> #include <uk/arch/types.h> -//smcc_psci_callfn_t smcc_psci_call; +smcc_psci_callfn_t smcc_psci_call; static uint64_t assembly_entry; static uint64_t hardware_init_done; diff --git a/start.S b/start.S index 04c938d..7a068a2 100644 --- a/start.S +++ b/start.S @@ -50,7 +50,7 @@ hang: wfe // Continue if cpu id == 0 master: - ldr x0, =SCTLR_EL1_VALUE_MMU_DISABLED + ldr x0, =SCTLR_EL1_VALUE_MMU_AND_CACHES_DISABLED msr sctlr_el1, x0 ldr x0, =SCTLR_EL2_VALUE @@ -78,6 +78,22 @@ master: eret el1_entry: + /* Set the context id */ + msr contextidr_el1, xzr + + /* + * Using dsb here to guarantee the create_pagetables has + * been done. + */ + dsb sy + + /* Clear the Monitor Debug System control register */ + msr mdscr_el1, xzr + + /* Invalidate the TLB to avoid stale one */ + tlbi vmalle1 + dsb nsh + bl create_page_tables adrp x0, _pagetables @@ -91,8 +107,9 @@ el1_entry: msr mair_el1, x0 ldr x4, =_libraspiplat_entry - ldr x5, =SCTLR_EL1_VALUE_MMU_ENABLED + ldr x5, =SCTLR_EL1_KVM_VALUE msr sctlr_el1, x5 + isb #if CONFIG_RASPI_WATERMARK_STACK diff --git a/touchscreen.c b/touchscreen.c index a9b1d8a..5f18576 100644 --- a/touchscreen.c +++ b/touchscreen.c @@ -13,8 +13,11 @@ #include <string.h> #include <raspi/mbox.h> #include <raspi/touchscreen.h> +#include <uk/arch/lcpu.h> -#define LV_CONF_INCLUDE_SIMPLE +#ifndef LV_CONF_INCLUDE_SIMPLE + #define LV_CONF_INCLUDE_SIMPLE +#endif #include <lvgl.h> static unsigned char *touchscreen; -- 2.17.1 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |