1 /*
2  * Copyright (c) 2022 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 #ifndef CAMERA_UTILS_H
10 #define CAMERA_UTILS_H
11 
12 #include <utils/hdf_base.h>
13 #include <utils/hdf_sbuf.h>
14 #include <core/hdf_device_desc.h>
15 #include "camera_device_manager.h"
16 
17 #define ID_MAX_NUM 10
18 
19 bool FindAvailableId(uint32_t *id);
20 int32_t AddPermissionId(int32_t id, int32_t permissionId);
21 int32_t RemovePermissionId(int32_t id);
22 int32_t GetCameraId(const char *str, int length, int *id);
23 struct CameraDeviceDriver *GetDeviceDriver(const struct CameraDevice *cameraDev);
24 int32_t CheckPermission(int permissionId);
25 int32_t CheckCameraDevice(const char *deviceName, int type);
26 struct SensorDevice *GetSensorDevice(const char *kernelDrvName, struct CameraDeviceDriver *regDev);
27 struct IspDevice *GetIspDevice(const char *kernelDrvName, struct CameraDeviceDriver *regDev);
28 struct LensDevice *GetLensDevice(const char *kernelDrvName, struct CameraDeviceDriver *regDev);
29 struct FlashDevice *GetFlashDevice(const char *kernelDrvName, struct CameraDeviceDriver *regDev);
30 struct VcmDevice *GetVcmDevice(const char *kernelDrvName, struct CameraDeviceDriver *regDev);
31 struct UvcDevice *GetUvcDevice(const char *kernelDrvName, struct CameraDeviceDriver *regDev);
32 struct StreamDevice *GetStreamDevice(const char *kernelDrvName, struct CameraDeviceDriver *regDev);
33 int32_t GetDeviceNum(const char *driverName, int camId, int type);
34 int32_t GetStreamNum(const char *driverName, struct CameraDeviceDriver *deviceDriver);
35 int32_t GetUvcNum(const char *driverName, struct CameraDeviceDriver *deviceDriver);
36 int32_t CheckFrameRate(int camId, const char *driverName, int type, struct CameraCtrlConfig *ctrlConfig);
37 int32_t CameraGetDeviceInfo(int type, struct HdfSBuf *reqData,
38     const char **driverName, int32_t *camId, struct CameraDevice **camDev);
39 int32_t CameraGetStreamDevInfo(int type, struct HdfSBuf *reqData, struct CameraDevice **camDev);
40 int32_t CameraGetNames(int type, struct HdfSBuf *reqData, const char **deviceName, const char **driverName);
41 int32_t GetDeviceOps(struct CameraDeviceDriver *deviceDriver,
42     int type, int32_t camId, const char *driverName, struct DeviceOps **devOps);
43 int32_t CameraDeviceGetCtrlConfig(struct CommonDevice *comDev,
44     struct CameraDeviceConfig **deviceConfig, int32_t *deviceId);
45 int32_t CameraGetDevice(struct HdfSBuf *reqData, struct CommonDevice *comDev);
46 int32_t CameraDispatchCommonInfo(const struct HdfDeviceIoClient *client,
47     struct HdfSBuf *reqData, struct HdfSBuf *rspData, struct CommonDevice *comDev);
48 
49 #endif  // CAMERA_UTILS_H