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,
77 HAL_MODULE_DEVICE_INPUT,
78 HAL_MODULE_DEVICE_POWER,
81 * TODO: If need to add new module, have to add it below
82 * without modifying already defined module id.
89 * @brief Get the backend library name according to the type of HAL module
90 * @param[in] HAL module id among enum hal_moudle
91 * @param[out] Backend Library name of HAL module
92 * @param[in] Arrary size of name[]
93 * @return @c 0 on success, otherwise a negative error value
95 int hal_common_get_backend_library_name(enum hal_module module, char *name, int size);
98 * @brief Get the backend symbol name according to the type of HAL module
99 * @param[in] HAL module id among enum hal_moudle
100 * @param[out] Backend symbol name of HAL module
101 * @param[in] Arrary size of name[]
102 * @return @c 0 on success, otherwise a negative error value
104 int hal_common_get_backend_symbol_name(enum hal_module module, char *name, int size);
107 * @brief Get the backend module name according to the type of HAL module
108 * @param[in] HAL module id among enum hal_moudle
109 * @param[out] Backend module name of HAL module
110 * @param[in] Arrary size of name[]
111 * @return @c 0 on success, otherwise a negative error value
113 int hal_common_get_backend_module_name(enum hal_module module, char *name, int size);
116 * @brief Get the backend data according to the type of HAL module
117 * @param[in] HAL module id among enum hal_moudle
118 * @param[out] Data pointer where 'hal_backend_[module]_funcs' instance
119 * should be stored from HAL backend binary.
120 * @return @c 0 on success, otherwise a negative error value
122 int hal_common_get_backend(enum hal_module module, void **data);
125 * @brief Put the backend data according to the type of HAL module
126 * @param[in] HAL module id among enum hal_moudle
127 * @param[in] Data pointer where 'hal_backend_[module]_funcs' instance
128 * @return @c 0 on success, otherwise a negative error value
130 int hal_common_put_backend(enum hal_module module, void *data);
133 * @brief Get 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[out] Data pointer where 'hal_backend_[module]_funcs' instance
136 * should be stored from HAL backend binary.
137 * @param[in] HAL backend library name which is not default library name
138 * @return @c 0 on success, otherwise a negative error value
140 int hal_common_get_backend_with_library_name(enum hal_module module,
141 void **data, const char *library_name);
144 * @brief Put the backend data with the specific library name according to the type of HAL module
145 * @param[in] HAL module id among enum hal_moudle
146 * @param[in] Data pointer where 'hal_backend_[module]_funcs' instance
147 * @param[in] HAL backend library name which is not default library name
148 * @return @c 0 on success, otherwise a negative error value
150 int hal_common_put_backend_with_library_name(enum hal_module module,
151 void *data, const char *library_name);
154 * @brief Check HAL ABI version whehter is suppored or not on current platform
155 * @param[in] HAL module id among enum hal_moudle
156 * @param[in] HAL ABI version of backend module among enum hal_abi_version
157 * @return @c 0 on success, otherwise a negative error value
159 int hal_common_check_backend_abi_version(enum hal_module module,
160 enum hal_abi_version abi_version);
163 * @brief Get the backend HAL ABI version according to the type of HAL module
164 * @param[in] HAL module id among enum hal_moudle
165 * @return @c positive integer value on success, otherwise a zero error value
167 unsigned int hal_common_get_backend_abi_version(enum hal_module module);
170 * @brief Get the backend name according to the type of HAL module
171 * @param[in] HAL module id among enum hal_moudle
172 * @param[out] Backend name of HAL module
173 * @param[in] Arrary size of name[]
174 * @return @c positive integer value on success, otherwise a zero error value
176 int hal_common_get_backend_name(enum hal_module module, char *name, int size);
179 * @brief Get the backend vendor description according to the type of HAL module
180 * @param[in] HAL module id among enum hal_moudle
181 * @param[out] Backend vendor description of HAL module
182 * @param[in] Arrary size of vendor[]
183 * @return @c positive integer value on success, otherwise a zero error value
185 int hal_common_get_backend_vendor(enum hal_module module, char *vendor, int size);
188 * @brief Get the number of the backend libraries according to the type of HAL module
189 * @param[in] HAL module id among enum hal_moudle
190 * @return @c 0 on success, otherwise a negative error value
192 int hal_common_get_backend_count(enum hal_module module);
195 * @brief Get the backend library names according to the type of HAL module
196 * @param[in] HAL module id among enum hal_moudle
197 * @param[out] Data pointer should be filled by backend library names
198 * @param[in] Number of backend library of specific HAL module
199 * @param[in] Maximum length of the library name
200 * @return @c 0 on success, otherwise a negative error value
202 int hal_common_get_backend_library_names(enum hal_module module,
203 char **library_names,
205 int library_name_size);
210 #endif /* __HAL_COMMON__ */