• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 #include "codec_stub.h"
17 #include <hdf_log.h>
18 #include <osal_mem.h>
19 
CodecServiceDispatch(struct HdfDeviceIoClient * client,int cmdId,struct HdfSBuf * data,struct HdfSBuf * reply)20 static int32_t CodecServiceDispatch(struct HdfDeviceIoClient *client, int cmdId,
21     struct HdfSBuf *data, struct HdfSBuf *reply)
22 {
23     return CodecServiceOnRemoteRequest(client, cmdId, data, reply);
24 }
25 
HdfCodecDriverRelease(struct HdfDeviceObject * deviceObject)26 void HdfCodecDriverRelease(struct HdfDeviceObject *deviceObject)
27 {
28     struct IDeviceIoService *testService = deviceObject->service;
29     OsalMemFree(testService);
30 }
31 
HdfCodecDriverBind(struct HdfDeviceObject * deviceObject)32 int HdfCodecDriverBind(struct HdfDeviceObject *deviceObject)
33 {
34     HDF_LOGE("HdfCodecDriverBind enter!");
35 
36     struct IDeviceIoService *ioService = (struct IDeviceIoService *)OsalMemAlloc(sizeof(struct IDeviceIoService));
37     if (ioService == NULL) {
38         HDF_LOGE("HdfCodecDriverBind OsalMemAlloc IDeviceIoService failed!");
39         return HDF_FAILURE;
40     }
41 
42     ioService->Dispatch = CodecServiceDispatch;
43     ioService->Open = NULL;
44     ioService->Release = NULL;
45 
46     deviceObject->service = ioService;
47     return HDF_SUCCESS;
48 }
49 
HdfCodecDriverInit(struct HdfDeviceObject * deviceObject)50 int HdfCodecDriverInit(struct HdfDeviceObject *deviceObject)
51 {
52     HDF_LOGE("HdfSampleDriverCInit enter, new hdi impl");
53     return HDF_SUCCESS;
54 }
55 
56 struct HdfDriverEntry g_codecHostDriverEntry = {
57     .moduleVersion = 1,
58     .moduleName = "libcodec_server.z.so",
59     .Bind = HdfCodecDriverBind,
60     .Init = HdfCodecDriverInit,
61     .Release = HdfCodecDriverRelease,
62 };
63 
64 HDF_INIT(g_codecHostDriverEntry);