1 /*
2  * Copyright (c) 2022 Chipsea Technologies (Shenzhen) Corp., 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 MODEL_SENSOR_DRIVER_PPG_SENSOR_PPG_DRIVER_H
10 #define MODEL_SENSOR_DRIVER_PPG_SENSOR_PPG_DRIVER_H
11 
12 #include "hdf_workqueue.h"
13 #include "osal_time.h"
14 #include "sensor_ppg_config.h"
15 
16 #define PPG_MODULE_VER 1
17 
18 struct PpgOpsCall {
19     int32_t (*Enable)(void);
20     int32_t (*Disable)(void);
21     int32_t (*ReadData)(uint8_t *outBuf, uint16_t outBufMaxLen, uint16_t *outLen);
22     int32_t (*SetOption)(uint32_t option);
23     int32_t (*SetMode)(uint32_t mode);
24 };
25 
26 struct PpgChipData {
27     struct PpgCfgData *cfgData;
28     struct PpgOpsCall opsCall;
29 };
30 
31 struct PpgDrvData {
32     struct IDeviceIoService ioService;
33     struct HdfDeviceObject *device;
34     HdfWorkQueue ppgWorkQueue;
35     HdfWork ppgWork;
36     bool detectFlag;
37     bool enable;
38     bool initStatus;
39     int64_t interval;
40     struct PpgChipData chipData;
41 };
42 
43 int32_t RegisterPpgChip(struct PpgChipData *chipData);
44 #endif  // MODEL_SENSOR_DRIVER_PPG_SENSOR_PPG_DRIVER_H
45