From fadb8fb006b601ec88e302e398514647e0bff7d0 Mon Sep 17 00:00:00 2001 From: xiexg-dc Date: Tue, 26 Apr 2022 16:42:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9C=A8riscv32=5Fvirt=E4=B8=AD?= =?UTF-8?q?=E6=96=B0=E5=A2=9Eace=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #I54T8O Signed-off-by: xiexg-dc Change-Id: I0e2e800c26d32ca97a7607c833c0736083219d99 --- riscv32_virt/liteos_m/board/libc/utils.c | 59 ++++++++++++++++++- riscv32_virt/liteos_m/board/ui/BUILD.gn | 4 +- riscv32_virt/liteos_m/board/ui/ui_adapter.cpp | 18 ++++++ 3 files changed, 78 insertions(+), 3 deletions(-) diff --git a/riscv32_virt/liteos_m/board/libc/utils.c b/riscv32_virt/liteos_m/board/libc/utils.c index 2e34d5a..fcf27fe 100644 --- a/riscv32_virt/liteos_m/board/libc/utils.c +++ b/riscv32_virt/liteos_m/board/libc/utils.c @@ -13,6 +13,9 @@ * limitations under the License. */ +#include +#include "stdlib.h" +#include "ohos_mem_pool.h" #include "hiview_log.h" #include "los_debug.h" @@ -59,4 +62,58 @@ void SystemAdapterInit(void) /* register hilog output func for mini */ HiviewRegisterHilogProc(HilogProc_Impl); -} \ No newline at end of file +} + +/** + * @brief implement for ohos_mem_pool.h + */ +void *OhosMalloc(MemType type, uint32 size) +{ + if (size == 0) { + return NULL; + } + return malloc(size); +} + +void OhosFree(void *ptr) +{ + free(ptr); +} + +/* implementation for js_app_host.h: LP_TaskBegin */ +void LP_TaskBegin(void) +{ +} + +/* implementation for js_app_host.h: LP_TaskEnd */ +void LP_TaskEnd(void) +{ +} + +/** + * @brief adapter for js_ability.cpp + * #ifdef OHOS_ACELITE_PRODUCT_WATCH + */ +void RestoreSystemWrapper(const char *crashMessage) +{ + printf("%s\n", crashMessage); +} + +int access(const char *pathname, int mode) +{ + struct stat f_info; + + if (stat(pathname, &f_info) == 0) { + if (f_info.st_mode & S_IFDIR) { + return 0; + } else if (f_info.st_mode & S_IFREG) { + return 0; + } else { + return -1; + } + } else { + return -1; + } + + return 0; +} diff --git a/riscv32_virt/liteos_m/board/ui/BUILD.gn b/riscv32_virt/liteos_m/board/ui/BUILD.gn index 5d2962c..453f121 100644 --- a/riscv32_virt/liteos_m/board/ui/BUILD.gn +++ b/riscv32_virt/liteos_m/board/ui/BUILD.gn @@ -12,7 +12,7 @@ # limitations under the License. declare_args() { - riscv_ace_enable = false + riscv_ace_enable = true } import("//drivers/adapter/khdf/liteos_m/hdf.gni") @@ -33,7 +33,7 @@ hdf_driver("ui_adapter") { public_deps = [ "//foundation/graphic/ui:ui" ] if (riscv_ace_enable) { defines = [ "ENABLE_ACE" ] - public_deps += [ "//foundation/ace/ace_engine_lite/frameworks:ace_lite" ] + public_deps += [ "//foundation/arkui/ace_engine_lite/frameworks:ace_lite" ] } include_dirs = [ diff --git a/riscv32_virt/liteos_m/board/ui/ui_adapter.cpp b/riscv32_virt/liteos_m/board/ui/ui_adapter.cpp index 446b449..22edbdf 100644 --- a/riscv32_virt/liteos_m/board/ui/ui_adapter.cpp +++ b/riscv32_virt/liteos_m/board/ui/ui_adapter.cpp @@ -30,6 +30,10 @@ #include "ui_adapter.h" #define ENABLE_FPS +#ifdef ENABLE_ACE +#include "product_adapter.h" +#endif + #define FONT_MEM_LEN (512 * 1024) static uint32_t g_fontMemBaseAddr[OHOS::MIN_FONT_PSRAM_LENGTH / 4]; @@ -73,18 +77,32 @@ __attribute__((weak)) void RunApp(void) GRAPHIC_LOGI("RunApp default"); } +#ifdef ENABLE_ACE +static void RenderTEHandler() +{ +} +#endif + static void UiAdapterTask(void *arg) { (void)arg; UiAdapterInit(); RunApp(); +#ifdef ENABLE_ACE + const ACELite::TEHandlingHooks hooks = {RenderTEHandler, nullptr}; + ACELite::ProductAdapter::RegTEHandlers(hooks); +#endif #ifdef ENABLE_FPS uint32_t cnt = 0; uint32_t start = HALTick::GetInstance().GetTime(); #endif while (1) { +#ifdef ENABLE_ACE + // Here render all js app in the same task. + ACELite::ProductAdapter::DispatchTEMessage(); +#endif DispDev::GetInstance()->UpdateFBBuffer(); uint32_t temp = HALTick::GetInstance().GetTime(); TaskManager* inst = TaskManager::GetInstance(); -- Gitee