2 * HAL (Hardware Abstract Layer) Common API
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.
19 #ifndef __HAL_COMMON__
20 #define __HAL_COMMON__
22 #include "hal-common-interface.h"
29 HAL_MODULE_UNKNOWN = 0,
31 /* HAL_GROUP_GRAPHICS */
37 /* HAL_GROUP_MULTIMEDIA */
45 /* HAL_GROUP_CONNECTIVITY */
54 /* HAL_GROUP_TELEPHONY */
57 /* HAL_GROUP_LOCATION */
60 /* HAL_GROUP_SYSTEM */
64 HAL_MODULE_PERIPHERAL,
65 HAL_MODULE_DEVICE_BATTERY,
66 HAL_MODULE_DEVICE_BEZEL,
67 HAL_MODULE_DEVICE_DISPLAY,
69 HAL_MODULE_DEVICE_TOUCHSCREEN,
70 HAL_MODULE_DEVICE_LED,
71 HAL_MODULE_DEVICE_BOARD,
72 HAL_MODULE_DEVICE_EXTERNAL_CONNECTION,
73 HAL_MODULE_DEVICE_THERMAL,
74 HAL_MODULE_DEVICE_USB_GADGET,
75 HAL_MODULE_DEVICE_HAPTIC,
76 HAL_MODULE_DEVICE_MEMORY,
79 * TODO: If need to add new module, have to add it below
80 * without modifying already defined module id.
87 * @brief Get the backend library name according to the type of HAL module
88 * @param[in] HAL module id among enum hal_moudle
89 * @param[out] Backend Library name of HAL module
90 * @param[in] Arrary size of name[]
91 * @return @c 0 on success, otherwise a negative error value
93 int hal_common_get_backend_library_name(enum hal_module module, char *name, int size);
96 * @brief Get the backend symbol name according to the type of HAL module
97 * @param[in] HAL module id among enum hal_moudle
98 * @param[out] Backend symbol name of HAL module
99 * @param[in] Arrary size of name[]
100 * @return @c 0 on success, otherwise a negative error value
102 int hal_common_get_backend_symbol_name(enum hal_module module, char *name, int size);
105 * @brief Get the backend data according to the type of HAL module
106 * @param[in] HAL module id among enum hal_moudle
107 * @param[out] Data pointer where 'hal_backend_[module]_funcs' instance
108 * should be stored from HAL backend binary.
109 * @return @c 0 on success, otherwise a negative error value
111 int hal_common_get_backend(enum hal_module module, void **data);
114 * @brief Put the backend data according to the type of HAL module
115 * @param[in] HAL module id among enum hal_moudle
116 * @param[in] Data pointer where 'hal_backend_[module]_funcs' instance
117 * @return @c 0 on success, otherwise a negative error value
119 int hal_common_put_backend(enum hal_module module, void *data);
122 * @brief Get the backend data with the specific library name according to the type of HAL module
123 * @param[in] HAL module id among enum hal_moudle
124 * @param[out] Data pointer where 'hal_backend_[module]_funcs' instance
125 * should be stored from HAL backend binary.
126 * @param[in] HAL backend library name which is not default library name
127 * @return @c 0 on success, otherwise a negative error value
129 int hal_common_get_backend_with_library_name(enum hal_module module,
130 void **data, const char *library_name);
133 * @brief Put the backend data with the specific library name according to the type of HAL module
134 * @param[in] HAL module id among enum hal_moudle
135 * @param[in] Data pointer where 'hal_backend_[module]_funcs' instance
136 * @param[in] HAL backend library name which is not default library name
137 * @return @c 0 on success, otherwise a negative error value
139 int hal_common_put_backend_with_library_name(enum hal_module module,
140 void *data, const char *library_name);
143 * @brief Check HAL ABI version whehter is suppored or not on current platform
144 * @param[in] HAL module id among enum hal_moudle
145 * @param[in] HAL ABI version of backend module among enum hal_abi_version
146 * @return @c 0 on success, otherwise a negative error value
148 int hal_common_check_backend_abi_version(enum hal_module module,
149 enum hal_abi_version abi_version);
152 * @brief Get the backend HAL ABI version according to the type of HAL module
153 * @param[in] HAL module id among enum hal_moudle
154 * @return @c positive integer value on success, otherwise a zero error value
156 unsigned int hal_common_get_backend_abi_version(enum hal_module module);
159 * @brief Get the backend name according to the type of HAL module
160 * @param[in] HAL module id among enum hal_moudle
161 * @param[out] Backend name of HAL module
162 * @param[in] Arrary size of name[]
163 * @return @c positive integer value on success, otherwise a zero error value
165 int hal_common_get_backend_name(enum hal_module module, char *name, int size);
168 * @brief Get the backend vendor description according to the type of HAL module
169 * @param[in] HAL module id among enum hal_moudle
170 * @param[out] Backend vendor description of HAL module
171 * @param[in] Arrary size of vendor[]
172 * @return @c positive integer value on success, otherwise a zero error value
174 int hal_common_get_backend_vendor(enum hal_module module, char *vendor, int size);
177 * @brief Get the number of the backend libraries according to the type of HAL module
178 * @param[in] HAL module id among enum hal_moudle
179 * @return @c 0 on success, otherwise a negative error value
181 int hal_common_get_backend_count(enum hal_module module);
184 * @brief Get the backend library names according to the type of HAL module
185 * @param[in] HAL module id among enum hal_moudle
186 * @param[out] Data pointer should be filled by backend library names
187 * @param[in] Number of backend library of specific HAL module
188 * @param[in] Maximum length of the library name
189 * @return @c 0 on success, otherwise a negative error value
191 int hal_common_get_backend_library_names(enum hal_module module,
192 char **library_names,
194 int library_name_size);
199 #endif /* __HAL_COMMON__ */