2 * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include "hal-common.h"
31 #define _D(fmt, args...) SLOGD(fmt, ##args)
32 #define _I(fmt, args...) SLOGI(fmt, ##args)
33 #define _W(fmt, args...) SLOGW(fmt, ##args)
34 #define _E(fmt, args...) SLOGE(fmt, ##args)
36 #define _D(fmt, args...) do { } while(0)
37 #define _I(fmt, args...) do { } while(0)
38 #define _W(fmt, args...) do { } while(0)
39 #define _E(fmt, args...) do { } while(0)
42 #define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0]))
45 HAL_LICENSE_UNKNOWN = 0,
46 HAL_LICENSE_APACHE_2_0,
53 HAL_GROUP_UNKNOWN = 0,
56 HAL_GROUP_CONNECTIVITY,
63 static const char *const hal_group_string[] = {
64 [HAL_GROUP_UNKNOWN] = "HAL_GROUP_UNKNOWN",
65 [HAL_GROUP_GRAPHICS] = "HAL_GROUP_GRAPHICS",
66 [HAL_GROUP_MULTIMEDIA] = "HAL_GROUP_MULTIMEDIA",
67 [HAL_GROUP_CONNECTIVITY] = "HAL_GROUP_CONNECTIVITY",
68 [HAL_GROUP_TELEPHONY] = "HAL_GROUP_TELEPHONY",
69 [HAL_GROUP_LOCATION] = "HAL_GROUP_LOCATION",
70 [HAL_GROUP_SYSTEM] = "HAL_GROUP_SYSTEM",
74 * hal-api-common (/platform/hal/api/common) provides the HAL ABI
75 * (Application Binary Interface) version check feature which is used to check
76 * the ABI compatibility between HAL API package like hal-api-audio-*.rpm
77 * and HAL backend package like hal-backend-audio-*.rpm which is included
78 * in hal.img. In order to compare ABI version between two binary,
79 * Tizen core platform always must maintain the current HAL ABI version.
80 * So that, define the below global variable (g_platform_curr_abi_version).
82 * 'g_platform_curr_abi_version' will be used for all HAL API modules,
83 * to check whether HAL backend ABI version of each module in hal.img
84 * is supported or not with current Tizen core HAL ABI version.
86 * 'g_platform_curr_abi_version' must be updated when Tizen platform
87 * will be released officially.
89 struct hal_abi_version_match {
90 enum hal_abi_version platform_abi_version;
91 enum hal_abi_version backend_min_abi_version;
94 struct __hal_module_info {
98 enum hal_module module;
99 enum hal_license license;
101 char *backend_module_name;
104 char *library_name_64bit;
106 hal_backend *backend;
109 unsigned int num_abi_versions;
110 struct hal_abi_version_match *abi_versions;
113 bool hal_backend_extension;
116 static inline const char* get_backend_library_name(struct __hal_module_info *info)
121 #if defined(__aarch64__) || defined(__x86_64__) || defined (__riscv)
122 return info->library_name_64bit;
124 return info->library_name;
131 #endif /* __COMMON_H__ */