CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(hal-api-common C CXX)
+PROJECT(hal-api-common)
SET(VERSION_MAJOR 0)
SET(VERSION "${VERSION_MAJOR}.1.0")
SET(LIBDIR ${CMAKE_LIBDIR_PREFIX})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)
SET(PKG_MODULES
dlog
gio-2.0
glib-2.0
+ json-glib-1.0
+ libtzplatform-config
)
INCLUDE(FindPkgConfig)
ADD_DEFINITIONS("-DLOG_TAG=\"HALAPI_COMMON\"")
SET(SRCS
- src/hal-api-common.c)
+ src/hal-api-common.c
+ src/hal-api-conf.c)
ADD_LIBRARY( ${PROJECT_NAME} SHARED ${SRCS})
TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${pkgs_LDFLAGS} -ldl -Wl,-z,nodelete,--no-undefined)
FILES_MATCHING PATTERN "*.h")
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc
DESTINATION ${LIBDIR}/pkgconfig)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hal-api.json DESTINATION /etc/hal)
ADD_SUBDIRECTORY(haltests)
--- /dev/null
+{
+ "PLATFORM_ABI_VERSION" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "MODULE_INFO" :
+ {
+ "HAL_GROUP_GRAPHICS" :
+ [
+ {
+ "module" :"HAL_MODULE_TBM",
+ "license" :"MIT",
+ "library_name" :"/hal/lib/libhal-backend-tbm.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-tbm.so",
+ "symbol_name" :"hal_backend_tbm_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_TDM",
+ "license" :"MIT",
+ "library_name" :"/hal/lib/libhal-backend-tdm.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-tdm.so",
+ "symbol_name" :"hal_backend_tdm_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_COREGL",
+ "license" :"UNKNOWN",
+ "library_name" :null,
+ "library_name_64bit" :null,
+ "symbol_name" :null,
+ "abi_versions" :null
+ },
+ {
+ "module" :"HAL_MODULE_INPUT",
+ "license" :"MIT",
+ "library_name" :null,
+ "library_name_64bit" :null,
+ "symbol_name" :null,
+ "abi_versions" :null
+
+ }
+ ],
+
+ "HAL_GROUP_MULTIMEDIA":
+ [
+ {
+ "module" :"HAL_MODULE_AUDIO",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-audio.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-audio.so",
+ "symbol_name" :"hal_backend_audio_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_CAMERA",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-camera.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-camera.so",
+ "symbol_name" :"hal_backend_camera_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_RADIO",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-radio.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-radio.so",
+ "symbol_name" :"hal_backend_radio_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_CODEC",
+ "license" :"APACHE_2_0",
+ "library_name" :null,
+ "library_name_64bit" :null,
+ "symbol_name" :null,
+ "abi_versions" :null
+ },
+ {
+ "module" :"HAL_MODULE_USB_AUDIO",
+ "license" :"APACHE_2_0",
+ "library_name" :null,
+ "library_name_64bit" :null,
+ "symbol_name" :null,
+ "abi_versions" :null
+ },
+ {
+ "module" :"HAL_MODULE_ALSAUCM",
+ "license" :"APACHE_2_0",
+ "library_name" :null,
+ "library_name_64bit" :null,
+ "symbol_name" :null,
+ "abi_versions" :null
+ }
+ ],
+
+ "HAL_GROUP_CONNECTIVITY":
+ [
+ {
+ "module" :"HAL_MODULE_BLUETOOTH",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-bluetooth.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-bluetooth.so",
+ "symbol_name" :"hal_backend_bluetooth_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_WIFI",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-wifi.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-wifi.so",
+ "symbol_name" :"hal_backend_wifi_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_NAN",
+ "license" :"APACHE_2_0",
+ "library_name" :null,
+ "library_name_64bit" :null,
+ "symbol_name" :null,
+ "abi_versions" :null
+ },
+ {
+ "module" :"HAL_MODULE_NFC",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-nfc.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-nfc.so",
+ "symbol_name" :"hal_backend_nfc_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_ZIGBEE",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-zigbee.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-zigbee.so",
+ "symbol_name" :"hal_backend_zigbee_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+
+ },
+ {
+ "module" :"HAL_MODULE_UWB",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-uwb.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-uwb.so",
+ "symbol_name" :"hal_backend_uwb_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_MTP",
+ "license" :"APACHE_2_0",
+ "library_name" :null,
+ "library_name_64bit" :null,
+ "symbol_name" :null,
+ "abi_versions" :null
+ }
+
+ ],
+
+ "HAL_GROUP_TELEPHONY" :
+ [
+ {
+ "module" :"HAL_MODULE_TELEPHONY",
+ "license" :"APACHE_2_0",
+ "library_name" :null,
+ "library_name_64bit" :null,
+ "symbol_name" :null,
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ }
+ ],
+
+ "HAL_GROUP_LOCATION" :
+ [
+ {
+ "module" :"HAL_MODULE_LOCATION",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-location.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-location.so",
+ "symbol_name" :"hal_backend_location_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ }
+ ],
+
+ "HAL_GROUP_SYSTEM" :
+ [
+ {
+ "module" :"HAL_MODULE_COMMON",
+ "license" :"APACHE_2_0",
+ "library_name" :null,
+ "library_name_64bit" :null,
+ "symbol_name" :null,
+ "abi_versions" :null
+ },
+ {
+ "module" :"HAL_MODULE_POWER",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-power.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-power.so",
+ "symbol_name" :"hal_backend_power_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_SENSOR",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-sensor.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-sensor.so",
+ "symbol_name" :"hal_backend_sensor_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_PERIPHERAL",
+ "license" :"APACHE_2_0",
+ "library_name" :null,
+ "library_name_64bit" :null,
+ "symbol_name" :null,
+ "abi_versions" :null
+ },
+ {
+ "module" :"HAL_MODULE_DEVICE_BATTERY",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-device-battery.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-device-battery.so",
+ "symbol_name" :"hal_backend_device_battery_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_DEVICE_BEZEL",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-device-bezel.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-device-bezel.so",
+ "symbol_name" :"hal_backend_device_bezel_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_DEVICE_DISPLAY",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-device-display.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-device-display.so",
+ "symbol_name" :"hal_backend_device_display_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_DEVICE_IR",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-device-ir.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-device-ir.so",
+ "symbol_name" :"hal_backend_device_ir_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_DEVICE_TOUCHSCREEN",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-device-touchscreen.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-device-touchscreen.so",
+ "symbol_name" :"hal_backend_device_touchscreen_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_DEVICE_LED",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-device-led.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-device-led.so",
+ "symbol_name" :"hal_backend_device_led_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_DEVICE_BOARD",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-device-board.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-device-board.so",
+ "symbol_name" :"hal_backend_device_board_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_DEVICE_EXTERNAL_CONNECTION",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-device-external-connection.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-device-external-connection.so",
+ "symbol_name" :"hal_backend_device_external_connection_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_DEVICE_THERMAL",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-device-thermal.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-device-thermal.so",
+ "symbol_name" :"hal_backend_device_thermal_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_DEVICE_USB_GADGET",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-device-usb-gadget.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-device-usb-gadget.so",
+ "symbol_name" :"hal_backend_device_usb_gadget_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ },
+ {
+ "module" :"HAL_MODULE_DEVICE_HAPTIC",
+ "license" :"APACHE_2_0",
+ "library_name" :"/hal/lib/libhal-backend-device-haptic.so",
+ "library_name_64bit" :"/hal/lib64/libhal-backend-device-haptic.so",
+ "symbol_name" :"hal_backend_device_haptic_data",
+ "abi_versions" :[
+ {
+ "platform_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5",
+ "backend_min_abi_version" :"HAL_ABI_VERSION_TIZEN_6_5"
+ }
+ ]
+ }
+ ]
+ }
+}
ENABLE_TESTING()
SET(HAL_COMMON_UNITTEST "common-unittest")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -g -Wall -Werror")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -std=c++14 -g -Wall -Werror")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed,--gc-sections -pie")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -Werror")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -std=c++14 -Wall -Werror")
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src UNITTEST_SRCS)
ADD_EXECUTABLE(${HAL_COMMON_UNITTEST} ${UNITTEST_SRCS})
TARGET_INCLUDE_DIRECTORIES(${HAL_COMMON_UNITTEST} PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/../include"
- "${CMAKE_CURRENT_SOURCE_DIR}/../src"
)
INCLUDE(FindPkgConfig)
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-TARGET_LINK_LIBRARIES(${HAL_COMMON_UNITTEST} ${hal_common_unittest_pkgs_LDFLAGS} hal-api-common)
-SET_TARGET_PROPERTIES(${HAL_COMMON_UNITTEST} PROPERTIES COMPILE_FLAGS "-fPIE")
+TARGET_LINK_LIBRARIES(${HAL_COMMON_UNITTEST} ${hal_common_unittest_pkgs_LDFLAGS} ${PROJECT_NAME})
+SET_TARGET_PROPERTIES(${HAL_COMMON_UNITTEST} PROPERTIES COMPILE_FLAGS "-fPIE -fvisibility=default")
SET_TARGET_PROPERTIES(${HAL_COMMON_UNITTEST} PROPERTIES LINK_FLAGS "-pie")
ADD_TEST(
* limitations under the License.
*/
+#include <tizen.h>
+
#include <gtest/gtest.h>
+#include <gmock/gmock.h>
-#include <string>
#include <vector>
#include <memory>
#include "hal-common.h"
#include "hal-common-interface.h"
+#include "../../src/hal-api-conf.h"
+#include "../../src/common.h"
+
using namespace std;
+
+extern "C" const char *tzplatform_mkpath(
+ enum tzplatform_variable id, const char *path) {
+ return "../hal-api.json";
+}
+
class CommonHaltest : public testing::Test {
public:
CommonHaltest() {}
-
virtual ~CommonHaltest() {}
-
virtual void SetUp() {}
-
virtual void TearDown() {}
};
+TEST(CommonHaltest, test_symbol_name_invalid_module) {
+ const char *ret_unknown = hal_common_get_backend_symbol_name(HAL_MODULE_UNKNOWN);
+ EXPECT_TRUE(ret_unknown == nullptr);
+
+ const char *ret_end = hal_common_get_backend_symbol_name(HAL_MODULE_END);
+ EXPECT_TRUE(ret_end == nullptr);
+}
+
+TEST(CommonHaltest, test_check_backend_abi_version_invalid_parameter) {
+ int ret;
+
+ ret = hal_common_check_backend_abi_version(HAL_MODULE_UNKNOWN, HAL_ABI_VERSION_TIZEN_6_5);
+ EXPECT_EQ(ret, TIZEN_ERROR_INVALID_PARAMETER);
+
+ ret = hal_common_check_backend_abi_version(HAL_MODULE_END, HAL_ABI_VERSION_TIZEN_6_5);
+ EXPECT_EQ(ret, TIZEN_ERROR_INVALID_PARAMETER);
+
+ ret = hal_common_check_backend_abi_version(HAL_MODULE_TBM, HAL_ABI_VERSION_UNKNOWN);
+ EXPECT_EQ(ret, TIZEN_ERROR_INVALID_PARAMETER);
+
+ ret = hal_common_check_backend_abi_version(HAL_MODULE_TBM, HAL_ABI_VERSION_END);
+ EXPECT_EQ(ret, TIZEN_ERROR_INVALID_PARAMETER);
+}
+
TEST(CommonHaltest, get_backend_library_name_unknown) {
const char *ret = hal_common_get_backend_library_name(HAL_MODULE_UNKNOWN);
EXPECT_TRUE(ret == nullptr);
}
+
+class HalInfo {
+public:
+ enum hal_module module_;
+ enum hal_group group_;
+ enum hal_license license_;
+ const char *module_name_;
+ const char *library_name_;
+ const char *library_name_64bit_;
+ const char *symbol_name_;
+
+ HalInfo(enum hal_module module, enum hal_group group, enum hal_license license,
+ const char *module_name, const char *library_name, const char *library_name_64bit, const char *symbol_name) :
+ module_(module), group_(group), license_(license),
+ module_name_(module_name), library_name_(library_name),
+ library_name_64bit_(library_name_64bit), symbol_name_(symbol_name) {}
+};
+
+class HalInfoMatchedTest : public ::testing::TestWithParam<HalInfo> {};
+
+INSTANTIATE_TEST_CASE_P(CommonHaltest,
+ HalInfoMatchedTest,
+ ::testing::Values(
+ HalInfo(HAL_MODULE_TBM, HAL_GROUP_GRAPHICS, HAL_LICENSE_MIT,
+ "HAL_MODULE_TBM", "/hal/lib/libhal-backend-tbm.so",
+ "/hal/lib64/libhal-backend-tbm.so", "hal_backend_tbm_data"),
+
+ HalInfo(HAL_MODULE_TDM, HAL_GROUP_GRAPHICS, HAL_LICENSE_MIT,
+ "HAL_MODULE_TDM", "/hal/lib/libhal-backend-tdm.so",
+ "/hal/lib64/libhal-backend-tdm.so", "hal_backend_tdm_data"),
+
+ HalInfo(HAL_MODULE_COREGL, HAL_GROUP_GRAPHICS, HAL_LICENSE_UNKNOWN,
+ "HAL_MODULE_COREGL", nullptr, nullptr, nullptr),
+
+ HalInfo(HAL_MODULE_INPUT, HAL_GROUP_GRAPHICS, HAL_LICENSE_MIT,
+ "HAL_MODULE_INPUT", nullptr, nullptr, nullptr),
+
+ HalInfo(HAL_MODULE_AUDIO, HAL_GROUP_MULTIMEDIA, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_AUDIO", "/hal/lib/libhal-backend-audio.so",
+ "/hal/lib64/libhal-backend-audio.so", "hal_backend_audio_data"),
+
+ HalInfo(HAL_MODULE_CAMERA, HAL_GROUP_MULTIMEDIA, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_CAMERA", "/hal/lib/libhal-backend-camera.so",
+ "/hal/lib64/libhal-backend-camera.so", "hal_backend_camera_data"),
+
+ HalInfo(HAL_MODULE_RADIO, HAL_GROUP_MULTIMEDIA, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_RADIO", "/hal/lib/libhal-backend-radio.so",
+ "/hal/lib64/libhal-backend-radio.so", "hal_backend_radio_data"),
+
+ HalInfo(HAL_MODULE_CODEC, HAL_GROUP_MULTIMEDIA, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_CODEC", nullptr, nullptr, nullptr),
+
+ HalInfo(HAL_MODULE_USB_AUDIO, HAL_GROUP_MULTIMEDIA, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_USB_AUDIO", nullptr, nullptr, nullptr),
+
+ HalInfo(HAL_MODULE_ALSAUCM, HAL_GROUP_MULTIMEDIA, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_ALSAUCM", nullptr, nullptr, nullptr),
+
+ HalInfo(HAL_MODULE_BLUETOOTH, HAL_GROUP_CONNECTIVITY, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_BLUETOOTH", "/hal/lib/libhal-backend-bluetooth.so",
+ "/hal/lib64/libhal-backend-bluetooth.so", "hal_backend_bluetooth_data"),
+
+ HalInfo(HAL_MODULE_WIFI, HAL_GROUP_CONNECTIVITY, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_WIFI", "/hal/lib/libhal-backend-wifi.so",
+ "/hal/lib64/libhal-backend-wifi.so", "hal_backend_wifi_data"),
+
+ HalInfo(HAL_MODULE_NAN, HAL_GROUP_CONNECTIVITY, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_NAN", nullptr, nullptr, nullptr),
+
+ HalInfo(HAL_MODULE_NFC, HAL_GROUP_CONNECTIVITY, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_NFC", "/hal/lib/libhal-backend-nfc.so",
+ "/hal/lib64/libhal-backend-nfc.so", "hal_backend_nfc_data"),
+
+ HalInfo(HAL_MODULE_ZIGBEE, HAL_GROUP_CONNECTIVITY, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_ZIGBEE", "/hal/lib/libhal-backend-zigbee.so",
+ "/hal/lib64/libhal-backend-zigbee.so", "hal_backend_zigbee_data"),
+
+ HalInfo(HAL_MODULE_UWB, HAL_GROUP_CONNECTIVITY, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_UWB", "/hal/lib/libhal-backend-uwb.so",
+ "/hal/lib64/libhal-backend-uwb.so", "hal_backend_uwb_data"),
+
+ HalInfo(HAL_MODULE_MTP, HAL_GROUP_CONNECTIVITY, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_MTP", nullptr, nullptr, nullptr),
+
+ HalInfo(HAL_MODULE_TELEPHONY, HAL_GROUP_TELEPHONY, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_TELEPHONY", nullptr, nullptr, nullptr),
+
+ HalInfo(HAL_MODULE_LOCATION, HAL_GROUP_LOCATION, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_LOCATION", "/hal/lib/libhal-backend-location.so",
+ "/hal/lib64/libhal-backend-location.so", "hal_backend_location_data"),
+
+ HalInfo(HAL_MODULE_COMMON, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_COMMON", nullptr, nullptr, nullptr),
+
+ HalInfo(HAL_MODULE_POWER, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_POWER", "/hal/lib/libhal-backend-power.so",
+ "/hal/lib64/libhal-backend-power.so", "hal_backend_power_data"),
+
+ HalInfo(HAL_MODULE_SENSOR, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_SENSOR", "/hal/lib/libhal-backend-sensor.so",
+ "/hal/lib64/libhal-backend-sensor.so", "hal_backend_sensor_data"),
+
+ HalInfo(HAL_MODULE_PERIPHERAL, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_PERIPHERAL", nullptr, nullptr, nullptr),
+
+ HalInfo(HAL_MODULE_DEVICE_BATTERY, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_DEVICE_BATTERY", "/hal/lib/libhal-backend-device-battery.so",
+ "/hal/lib64/libhal-backend-device-battery.so", "hal_backend_device_battery_data"),
+
+ HalInfo(HAL_MODULE_DEVICE_BEZEL, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_DEVICE_BEZEL", "/hal/lib/libhal-backend-device-bezel.so",
+ "/hal/lib64/libhal-backend-device-bezel.so", "hal_backend_device_bezel_data"),
+
+ HalInfo(HAL_MODULE_DEVICE_DISPLAY, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_DEVICE_DISPLAY", "/hal/lib/libhal-backend-device-display.so",
+ "/hal/lib64/libhal-backend-device-display.so", "hal_backend_device_display_data"),
+
+ HalInfo(HAL_MODULE_DEVICE_IR, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_DEVICE_IR", "/hal/lib/libhal-backend-device-ir.so",
+ "/hal/lib64/libhal-backend-device-ir.so", "hal_backend_device_ir_data"),
+
+ HalInfo(HAL_MODULE_DEVICE_TOUCHSCREEN, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_DEVICE_TOUCHSCREEN", "/hal/lib/libhal-backend-device-touchscreen.so",
+ "/hal/lib64/libhal-backend-device-touchscreen.so", "hal_backend_device_touchscreen_data"),
+
+ HalInfo(HAL_MODULE_DEVICE_LED, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_DEVICE_LED", "/hal/lib/libhal-backend-device-led.so",
+ "/hal/lib64/libhal-backend-device-led.so", "hal_backend_device_led_data"),
+
+ HalInfo(HAL_MODULE_DEVICE_BOARD, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_DEVICE_BOARD", "/hal/lib/libhal-backend-device-board.so",
+ "/hal/lib64/libhal-backend-device-board.so", "hal_backend_device_board_data"),
+
+ HalInfo(HAL_MODULE_DEVICE_EXTERNAL_CONNECTION, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_DEVICE_EXTERNAL_CONNECTION", "/hal/lib/libhal-backend-device-external-connection.so",
+ "/hal/lib64/libhal-backend-device-external-connection.so", "hal_backend_device_external_connection_data"),
+
+ HalInfo(HAL_MODULE_DEVICE_THERMAL, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_DEVICE_THERMAL", "/hal/lib/libhal-backend-device-thermal.so",
+ "/hal/lib64/libhal-backend-device-thermal.so", "hal_backend_device_thermal_data"),
+
+ HalInfo(HAL_MODULE_DEVICE_USB_GADGET, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_DEVICE_USB_GADGET", "/hal/lib/libhal-backend-device-usb-gadget.so",
+ "/hal/lib64/libhal-backend-device-usb-gadget.so", "hal_backend_device_usb_gadget_data"),
+
+ HalInfo(HAL_MODULE_DEVICE_HAPTIC, HAL_GROUP_SYSTEM, HAL_LICENSE_APACHE_2_0,
+ "HAL_MODULE_DEVICE_HAPTIC", "/hal/lib/libhal-backend-device-haptic.so",
+ "/hal/lib64/libhal-backend-device-haptic.so", "hal_backend_device_haptic_data")
+ ));
+
+TEST_P(HalInfoMatchedTest, get_backend_library_name) {
+ const char *ret_library_name;
+
+ auto info = GetParam();
+
+ ret_library_name = hal_common_get_backend_library_name(info.module_);
+#if defined(__aarch64__)
+ EXPECT_STREQ(info.library_name_64bit_, ret_library_name) << "module name is " << info.module_name_;
+#else
+ EXPECT_STREQ(info.library_name_, ret_library_name) << "module name is " << info.module_name_;
+#endif
+}
+
+TEST_P(HalInfoMatchedTest, test_symbol_name_module_matching) {
+ const char *ret_symbol_name = NULL;
+
+ auto info = GetParam();
+
+ ret_symbol_name = hal_common_get_backend_symbol_name(info.module_);
+ EXPECT_STREQ(ret_symbol_name, info.symbol_name_) << "module name is " << info.module_name_;
+}
+
+TEST_P(HalInfoMatchedTest, test_group_module_matching) {
+ struct __hal_module_info *info = NULL;
+
+ auto result_info = GetParam();
+
+ info = _hal_api_conf_get_module_info(result_info.module_);
+ ASSERT_TRUE(info != nullptr) << "module name is " << result_info.module_name_;
+ EXPECT_EQ(info->group, result_info.group_) << "module name is " << result_info.module_name_;
+
+ _destroy_module_info(info);
+}
+
+TEST_P(HalInfoMatchedTest, test_license_module_matching) {
+ struct __hal_module_info *info = NULL;
+
+ auto result_info = GetParam();
+
+ info = _hal_api_conf_get_module_info(result_info.module_);
+ ASSERT_TRUE(info != nullptr) << "module name is " << result_info.module_name_;
+ EXPECT_EQ(info->license, result_info.license_) << "module name is " << result_info.module_name_;
+
+ _destroy_module_info(info);
+}
+
+TEST_P(HalInfoMatchedTest, test_module_name_matching) {
+ struct __hal_module_info *info = NULL;
+
+ auto result_info = GetParam();
+
+ info = _hal_api_conf_get_module_info(result_info.module_);
+ ASSERT_TRUE(info != nullptr) << "module name is " << result_info.module_name_;
+ EXPECT_STREQ(info->module_name, result_info.module_name_) << "module name is " << result_info.module_name_;
+
+ _destroy_module_info(info);
+}
HAL_GROUP_END,
};
+static const char *const hal_group_string[] = {
+ [HAL_GROUP_UNKNOWN] = "HAL_GROUP_UNKNOWN",
+ [HAL_GROUP_GRAPHICS] = "HAL_GROUP_GRAPHICS",
+ [HAL_GROUP_MULTIMEDIA] = "HAL_GROUP_MULTIMEDIA",
+ [HAL_GROUP_CONNECTIVITY] = "HAL_GROUP_CONNECTIVITY",
+ [HAL_GROUP_TELEPHONY] = "HAL_GROUP_TELEPHONY",
+ [HAL_GROUP_LOCATION] = "HAL_GROUP_LOCATION",
+ [HAL_GROUP_SYSTEM] = "HAL_GROUP_SYSTEM",
+};
+
enum hal_module {
HAL_MODULE_UNKNOWN = 0,
HAL_MODULE_END,
};
+static const char *const hal_module_string[] = {
+ [HAL_MODULE_UNKNOWN] = "HAL_MODULE_UNKNOWN",
+
+ /* HAL_GROUP_GRAPHICS */
+ [HAL_MODULE_TBM] = "HAL_MODULE_TBM",
+ [HAL_MODULE_TDM] = "HAL_MODULE_TDM",
+ [HAL_MODULE_COREGL] = "HAL_MODULE_COREGL",
+ [HAL_MODULE_INPUT] = "HAL_MODULE_INPUT",
+
+ /* HAL_GROUP_MULTIMEDIA */
+ [HAL_MODULE_AUDIO] = "HAL_MODULE_AUDIO",
+ [HAL_MODULE_CAMERA] = "HAL_MODULE_CAMERA",
+ [HAL_MODULE_RADIO] = "HAL_MODULE_RADIO",
+ [HAL_MODULE_CODEC] = "HAL_MODULE_CODEC",
+ [HAL_MODULE_USB_AUDIO] = "HAL_MODULE_USB_AUDIO",
+ [HAL_MODULE_ALSAUCM] = "HAL_MODULE_ALSAUCM",
+
+ /* HAL_GROUP_CONNECTIVITY */
+ [HAL_MODULE_BLUETOOTH] = "HAL_MODULE_BLUETOOTH",
+ [HAL_MODULE_WIFI] = "HAL_MODULE_WIFI",
+ [HAL_MODULE_NAN] = "HAL_MODULE_NAN",
+ [HAL_MODULE_NFC] = "HAL_MODULE_NFC",
+ [HAL_MODULE_ZIGBEE] = "HAL_MODULE_ZIGBEE",
+ [HAL_MODULE_UWB] = "HAL_MODULE_UWB",
+ [HAL_MODULE_MTP] = "HAL_MODULE_MTP",
+
+ /* HAL_GROUP_TELEPHONY */
+ [HAL_MODULE_TELEPHONY] = "HAL_MODULE_TELEPHONY",
+
+ /* HAL_GROUP_LOCATION */
+ [HAL_MODULE_LOCATION] = "HAL_MODULE_LOCATION",
+
+ /* HAL_GROUP_SYSTEM */
+ [HAL_MODULE_COMMON] = "HAL_MODULE_COMMON",
+ [HAL_MODULE_POWER] = "HAL_MODULE_POWER",
+ [HAL_MODULE_SENSOR] = "HAL_MODULE_SENSOR",
+ [HAL_MODULE_PERIPHERAL] = "HAL_MODULE_PERIPHERAL",
+ [HAL_MODULE_DEVICE_BATTERY] = "HAL_MODULE_DEVICE_BATTERY",
+ [HAL_MODULE_DEVICE_BEZEL] = "HAL_MODULE_DEVICE_BEZEL",
+ [HAL_MODULE_DEVICE_DISPLAY] = "HAL_MODULE_DEVICE_DISPLAY",
+ [HAL_MODULE_DEVICE_IR] = "HAL_MODULE_DEVICE_IR",
+ [HAL_MODULE_DEVICE_TOUCHSCREEN] = "HAL_MODULE_DEVICE_TOUCHSCREEN",
+ [HAL_MODULE_DEVICE_LED] = "HAL_MODULE_DEVICE_LED",
+ [HAL_MODULE_DEVICE_BOARD] = "HAL_MODULE_DEVICE_BOARD",
+ [HAL_MODULE_DEVICE_EXTERNAL_CONNECTION] = "HAL_MODULE_DEVICE_EXTERNAL_CONNECTION",
+ [HAL_MODULE_DEVICE_THERMAL] = "HAL_MODULE_DEVICE_THERMAL",
+ [HAL_MODULE_DEVICE_USB_GADGET] = "HAL_MODULE_DEVICE_USB_GADGET",
+ [HAL_MODULE_DEVICE_HAPTIC] = "HAL_MODULE_DEVICE_HAPTIC",
+
+ [HAL_MODULE_END] = "HAL_MODULE_END",
+};
+
/**
* @brief Get the backend library name according to the type of HAL module
* @param[in] HAL module id among enum hal_moudle
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(json-glib-1.0)
BuildRequires: pkgconfig(gmock)
-
+BuildRequires: pkgconfig(libtzplatform-config)
%description
%{name} interface
%post
/sbin/ldconfig
+if [ ! -d %{TZ_SYS_ETC} ]
+then
+ mkdir -p %{TZ_SYS_RO_ETC}/hal
+fi
+
%postun
/sbin/ldconfig
%{_libdir}/hal/*.so*
%{_sysconfdir}/ld.so.conf.d/libhal-api.conf
/hal/
+%attr(644,root,root) %{TZ_SYS_RO_ETC}/hal/hal-api.json
%files -n %{devel_name}
%defattr(-,root,root,-)
#include "hal-common.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define _D(fmt, args...) SLOGD(fmt, ##args)
#define _I(fmt, args...) SLOGI(fmt, ##args)
#define _W(fmt, args...) SLOGW(fmt, ##args)
#define _E(fmt, args...) SLOGE(fmt, ##args)
#define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0]))
-#define HAL_ABI_VERSION_MAX 10
/**
* hal-api-common (/platform/hal/api/common) provides the HAL ABI
* 'g_platform_curr_abi_version' must be updated when Tizen platform
* will be released officially.
*/
-/* FIXME: Need to be initialized by configuration file like xml */
-enum hal_abi_version g_platform_curr_abi_version = HAL_ABI_VERSION_TIZEN_6_5;
-
struct hal_abi_version_match {
enum hal_abi_version platform_abi_version;
enum hal_abi_version backend_min_abi_version;
-} abi_version_match_data[HAL_MODULE_END][HAL_ABI_VERSION_MAX] = {
- /* HAL_GROUP_GRAPHICS */
- [HAL_MODULE_TBM] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_TDM] = {
- /* FIXME: Need to be filled from configuration file. */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_COREGL] = {
- /**
- * Don't need to add abi verion for this module.
- * because this module don't support HAL API.
- */
- },
- [HAL_MODULE_INPUT] = {
- /**
- * Don't need to add abi verion for this module.
- * because this module don't support HAL API.
- */
- },
-
- /* HAL_GROUP_MULTIMEDIA */
- [HAL_MODULE_AUDIO] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_CAMERA] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_RADIO] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_CODEC] = {
- /**
- * Don't need to add abi verion for this module.
- * because this module don't support HAL API.
- */
- },
- [HAL_MODULE_USB_AUDIO] = {
- /**
- * Don't need to add abi verion for this module.
- * because this module don't support HAL API.
- */
- },
- [HAL_MODULE_ALSAUCM] = {
- /**
- * Don't need to add abi verion for this module.
- * because this module don't support HAL API.
- */
- },
-
- /* HAL_GROUP_CONNECTIVITY */
- [HAL_MODULE_BLUETOOTH] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_WIFI] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_NAN] = {
- },
- [HAL_MODULE_NFC] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_ZIGBEE] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_UWB] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_MTP] = {
- /**
- * Don't need to add abi verion for this module.
- * because this module don't support HAL API.
- */
- },
-
- /* HAL_GROUP_TELEPHONY */
- [HAL_MODULE_TELEPHONY] = {
- /* FIXME: Need to be determined whehter support HAL API or not. */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
-
- /* HAL_GROUP_LOCATION */
- [HAL_MODULE_LOCATION] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
-
- /* HAL_GROUP_SYSTEM */
- [HAL_MODULE_COMMON] = {
- },
- [HAL_MODULE_POWER] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_SENSOR] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_PERIPHERAL] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
-
- [HAL_MODULE_DEVICE_BATTERY] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_DEVICE_BEZEL] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_DEVICE_DISPLAY] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_DEVICE_IR] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_DEVICE_TOUCHSCREEN] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_DEVICE_LED] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_DEVICE_BOARD] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_DEVICE_EXTERNAL_CONNECTION] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_DEVICE_THERMAL] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_DEVICE_USB_GADGET] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
- [HAL_MODULE_DEVICE_HAPTIC] = {
- /* FIXME: Need to be initialized by configuration file like xml */
- [0] = {
- .platform_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- .backend_min_abi_version = HAL_ABI_VERSION_TIZEN_6_5,
- },
- },
};
-static struct __hal_module_info {
+struct __hal_module_info {
enum hal_group group;
enum hal_module module;
enum hal_license license;
struct hal_abi_version_match *abi_versions;
bool hal_api;
-} hal_module_info[] = {
- /* HAL_GROUP_GRAPHICS */
- [HAL_MODULE_TBM] = {
- .group = HAL_GROUP_GRAPHICS,
- .module = HAL_MODULE_TBM,
- .license = HAL_LICENSE_MIT,
- .module_name = "TBM",
- .library_name = "/hal/lib/libhal-backend-tbm.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-tbm.so",
- .symbol_name = "hal_backend_tbm_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_TBM]),
- .abi_versions = abi_version_match_data[HAL_MODULE_TBM],
- .hal_api = true,
- },
- [HAL_MODULE_TDM] = {
- .group = HAL_GROUP_GRAPHICS,
- .module = HAL_MODULE_TDM,
- .license = HAL_LICENSE_MIT,
- .module_name = "TDM",
- .library_name = "/hal/lib/libhal-backend-tdm.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-tdm.so",
- .symbol_name = "hal_backend_tdm_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_TDM]),
- .abi_versions = abi_version_match_data[HAL_MODULE_TDM],
- .hal_api = true,
- },
- [HAL_MODULE_COREGL] = {
- .group = HAL_GROUP_GRAPHICS,
- .module = HAL_MODULE_COREGL,
- .license = HAL_LICENSE_UNKNOWN,
- .module_name = "COREGL",
- .library_name = NULL,
- .library_name_64bit = NULL,
- .symbol_name = NULL,
- .num_abi_versions = 0,
- .abi_versions = NULL,
- .hal_api = false,
- },
- [HAL_MODULE_INPUT] = {
- .group = HAL_GROUP_GRAPHICS,
- .module = HAL_MODULE_INPUT,
- .license = HAL_LICENSE_MIT,
- .module_name = "INPUT",
- .library_name = NULL,
- .library_name_64bit = NULL,
- .symbol_name = NULL,
- .num_abi_versions = 0,
- .abi_versions = NULL,
- .hal_api = false,
- },
-
- /* HAL_GROUP_MULTIMEDIA */
- [HAL_MODULE_AUDIO] = {
- .group = HAL_GROUP_MULTIMEDIA,
- .module = HAL_MODULE_AUDIO,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "AUDIO",
- .library_name = "/hal/lib/libhal-backend-audio.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-audio.so",
- .symbol_name = "hal_backend_audio_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_AUDIO]),
- .abi_versions = abi_version_match_data[HAL_MODULE_AUDIO],
- .hal_api = true,
- },
- [HAL_MODULE_CAMERA] = {
- .group = HAL_GROUP_MULTIMEDIA,
- .module = HAL_MODULE_CAMERA,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "CAMERA",
- .library_name = "/hal/lib/libhal-backend-camera.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-camera.so",
- .symbol_name = "hal_backend_camera_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_CAMERA]),
- .abi_versions = abi_version_match_data[HAL_MODULE_CAMERA],
- .hal_api = true,
- },
- [HAL_MODULE_RADIO] = {
- .group = HAL_GROUP_MULTIMEDIA,
- .module = HAL_MODULE_RADIO,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "RADIO",
- .library_name = "/hal/lib/libhal-backend-radio.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-radio.so",
- .symbol_name = "hal_backend_radio_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_RADIO]),
- .abi_versions = abi_version_match_data[HAL_MODULE_RADIO],
- .hal_api = true,
- },
- [HAL_MODULE_CODEC] = {
- .group = HAL_GROUP_MULTIMEDIA,
- .module = HAL_MODULE_CODEC,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "CODEC",
- .library_name = NULL,
- .library_name_64bit = NULL,
- .symbol_name = NULL,
- .num_abi_versions = 0,
- .abi_versions = NULL,
- .hal_api = false,
- },
- [HAL_MODULE_USB_AUDIO] = {
- .group = HAL_GROUP_MULTIMEDIA,
- .module = HAL_MODULE_USB_AUDIO,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "USB_AUDIO",
- .library_name = NULL,
- .library_name_64bit = NULL,
- .symbol_name = NULL,
- .num_abi_versions = 0,
- .abi_versions = NULL,
- .hal_api = false,
- },
- [HAL_MODULE_ALSAUCM] = {
- .group = HAL_GROUP_MULTIMEDIA,
- .module = HAL_MODULE_ALSAUCM,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "ALSAUCM",
- .library_name = NULL,
- .library_name_64bit = NULL,
- .symbol_name = NULL,
- .num_abi_versions = 0,
- .abi_versions = NULL,
- .hal_api = false,
- },
-
- /* HAL_GROUP_CONNECTIVITY */
- [HAL_MODULE_BLUETOOTH] = {
- .group = HAL_GROUP_CONNECTIVITY,
- .module = HAL_MODULE_BLUETOOTH,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "BLUETOOTH",
- .library_name = "/hal/lib/libhal-backend-bluetooth.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-bluetooth.so",
- .symbol_name = "hal_backend_bluetooth_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_BLUETOOTH]),
- .abi_versions = abi_version_match_data[HAL_MODULE_BLUETOOTH],
- .hal_api = true,
- },
- [HAL_MODULE_WIFI] = {
- .group = HAL_GROUP_CONNECTIVITY,
- .module = HAL_MODULE_WIFI,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "WIFI",
- .library_name = "/hal/lib/libhal-backend-wifi.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-wifi.so",
- .symbol_name = "hal_backend_wifi_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_WIFI]),
- .abi_versions = abi_version_match_data[HAL_MODULE_WIFI],
- .hal_api = true,
- },
- [HAL_MODULE_NAN] = {
- .group = HAL_GROUP_CONNECTIVITY,
- .module = HAL_MODULE_NAN,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "NAN",
- .library_name = NULL,
- .library_name_64bit = NULL,
- .symbol_name = NULL,
- .num_abi_versions = 0,
- .abi_versions = NULL,
- .hal_api = false,
- },
- [HAL_MODULE_NFC] = {
- .group = HAL_GROUP_CONNECTIVITY,
- .module = HAL_MODULE_NFC,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "NFC",
- .library_name = "/hal/lib/libhal-backend-nfc.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-nfc.so",
- .symbol_name = "hal_backend_nfc_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_NFC]),
- .abi_versions = abi_version_match_data[HAL_MODULE_NFC],
- .hal_api = true,
- },
- [HAL_MODULE_ZIGBEE] = {
- .group = HAL_GROUP_CONNECTIVITY,
- .module = HAL_MODULE_ZIGBEE,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "ZIGBEE",
- .library_name = "/hal/lib/libhal-backend-zigbee.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-zigbee.so",
- .symbol_name = "hal_backend_zigbee_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_ZIGBEE]),
- .abi_versions = abi_version_match_data[HAL_MODULE_ZIGBEE],
- .hal_api = true,
- },
- [HAL_MODULE_UWB] = {
- .group = HAL_GROUP_CONNECTIVITY,
- .module = HAL_MODULE_UWB,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "UWB",
- .library_name = "/hal/lib/libhal-backend-uwb.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-uwb.so",
- .symbol_name = "hal_backend_uwb_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_UWB]),
- .abi_versions = abi_version_match_data[HAL_MODULE_UWB],
- .hal_api = true,
- },
- [HAL_MODULE_MTP] = {
- .group = HAL_GROUP_CONNECTIVITY,
- .module = HAL_MODULE_MTP,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "MTP",
- .library_name = NULL,
- .library_name_64bit = NULL,
- .symbol_name = NULL,
- .num_abi_versions = 0,
- .abi_versions = NULL,
- .hal_api = false,
- },
-
- /* HAL_GROUP_TELEPHONY */
- [HAL_MODULE_TELEPHONY] = {
- .group = HAL_GROUP_TELEPHONY,
- .module = HAL_MODULE_TELEPHONY,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "TELEPHONY",
- .library_name = NULL,
- .library_name_64bit = NULL,
- .symbol_name = NULL,
- .num_abi_versions = 0,
- .abi_versions = NULL,
- .hal_api = false,
- },
-
- /* HAL_GROUP_LOCATION */
- [HAL_MODULE_LOCATION] = {
- .group = HAL_GROUP_LOCATION,
- .module = HAL_MODULE_LOCATION,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "LOCATION",
- .library_name = "/hal/lib/libhal-backend-location.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-location.so",
- .symbol_name = "hal_backend_location_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_LOCATION]),
- .abi_versions = abi_version_match_data[HAL_MODULE_LOCATION],
- .hal_api = true,
- },
-
- /* HAL_GROUP_SYSTEM */
- [HAL_MODULE_COMMON] = {
- .group = HAL_GROUP_SYSTEM,
- .module = HAL_MODULE_COMMON,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "COMMON",
- .library_name = NULL,
- .library_name_64bit = NULL,
- .symbol_name = NULL,
- .num_abi_versions = 0,
- .abi_versions = NULL,
- .hal_api = true,
- },
- [HAL_MODULE_POWER] = {
- .group = HAL_GROUP_SYSTEM,
- .module = HAL_MODULE_POWER,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "POWER",
- .library_name = "/hal/lib/libhal-backend-power.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-power.so",
- .symbol_name = "hal_backend_power_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_POWER]),
- .abi_versions = abi_version_match_data[HAL_MODULE_POWER],
- .hal_api = true,
- },
- [HAL_MODULE_SENSOR] = {
- .group = HAL_GROUP_SYSTEM,
- .module = HAL_MODULE_SENSOR,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "SENSOR",
- .library_name = "/hal/lib/libhal-backend-sensor.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-sensor.so",
- .symbol_name = "hal_backend_sensor_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_SENSOR]),
- .abi_versions = abi_version_match_data[HAL_MODULE_SENSOR],
- .hal_api = true,
- },
- [HAL_MODULE_PERIPHERAL] = {
- .group = HAL_GROUP_SYSTEM,
- .module = HAL_MODULE_PERIPHERAL,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "PERIPHERAL",
- .library_name = NULL,
- .library_name_64bit = NULL,
- .symbol_name = NULL,
- .num_abi_versions = 0,
- .abi_versions = NULL,
- .hal_api = false,
- },
- [HAL_MODULE_DEVICE_BATTERY] = {
- .group = HAL_GROUP_SYSTEM,
- .module = HAL_MODULE_DEVICE_BATTERY,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "DEVICE_BATTERY",
- .library_name = "/hal/lib/libhal-backend-device-battery.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-device-battery.so",
- .symbol_name = "hal_backend_device_battery_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_DEVICE_BATTERY]),
- .abi_versions = abi_version_match_data[HAL_MODULE_DEVICE_BATTERY],
- .hal_api = true,
- },
- [HAL_MODULE_DEVICE_BEZEL] = {
- .group = HAL_GROUP_SYSTEM,
- .module = HAL_MODULE_DEVICE_BEZEL,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "DEVICE_BEZEL",
- .library_name = "/hal/lib/libhal-backend-device-bezel.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-device-bezel.so",
- .symbol_name = "hal_backend_device_bezel_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_DEVICE_BEZEL]),
- .abi_versions = abi_version_match_data[HAL_MODULE_DEVICE_BEZEL],
- .hal_api = true,
- },
- [HAL_MODULE_DEVICE_DISPLAY] = {
- .group = HAL_GROUP_SYSTEM,
- .module = HAL_MODULE_DEVICE_DISPLAY,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "DEVICE_DISPLAY",
- .library_name = "/hal/lib/libhal-backend-device-display.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-device-display.so",
- .symbol_name = "hal_backend_device_display_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_DEVICE_DISPLAY]),
- .abi_versions = abi_version_match_data[HAL_MODULE_DEVICE_DISPLAY],
- .hal_api = true,
- },
- [HAL_MODULE_DEVICE_IR] = {
- .group = HAL_GROUP_SYSTEM,
- .module = HAL_MODULE_DEVICE_IR,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "DEVICE_IR",
- .library_name = "/hal/lib/libhal-backend-device-ir.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-device-ir.so",
- .symbol_name = "hal_backend_device_ir_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_DEVICE_IR]),
- .hal_api = true,
- },
- [HAL_MODULE_DEVICE_TOUCHSCREEN] = {
- .group = HAL_GROUP_SYSTEM,
- .module = HAL_MODULE_DEVICE_TOUCHSCREEN,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "DEVICE_TOUCHSCREEN",
- .library_name = "/hal/lib/libhal-backend-device-touchscreen.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-device-touchscreen.so",
- .symbol_name = "hal_backend_device_touchscreen_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_DEVICE_TOUCHSCREEN]),
- .abi_versions = abi_version_match_data[HAL_MODULE_DEVICE_TOUCHSCREEN],
- .hal_api = true,
- },
- [HAL_MODULE_DEVICE_LED] = {
- .group = HAL_GROUP_SYSTEM,
- .module = HAL_MODULE_DEVICE_LED,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "DEVICE_LED",
- .library_name = "/hal/lib/libhal-backend-device-led.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-device-led.so",
- .symbol_name = "hal_backend_device_led_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_DEVICE_LED]),
- .abi_versions = abi_version_match_data[HAL_MODULE_DEVICE_LED],
- .hal_api = true,
- },
- [HAL_MODULE_DEVICE_BOARD] = {
- .group = HAL_GROUP_SYSTEM,
- .module = HAL_MODULE_DEVICE_BOARD,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "DEVICE_BOARD",
- .library_name = "/hal/lib/libhal-backend-device-board.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-device-board.so",
- .symbol_name = "hal_backend_device_board_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_DEVICE_BOARD]),
- .abi_versions = abi_version_match_data[HAL_MODULE_DEVICE_BOARD],
- .hal_api = true,
- },
- [HAL_MODULE_DEVICE_EXTERNAL_CONNECTION] = {
- .group = HAL_GROUP_SYSTEM,
- .module = HAL_MODULE_DEVICE_EXTERNAL_CONNECTION,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "DEVICE_EXTERNAL_CONNECTION",
- .library_name = "/hal/lib/libhal-backend-device-external-connection.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-device-external-connection.so",
- .symbol_name = "hal_backend_device_external_connection_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_DEVICE_EXTERNAL_CONNECTION]),
- .abi_versions = abi_version_match_data[HAL_MODULE_DEVICE_EXTERNAL_CONNECTION],
- .hal_api = true,
- },
- [HAL_MODULE_DEVICE_THERMAL] = {
- .group = HAL_GROUP_SYSTEM,
- .module = HAL_MODULE_DEVICE_THERMAL,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "DEVICE_THERMAL",
- .library_name = "/hal/lib/libhal-backend-device-thermal.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-device-thermal.so",
- .symbol_name = "hal_backend_device_thermal_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_DEVICE_THERMAL]),
- .abi_versions = abi_version_match_data[HAL_MODULE_DEVICE_THERMAL],
- .hal_api = true,
- },
- [HAL_MODULE_DEVICE_USB_GADGET] = {
- .group = HAL_GROUP_SYSTEM,
- .module = HAL_MODULE_DEVICE_USB_GADGET,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "DEVICE_USB_GADGET",
- .library_name = "/hal/lib/libhal-backend-device-usb-gadget.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-device-usb-gadget.so",
- .symbol_name = "hal_backend_device_usb_gadget_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_DEVICE_USB_GADGET]),
- .abi_versions = abi_version_match_data[HAL_MODULE_DEVICE_USB_GADGET],
- .hal_api = true,
- },
- [HAL_MODULE_DEVICE_HAPTIC] = {
- .group = HAL_GROUP_SYSTEM,
- .module = HAL_MODULE_DEVICE_HAPTIC,
- .license = HAL_LICENSE_APACHE_2_0,
- .module_name = "DEVICE_HAPTIC",
- .library_name = "/hal/lib/libhal-backend-device-haptic.so",
- .library_name_64bit = "/hal/lib64/libhal-backend-device-haptic.so",
- .symbol_name = "hal_backend_device_haptic_data",
- .num_abi_versions = ARRAY_SIZE(abi_version_match_data[HAL_MODULE_DEVICE_HAPTIC]),
- .abi_versions = abi_version_match_data[HAL_MODULE_DEVICE_HAPTIC],
- .hal_api = true,
- },
};
+#ifdef __cplusplus
+}
+#endif
#endif /* __COMMON_H__ */
#include <dlog.h>
#include "common.h"
+#include "hal-api-conf.h"
#ifndef EXPORT
#define EXPORT __attribute__ ((visibility("default")))
#endif
+static enum hal_abi_version g_platform_curr_abi_version;
+
EXPORT
const char *hal_common_get_backend_library_name(enum hal_module module)
{
char *library_name;
+ struct __hal_module_info *info = NULL;
/* Check parameter whether is valid or not */
if (module <= HAL_MODULE_UNKNOWN || module >= HAL_MODULE_END) {
return NULL;
}
+ info = _hal_api_conf_get_module_info(module);
+ if (info == NULL) {
+ _E("Failed to get module inforamtion\n");
+ return NULL;
+ }
+
#if defined(__aarch64__)
- library_name = hal_module_info[module].library_name_64bit;
+ library_name = info->library_name_64bit;
#else
- library_name = hal_module_info[module].library_name;
+ library_name = info->library_name;
#endif
if (!library_name) {
_E("%s backend library name is NULL\n",
- hal_module_info[module].module_name);
+ info->module_name);
return NULL;
}
return library_name;
EXPORT
const char *hal_common_get_backend_symbol_name(enum hal_module module)
{
+ struct __hal_module_info *info = NULL;
+
/* Check parameter whether is valid or not */
if (module <= HAL_MODULE_UNKNOWN || module >= HAL_MODULE_END) {
_E("Invalid paramer of HAL module (%d)\n", module);
return NULL;
}
- if (!hal_module_info[module].symbol_name) {
+ info = _hal_api_conf_get_module_info(module);
+ if (info == NULL) {
+ _E("Failed to get module information\n");
+ return NULL;
+ }
+
+ if (!info->symbol_name) {
_E("%s backend library name is NULL\n",
- hal_module_info[module].module_name);
+ info->module_name);
return NULL;
}
- return hal_module_info[module].symbol_name;
+ return info->symbol_name;
}
EXPORT
int hal_common_get_backend(enum hal_module module, void **data)
{
+ struct __hal_module_info *info = NULL;
void *handle = NULL;
hal_backend *backend;
const char *library_name, *symbol_name;
int ret = 0;
+ info = _hal_api_conf_get_module_info(module);
+ if (info == NULL) {
+ _E("Failed to get module information\n");
+ ret = TIZEN_ERROR_UNKNOWN;
+ goto err;
+ }
+
/* Load module */
library_name = hal_common_get_backend_library_name(module);
if (!library_name) {
_E("Failed to get backend library name of %s\n",
- hal_module_info[module].module_name);
+ info->module_name);
return TIZEN_ERROR_INVALID_PARAMETER;
}
symbol_name = hal_common_get_backend_symbol_name(module);
if (!symbol_name) {
_E("Failed to get backend symbol name of %s\n",
- hal_module_info[module].module_name);
+ info->module_name);
ret = TIZEN_ERROR_INVALID_PARAMETER;
goto err;
}
ret = hal_common_check_backend_abi_version(module, backend->abi_version);
if (ret < 0) {
_E("Failed to check ABI version of %s\n",
- hal_module_info[module].module_name);
+ info->module_name);
ret = TIZEN_ERROR_INVALID_PARAMETER;
goto err;
}
/* Get the backend module data */
if (!backend->init) {
_E("hal_backend->init() is NULL for %s\n",
- hal_module_info[module].module_name);
+ info->module_name);
ret = TIZEN_ERROR_INVALID_PARAMETER;
goto err;
}
goto err;
}
- hal_module_info[module].library_backend = backend;
- hal_module_info[module].library_handle = handle;
+ info->library_backend = backend;
+ info->library_handle = handle;
_I("Get HAL backend: name(%s)/vendor(%s)\n",
backend->name, backend->vendor);
EXPORT
int hal_common_put_backend(enum hal_module module, void *data)
{
+ struct __hal_module_info *info = NULL;
hal_backend *backend = NULL;
void *handle = NULL;
int ret;
return TIZEN_ERROR_INVALID_PARAMETER;
}
- backend = hal_module_info[module].library_backend;
- handle = hal_module_info[module].library_handle;
+ info = _hal_api_conf_get_module_info(module);
+ if (info == NULL) {
+ _E("Failed to get module information\n");
+ return TIZEN_ERROR_UNKNOWN;
+ }
+
+ backend = info->library_backend;
+ handle = info->library_handle;
if (!backend) {
_I("Already fully put for HAL module (%d)\n", module);
if (handle)
dlclose(handle);
- hal_module_info[module].library_backend = NULL;
- hal_module_info[module].library_handle = NULL;
+ info->library_backend = NULL;
+ info->library_handle = NULL;
return TIZEN_ERROR_NONE;
}
int hal_common_check_backend_abi_version(enum hal_module module,
enum hal_abi_version abi_version)
{
+ struct __hal_module_info *info = NULL;
int i;
/* Check parameter whether is valid or not */
return TIZEN_ERROR_INVALID_PARAMETER;
}
+ info = _hal_api_conf_get_module_info(module);
+ if (info == NULL) {
+ _E("Failed to get module information\n");
+ return TIZEN_ERROR_UNKNOWN;
+ }
+
/* Check abi_version whether is supported or not */
- if (!hal_module_info[module].hal_api) {
+ if (!info->hal_api) {
_E("HAL module(%d) doesn't support HAL API\n", module);
return TIZEN_ERROR_INVALID_PARAMETER;
}
- if (!hal_module_info[module].num_abi_versions
- || !hal_module_info[module].abi_versions) {
+ if (!info->num_abi_versions
+ || !info->abi_versions) {
_E("HAL module(%d) doesn't have the ABI version information\n",
module);
return TIZEN_ERROR_INVALID_PARAMETER;
}
- for (i = 0; i < hal_module_info[module].num_abi_versions; i++) {
+ g_platform_curr_abi_version = _hal_api_conf_get_platform_abi_version();
+ for (i = 0; i < info->num_abi_versions; i++) {
struct hal_abi_version_match *data
- = &hal_module_info[module].abi_versions[i];
+ = &info->abi_versions[i];
if (g_platform_curr_abi_version != data->platform_abi_version)
continue;
--- /dev/null
+/*
+ * 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 <stdlib.h>
+
+#include <gio/gio.h>
+#include <glib-object.h>
+#include <json-glib/json-glib.h>
+
+#include "hal-common.h"
+#include "hal-common-interface.h"
+
+#include "hal-api-conf.h"
+
+#include "common.h"
+
+static enum hal_abi_version _platform_abi_version = HAL_ABI_VERSION_END;
+
+static JsonParser *_parser = NULL;
+static JsonObject *_root_object = NULL;
+
+static GHashTable *_module_hash = NULL;
+
+static bool _initialized = false;
+
+void __attribute__ ((destructor)) _destroy_configuration(void);
+
+void _destroy_configuration(void)
+{
+ if (_parser)
+ g_object_unref(_parser);
+
+ if (_module_hash) {
+ g_hash_table_remove_all(_module_hash);
+ g_hash_table_unref(_module_hash);
+ }
+
+ _initialized = false;
+}
+
+static const char *__get_group_string_name(enum hal_module module)
+{
+ if (HAL_MODULE_TBM <= module && module <= HAL_MODULE_INPUT)
+ return hal_group_string[HAL_GROUP_GRAPHICS];
+
+ if (HAL_MODULE_AUDIO <= module && module <= HAL_MODULE_ALSAUCM)
+ return hal_group_string[HAL_GROUP_MULTIMEDIA];
+
+ if (HAL_MODULE_BLUETOOTH <= module && module <= HAL_MODULE_MTP)
+ return hal_group_string[HAL_GROUP_CONNECTIVITY];
+
+ if (HAL_MODULE_TELEPHONY == module)
+ return hal_group_string[HAL_GROUP_TELEPHONY];
+
+ if (HAL_MODULE_LOCATION == module)
+ return hal_group_string[HAL_GROUP_LOCATION];
+
+ if (HAL_MODULE_COMMON <= module && module <= HAL_MODULE_DEVICE_HAPTIC)
+ return hal_group_string[HAL_GROUP_SYSTEM];
+
+ return NULL;
+}
+
+static enum hal_group __get_group_enum_name_by_module(enum hal_module module)
+{
+ if (HAL_MODULE_TBM <= module && module <= HAL_MODULE_INPUT)
+ return HAL_GROUP_GRAPHICS;
+
+ if (HAL_MODULE_AUDIO <= module && module <= HAL_MODULE_ALSAUCM)
+ return HAL_GROUP_MULTIMEDIA;
+
+ if (HAL_MODULE_BLUETOOTH <= module && module <= HAL_MODULE_MTP)
+ return HAL_GROUP_CONNECTIVITY;
+
+ if (HAL_MODULE_TELEPHONY == module)
+ return HAL_GROUP_TELEPHONY;
+
+ if (HAL_MODULE_LOCATION == module)
+ return HAL_GROUP_LOCATION;
+
+ if (HAL_MODULE_COMMON <= module && module <= HAL_MODULE_DEVICE_HAPTIC)
+ return HAL_GROUP_SYSTEM;
+
+ return HAL_GROUP_UNKNOWN;
+}
+
+static enum hal_abi_version __convert_abi_version_str_to_enum(const char *abi_version) {
+ int version;
+ for (version = HAL_ABI_VERSION_UNKNOWN + 1; version < HAL_ABI_VERSION_END; version++){
+ if (g_strcmp0(abi_version, hal_abi_version_str[version]) == 0)
+ return (enum hal_abi_version)version;
+ }
+
+ return HAL_ABI_VERSION_UNKNOWN;
+}
+
+static const char *__convert_module_to_string(enum hal_module module)
+{
+ return hal_module_string[module];
+}
+
+static enum hal_license __convert_license_str_to_enum(const char *license)
+{
+ if (g_strcmp0(license, "APACHE_2_0") == 0)
+ return HAL_LICENSE_APACHE_2_0;
+
+ if (g_strcmp0(license, "FLORA") == 0)
+ return HAL_LICENSE_FLORA;
+
+ if (g_strcmp0(license, "MIT") == 0)
+ return HAL_LICENSE_MIT;
+
+ return HAL_LICENSE_UNKNOWN;
+}
+
+__attribute__ ((visibility("default")))
+void _destroy_module_info(gpointer data)
+{
+#define SAFE_FREE_AND_NULL(x) \
+do { \
+ if (x) { \
+ free(x); \
+ x = NULL; \
+ } \
+} while (0);
+
+ struct __hal_module_info *info = (struct __hal_module_info *)data;
+ gboolean is_contained = false;
+
+ if (info) {
+ is_contained = g_hash_table_contains(_module_hash, GINT_TO_POINTER(info->module));
+ if (is_contained)
+ g_hash_table_steal(_module_hash, GINT_TO_POINTER(info->module));
+
+ SAFE_FREE_AND_NULL(info->module_name);
+ SAFE_FREE_AND_NULL(info->library_name);
+ SAFE_FREE_AND_NULL(info->library_name_64bit);
+ SAFE_FREE_AND_NULL(info->symbol_name);
+ SAFE_FREE_AND_NULL(info->abi_versions);
+ SAFE_FREE_AND_NULL(info);
+ }
+}
+
+static bool __init_configuration(void)
+{
+ JsonNode *root_node = NULL;
+ GError *error = NULL;
+ gboolean result;
+
+ if (_initialized)
+ return _initialized;
+
+ _parser = json_parser_new();
+ result = json_parser_load_from_file(_parser, HAL_CONFIGURATION_PATH, &error);
+ if (result == FALSE) {
+ _E("Failed to parsing json configuration file : %s\n", error->message);
+ goto err;
+ }
+
+ root_node = json_parser_get_root(_parser);
+ if (JSON_NODE_HOLDS_OBJECT(root_node) == FALSE) {
+ _E("There is no object in root node\n");
+ goto err;
+ }
+
+ _root_object = json_node_get_object(root_node);
+ _module_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, _destroy_module_info);
+
+ _initialized = true;
+
+ return _initialized;
+
+err:
+ if (error)
+ g_error_free(error);
+ _destroy_configuration();
+
+ return _initialized;
+}
+
+static struct __hal_module_info *__create_hal_module_info(enum hal_module module, JsonObject *object)
+{
+ struct __hal_module_info *info;
+ JsonArray *abi_versions_array = NULL;
+ GList *abi_list = NULL;
+ GList *iter_list = NULL;
+ int list_index = 0;
+ const char *tmp;
+
+ info = (struct __hal_module_info *)calloc(1, sizeof(struct __hal_module_info));
+ if (info == NULL) {
+ _E("Out of Memory\n");
+ return NULL;
+ }
+
+ info->module = module;
+ info->module_name = g_strdup(__convert_module_to_string(module));
+ info->group = __get_group_enum_name_by_module(module);
+
+ tmp = json_object_get_string_member(object, "license");
+ info->license = __convert_license_str_to_enum(tmp);
+
+ info->library_name = g_strdup(json_object_get_string_member(object, "library_name"));
+ info->library_name_64bit = g_strdup(json_object_get_string_member(object, "library_name_64bit"));
+ info->symbol_name = g_strdup(json_object_get_string_member(object, "symbol_name"));
+
+ if (info->library_name && info->library_name_64bit && info->symbol_name)
+ info->hal_api = true;
+
+ abi_versions_array = json_object_get_array_member(object, "abi_versions");
+ if (abi_versions_array == NULL)
+ return info;
+
+ abi_list = json_array_get_elements(abi_versions_array);
+ info->num_abi_versions = g_list_length(abi_list);
+ if (info->num_abi_versions > 0) {
+ info->abi_versions = (struct hal_abi_version_match*)calloc(info->num_abi_versions,
+ sizeof(struct hal_abi_version_match));
+ if (info->abi_versions == NULL) {
+ _E("Out of Memory\n");
+ _destroy_module_info(info);
+ g_list_free(abi_list);
+ return NULL;
+ }
+
+ for (iter_list = abi_list; iter_list != NULL; iter_list = iter_list->next) {
+ JsonObject *tmp_object = json_node_get_object(iter_list->data);
+
+ tmp = json_object_get_string_member(tmp_object, "platform_abi_version");
+ info->abi_versions[list_index].platform_abi_version =
+ __convert_abi_version_str_to_enum(tmp);
+
+ tmp = json_object_get_string_member(tmp_object, "backend_min_abi_version");
+ info->abi_versions[list_index].backend_min_abi_version =
+ __convert_abi_version_str_to_enum(tmp);
+ list_index++;
+ }
+ }
+
+ if (abi_list)
+ g_list_free(abi_list);
+
+ return info;
+}
+
+__attribute__ ((visibility("default")))
+struct __hal_module_info* _hal_api_conf_get_module_info(enum hal_module module)
+{
+ struct __hal_module_info *info = NULL;
+ JsonObject *module_object = NULL;
+ JsonArray *module_array = NULL;
+ GList *module_list = NULL;
+ GList *iter_list;
+ const char *group_name = NULL;
+ const char *module_name = NULL;
+ bool ret_initialized;
+
+ ret_initialized = __init_configuration();
+ if (ret_initialized == false) {
+ _E("Failed to parse json information\n");
+ goto ret;
+ }
+
+ info = (struct __hal_module_info*)g_hash_table_lookup(_module_hash, GINT_TO_POINTER(module));
+ if (info != NULL)
+ return info;
+
+ group_name = __get_group_string_name(module);
+ if (group_name == NULL) {
+ _E("There is wrong module\n");
+ goto ret;
+ }
+
+ module_object = json_object_get_object_member(_root_object, "MODULE_INFO");
+ module_array = json_object_get_array_member(module_object, group_name);
+ module_list = json_array_get_elements(module_array);
+ module_name = __convert_module_to_string(module);
+
+ for (iter_list = module_list; iter_list != NULL; iter_list = iter_list->next) {
+ JsonObject *tmp_object = json_node_get_object(iter_list->data);
+ const char *value = json_object_get_string_member(tmp_object, "module");
+ if (g_strcmp0(value, module_name) == 0) {
+ info = __create_hal_module_info(module, tmp_object);
+ if (info == NULL)
+ _E("Failed to create hal module info\n");
+ else
+ g_hash_table_insert(_module_hash, GINT_TO_POINTER(module), info);
+ break;
+ }
+ }
+
+ret:
+ if (module_list)
+ g_list_free(module_list);
+
+ return info;
+}
+
+enum hal_abi_version _hal_api_conf_get_platform_abi_version(void)
+{
+ const char *abi_version = NULL;
+ bool ret_initialized;
+
+ if (_platform_abi_version != HAL_ABI_VERSION_END)
+ return _platform_abi_version;
+
+ ret_initialized = __init_configuration();
+ if (ret_initialized == false) {
+ _E("Failed to parser json file\n");
+ return HAL_ABI_VERSION_UNKNOWN;
+ }
+
+ abi_version = json_object_get_string_member(_root_object, "PLATFORM_ABI_VERSION");
+ _platform_abi_version = __convert_abi_version_str_to_enum(abi_version);
+
+ return _platform_abi_version;
+}
--- /dev/null
+/*
+ * 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.
+ */
+
+#ifndef __HAL_API_CONF__
+#define __HAL_API_CONF__
+
+#include <gio/gio.h>
+#include <glib-object.h>
+
+#include <tzplatform_config.h>
+
+#include "hal-common-interface.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define HAL_CONFIGURATION_PATH tzplatform_mkpath(TZ_SYS_RO_ETC, "hal/hal-api.json")
+
+struct __hal_module_info *_hal_api_conf_get_module_info(enum hal_module module);
+
+enum hal_abi_version _hal_api_conf_get_platform_abi_version(void);
+
+void _destroy_module_info(gpointer data);
+
+#ifdef __cplusplus
+}
+#endif
+#endif