1 /*
2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3 *
4 * HDF is dual licensed: you can use it either under the terms of
5 * the GPL, or the BSD license, at your option.
6 * See the LICENSE file in the root of this repository for complete details.
7 */
8
9 #include "devhost_service.h"
10 #include "devmgr_service.h"
11 #include "devsvc_manager.h"
12 #include "devsvc_manager_ext.h"
13 #include "hdf_device.h"
14 #include "hdf_device_node_ext.h"
15 #include "hdf_device_token.h"
16 #include "hdf_driver_installer.h"
17 #include "hdf_driver_loader.h"
18 #include "hdf_object_manager.h"
19
20 static const struct HdfObjectCreator g_liteObjectCreators[] = {
21 [HDF_OBJECT_ID_DEVMGR_SERVICE] =
22 {
23 .Create = DevmgrServiceCreate,
24 .Release = DevmgrServiceRelease,
25 },
26 [HDF_OBJECT_ID_DEVSVC_MANAGER] =
27 {
28 .Create = DevSvcManagerExtCreate,
29 .Release = DevSvcManagerExtRelease,
30 },
31 [HDF_OBJECT_ID_DEVHOST_SERVICE] =
32 {
33 .Create = DevHostServiceCreate,
34 .Release = DevHostServiceRelease,
35 },
36 [HDF_OBJECT_ID_DRIVER_INSTALLER] =
37 {
38 .Create = DriverInstallerCreate,
39 .Release = NULL,
40 },
41 [HDF_OBJECT_ID_DRIVER_LOADER] =
42 {
43 .Create = HdfDriverLoaderCreate,
44 .Release = NULL,
45 },
46 [HDF_OBJECT_ID_DEVICE] =
47 {
48 .Create = HdfDeviceCreate,
49 .Release = HdfDeviceRelease,
50 },
51 [HDF_OBJECT_ID_DEVICE_TOKEN] =
52 {
53 .Create = HdfDeviceTokenCreate,
54 .Release = HdfDeviceTokenRelease,
55 },
56 [HDF_OBJECT_ID_DEVICE_SERVICE] =
57 {
58 .Create = DeviceNodeExtCreate,
59 .Release = DeviceNodeExtRelease,
60 }
61 };
62
HdfObjectManagerGetCreators(int objectId)63 const struct HdfObjectCreator *HdfObjectManagerGetCreators(int objectId)
64 {
65 int numConfigs = sizeof(g_liteObjectCreators) / sizeof(g_liteObjectCreators[0]);
66 if ((objectId >= 0) && (objectId < numConfigs)) {
67 return &g_liteObjectCreators[objectId];
68 }
69 return NULL;
70 }
71