--- /dev/null
+/*
+ * Copyright (c) 2022 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 <stdlib.h>
+#include <dlfcn.h>
+#include <unistd.h>
+
+#include "hal-common-interface.h"
+
+/*
+ * All hal-backend-[module] (e.g., tbm/tdm/audio/camera/devcie/power etc)
+ * have to contain the their own hal_backend structure to implement
+ * the h/w device-dependent hal backend. Instead of adding the each hal_backend
+ * structure for all hal modules, use the common hal_backend_module_data
+ * regardless of hal module name. Below dlsym hooking function doesn't
+ * check the symbol name and then return the common hal_backend_module_data.
+ * */
+static int hal_backend_init(void **data) { return 0; }
+static int hal_backend_exit(void *data) { return 0; }
+
+hal_backend hal_backend_module_data = {
+ .name = "hal-backend-module",
+ .vendor = "hal-backend-vendor",
+ .abi_version = HAL_ABI_VERSION_TIZEN_7_0,
+ .init = hal_backend_init,
+ .exit = hal_backend_exit,
+};
+
+/*
+ * hal-api-common uses the dlopen/dlsym/dlclose/access to load/unload
+ * the shared library of hal backend and find symbol from hal backend library.
+ * For testing hal-api-common functions when building time, re-implement
+ * dlopen/dlsym/dlclose/access for hooking.By implementing the hooking functions,
+ * be able to verify the internal logic of hal-api-common functions.
+ */
+void *dlopen(const char *filename, int flags) {
+ return calloc(1, sizeof(void *));
+}
+
+int dlclose(void *handle) {
+ free(handle);
+ return 0;
+}
+
+void *dlsym(void *handle, const char *symbol) {
+ return (void *)&hal_backend_module_data;
+}
+
+int access(const char *pathname, int mode) {
+ return 0;
+}