1 /*
2  * Copyright (c) 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 #ifndef SENSOR_HALL_DRIVER_H
10 #define SENSOR_HALL_DRIVER_H
11 
12 #include "hdf_workqueue.h"
13 #include "sensor_config_parser.h"
14 #include "sensor_platform_if.h"
15 
16 #define HALL_CHIP_NAME_AK8789    "ak8789"
17 
18 struct HallOpsCall {
19     int32_t (*Init)(struct SensorCfgData *data);
20     int32_t (*ReadData)(struct SensorCfgData *data);
21 };
22 
23 struct HallDrvData {
24     struct IDeviceIoService ioService;
25     struct HdfDeviceObject *device;
26     HdfWorkQueue hallWorkQueue;
27     HdfWork hallWork;
28     bool detectFlag;
29     bool enable;
30     int64_t interval;
31     struct SensorCfgData *hallCfg;
32     struct HallOpsCall ops;
33     uint16_t status;
34     uint32_t delayTime;
35 };
36 
37 int32_t HallRegisterChipOps(const struct HallOpsCall *ops);
38 struct SensorCfgData *HallCreateCfgData(const struct DeviceResourceNode *node);
39 void HallReleaseCfgData(struct SensorCfgData *hallCfg);
40 
41 #endif /* SENSOR_HALL_DRIVER_H */