• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
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 #include "hdf_base.h"
17 #include "hdf_device_desc.h"
18 #include "hdf_log.h"
19 
20 extern void SDK_init(void);
21 extern void SDK_init2(void);
22 
HisiSdkBind(struct HdfDeviceObject * device)23 static int32_t HisiSdkBind(struct HdfDeviceObject *device)
24 {
25     static struct IDeviceIoService service;
26     if (device == NULL) {
27         HDF_LOGE("%s: device is null!", __func__);
28         return HDF_ERR_INVALID_OBJECT;
29     }
30     device->service = &service;
31     HDF_LOGI("%s: calling SDK_init form HDF", __func__);
32     SDK_init();
33     HDF_LOGI("%s: SDK service init done!", __func__);
34     return HDF_SUCCESS;
35 }
36 
HisiSdkInit(struct HdfDeviceObject * device)37 static int32_t HisiSdkInit(struct HdfDeviceObject *device)
38 {
39     (void)device;
40     return HDF_SUCCESS;
41 }
42 
HisiSdkRelease(struct HdfDeviceObject * device)43 static void HisiSdkRelease(struct HdfDeviceObject *device)
44 {
45     (void)device;
46 }
47 
48 struct HdfDriverEntry g_hisiSdkEntry = {
49     .moduleVersion = 1,
50     .Bind = HisiSdkBind,
51     .Init = HisiSdkInit,
52     .Release = HisiSdkRelease,
53     .moduleName = "HDF_PLATFORM_HISI_SDK",
54 };
55 HDF_INIT(g_hisiSdkEntry);
56 
HisiSdkBind2(struct HdfDeviceObject * device)57 static int32_t HisiSdkBind2(struct HdfDeviceObject *device)
58 {
59     static struct IDeviceIoService service;
60     if (device == NULL) {
61         HDF_LOGE("%s: device is null!", __func__);
62         return HDF_ERR_INVALID_OBJECT;
63     }
64     device->service = &service;
65     HDF_LOGI("%s: calling SDK_init2 form HDF", __func__);
66     SDK_init2();
67     HDF_LOGI("%s: SDK service init done!", __func__);
68     return HDF_SUCCESS;
69 }
70 
HisiSdkInit2(struct HdfDeviceObject * device)71 static int32_t HisiSdkInit2(struct HdfDeviceObject *device)
72 {
73     (void)device;
74     return HDF_SUCCESS;
75 }
76 
HisiSdkRelease2(struct HdfDeviceObject * device)77 static void HisiSdkRelease2(struct HdfDeviceObject *device)
78 {
79     (void)device;
80 }
81 
82 struct HdfDriverEntry g_hisiSdkEntry2 = {
83     .moduleVersion = 1,
84     .Bind = HisiSdkBind2,
85     .Init = HisiSdkInit2,
86     .Release = HisiSdkRelease2,
87     .moduleName = "HDF_PLATFORM_HISI_SDK2",
88 };
89 HDF_INIT(g_hisiSdkEntry2);
90