From: Yunmi Ha Date: Thu, 18 Feb 2021 05:09:42 +0000 (+0900) Subject: memory: add new halapi backend X-Git-Tag: submit/tizen/20210607.045509~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3cca1823e9abcec8d43cac400347afd075a6d128;p=platform%2Fhal%2Fbackend%2Femulator%2Fdevice-emulator.git memory: add new halapi backend Change-Id: I0f6af33a21c2e3257b9659b10e247942e98bb1d7 Signed-off-by: Yunmi Ha --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 9552c7d..00365bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,3 +31,4 @@ ADD_SUBDIRECTORY(hw/display) ADD_SUBDIRECTORY(hw/external_connection) ADD_SUBDIRECTORY(hw/usb_gadget) ADD_SUBDIRECTORY(hw/haptic) +ADD_SUBDIRECTORY(hw/memory) diff --git a/hw/memory/CMakeLists.txt b/hw/memory/CMakeLists.txt new file mode 100644 index 0000000..a35248a --- /dev/null +++ b/hw/memory/CMakeLists.txt @@ -0,0 +1,18 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(hal-backend-device-memory C) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) + +INCLUDE(FindPkgConfig) +pkg_check_modules(hal-backend-device-memory_pkgs REQUIRED dlog) + +FOREACH(flag ${hal-backend-device-memory_pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +ADD_LIBRARY(${PROJECT_NAME} MODULE memory.c) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${hal-backend-device-memory_pkgs_LDFLAGS}) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${HAL_LIB_DIR} COMPONENT RuntimeLibraries) diff --git a/hw/memory/memory.c b/hw/memory/memory.c new file mode 100644 index 0000000..908907a --- /dev/null +++ b/hw/memory/memory.c @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +#include +#include + +#include + +static int memory_get_gpu_info(const int pid, struct gpu_info *info) +{ + return -EINVAL; +} + +static int memory_get_gem_info(const int pid, struct gem_info *info) +{ + return -EINVAL; +} + +static int memory_init(void **data) +{ + hal_backend_memory_funcs *memory_funcs; + + memory_funcs = calloc(1, sizeof(hal_backend_memory_funcs)); + if (!memory_funcs) + return -ENOMEM; + + memory_funcs->get_gpu_info = memory_get_gpu_info; + memory_funcs->get_gem_info = memory_get_gem_info; + + *data = (void *)memory_funcs; + + return 0; +} + +static int memory_exit(void *data) +{ + free(data); + return 0; +} + +hal_backend EXPORT hal_backend_device_memory_data = { + .name = "memory", + .vendor = "EMUL", + .abi_version = HAL_ABI_VERSION_TIZEN_6_5, + .init = memory_init, + .exit = memory_exit, +};