4 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
27 #define EXPORT __attribute__ ((visibility("default")))
31 const char *hal_common_get_backend_library_name(enum hal_module module)
35 /* Check parameter whether is valid or not */
36 if (module <= HAL_MODULE_UNKNOWN || module >= HAL_MODULE_END) {
37 _E("Invalid parameter of HAL module (%d)\n", module);
41 #if defined(__aarch64__)
42 library_name = hal_module_info[module].library_name_64bit;
44 library_name = hal_module_info[module].library_name;
48 _E("%s backend library name is NULL\n",
49 hal_module_info[module].module_name);
56 const char *hal_common_get_backend_symbol_name(enum hal_module module)
58 /* Check parameter whether is valid or not */
59 if (module <= HAL_MODULE_UNKNOWN || module >= HAL_MODULE_END) {
60 _E("Invalid paramer of HAL module (%d)\n", module);
64 if (!hal_module_info[module].symbol_name) {
65 _E("%s backend library name is NULL\n",
66 hal_module_info[module].module_name);
70 return hal_module_info[module].symbol_name;
74 int hal_common_check_backend_abi_version(enum hal_module module,
75 enum hal_abi_version abi_version)
79 /* Check parameter whether is valid or not */
80 if (module <= HAL_MODULE_UNKNOWN || module >= HAL_MODULE_END) {
81 _E("Invalid paramer of HAL module (%d)\n", module);
82 return TIZEN_ERROR_INVALID_PARAMETER;
85 if (abi_version <= HAL_ABI_VERSION_UNKNOWN
86 || abi_version >= HAL_ABI_VERSION_END) {
87 _E("Invalid paramer of HAL ABI version (%d)\n", abi_version);
88 return TIZEN_ERROR_INVALID_PARAMETER;
91 /* Check abi_version whether is supported or not */
92 if (!hal_module_info[module].hal_api) {
93 _E("HAL module(%d) doesn't support HAL API\n", module);
94 return TIZEN_ERROR_INVALID_PARAMETER;
97 if (!hal_module_info[module].num_abi_versions
98 || !hal_module_info[module].abi_versions) {
99 _E("HAL module(%d) doesn't have the ABI version information\n",
101 return TIZEN_ERROR_INVALID_PARAMETER;
104 for (i = 0; i < hal_module_info[module].num_abi_versions; i++) {
105 struct hal_abi_version_match *data
106 = &hal_module_info[module].abi_versions[i];
108 if (g_curr_hal_abi_version != data->curr_version)
111 if (abi_version <= data->curr_version
112 && abi_version >= data->compat_version)
113 return TIZEN_ERROR_NONE;
116 return TIZEN_ERROR_INVALID_PARAMETER;