1 /*
2  * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup DriverHdi
18  * @{
19  *
20  * @brief Provides APIs for a system ability to obtain hardware device interface (HDI) services,
21  * load or unload a device, and listen for service status, and capabilities for the hdi-gen tool to
22  * automatically generate code in the interface description language (IDL).
23  *
24  * The HDF and the IDL code generated allow system abilities to access the HDI driver service.
25  *
26  * @since 1.0
27  */
28 
29 /**
30  * @file hdi_support.h
31  *
32  * @brief Defines APIs for loading and unloading an HDI driver.
33  *
34  * @since 1.0
35  */
36 
37 #ifndef HDF_HDI_SUPPORT_H
38 #define HDF_HDI_SUPPORT_H
39 
40 #include "hdf_base.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif /* __cplusplus */
45 /**
46  * @brief Loads the HDI driver of a service module.
47  * This API obtains the driver name based on the interface descriptor and service name,
48  * and then loads the device driver to the system.
49  *
50  * @param desc Indicates the pointer to the HDI descriptor.
51  * @param serviceName Indicates the service name of the driver to load.
52  * @return Returns the HDI driver object.
53  */
54 void *LoadHdiImpl(const char *desc, const char *serviceName);
55 
56 /**
57  * @brief Unloads the HDI driver of a service module.
58  *
59  * This API obtains the driver name based on the interface descriptor and service name,
60  * and then calls <b>unload()</b> of the driver to unload the driver.
61  * @param desc Indicates the pointer to the HDI descriptor.
62  * @param serviceName Indicates the service name of the driver to unload.
63  * @param impl Indicates the pointer to the HDI driver object to unload.
64  */
65 void UnloadHdiImpl(const char *desc, const char *serviceName, void *impl);
66 #ifdef __cplusplus
67 }
68 #endif /* __cplusplus */
69 
70 #endif /* HDF_HDI_SUPPORT_H */
71