halapi: common: Remove json unused code
[platform/hal/api/common.git] / include / hal-common.h
1 /*
2  * HAL (Hardware Abstract Layer) Common API
3  *
4  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
5  *
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
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  */
18
19 #ifndef __HAL_COMMON__
20 #define __HAL_COMMON__
21
22 #include "hal-common-interface.h"
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 enum hal_module {
29         HAL_MODULE_UNKNOWN = 0,
30
31         /* HAL_GROUP_GRAPHICS */
32         HAL_MODULE_TBM,
33         HAL_MODULE_TDM,
34         HAL_MODULE_COREGL,
35         HAL_MODULE_INPUT,
36
37         /* HAL_GROUP_MULTIMEDIA */
38         HAL_MODULE_AUDIO,
39         HAL_MODULE_CAMERA,
40         HAL_MODULE_RADIO,
41         HAL_MODULE_CODEC,
42         HAL_MODULE_USB_AUDIO,
43         HAL_MODULE_ALSAUCM,
44
45         /* HAL_GROUP_CONNECTIVITY */
46         HAL_MODULE_BLUETOOTH,
47         HAL_MODULE_WIFI,
48         HAL_MODULE_NAN,
49         HAL_MODULE_NFC,
50         HAL_MODULE_ZIGBEE,
51         HAL_MODULE_UWB,
52         HAL_MODULE_MTP,
53
54         /* HAL_GROUP_TELEPHONY */
55         HAL_MODULE_TELEPHONY,
56
57         /* HAL_GROUP_LOCATION */
58         HAL_MODULE_LOCATION,
59
60         /* HAL_GROUP_SYSTEM */
61         HAL_MODULE_COMMON,
62         HAL_MODULE_POWER,
63         HAL_MODULE_SENSOR,
64         HAL_MODULE_PERIPHERAL,
65         HAL_MODULE_DEVICE_BATTERY,
66         HAL_MODULE_DEVICE_BEZEL,
67         HAL_MODULE_DEVICE_DISPLAY,
68         HAL_MODULE_DEVICE_IR,
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
78         /*
79          * TODO: If need to add new module, have to add it below
80          * without modifying already defined module id.
81          */
82
83         HAL_MODULE_END,
84 };
85
86 /**
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
92  */
93 int hal_common_get_backend_library_name(enum hal_module module, char *name, int size);
94
95 /**
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
101  */
102 int hal_common_get_backend_symbol_name(enum hal_module module, char *name, int size);
103
104 /**
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
110  */
111 int hal_common_get_backend(enum hal_module module, void **data);
112
113 /**
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
118  */
119 int hal_common_put_backend(enum hal_module module, void *data);
120
121 /**
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
128  */
129 int hal_common_get_backend_with_library_name(enum hal_module module,
130                                         void **data, const char *library_name);
131
132 /**
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
138  */
139 int hal_common_put_backend_with_library_name(enum hal_module module,
140                                         void *data, const char *library_name);
141
142 /**
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
147  */
148 int hal_common_check_backend_abi_version(enum hal_module module,
149                                         enum hal_abi_version abi_version);
150
151 /**
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
155  */
156 unsigned int hal_common_get_backend_abi_version(enum hal_module module);
157
158 /**
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
164  */
165 int hal_common_get_backend_name(enum hal_module module, char *name, int size);
166
167 /**
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
173  */
174 int hal_common_get_backend_vendor(enum hal_module module, char *vendor, int size);
175
176 /**
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
180  */
181 int hal_common_get_backend_count(enum hal_module module);
182
183 /**
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
190  */
191 int hal_common_get_backend_library_names(enum hal_module module,
192                                         char **library_names,
193                                         int library_count,
194                                         int library_name_size);
195
196 #ifdef __cplusplus
197 }
198 #endif
199 #endif /* __HAL_COMMON__ */