• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 DAC_CORE_H
10 #define DAC_CORE_H
11 
12 #include "osal_spinlock.h"
13 #include "hdf_base.h"
14 #include "dac_if.h"
15 #include "platform_core.h"
16 
17 #ifdef __cplusplus
18 #if __cplusplus
19 extern "C" {
20 #endif
21 #endif /* __cplusplus */
22 
23 #define DAC_DEVICES_MAX 15
24 
25 struct DacDevice;
26 struct DacMethod;
27 struct DacLockMethod;
28 
29 struct DacDevice {
30     const struct DacMethod *ops;
31     OsalSpinlock spin;
32     uint32_t devNum;
33     uint32_t chanNum;
34     const struct DacLockMethod *lockOps;
35     void *priv;
36 };
37 
38 struct DacMethod {
39     int32_t (*write)(struct DacDevice *device, uint32_t channel, uint32_t val);
40     int32_t (*start)(struct DacDevice *device);
41     int32_t (*stop)(struct DacDevice *device);
42 };
43 
44 struct DacLockMethod {
45     int32_t (*lock)(struct DacDevice *device);
46     void (*unlock)(struct DacDevice *device);
47 };
48 
49 int32_t DacDeviceAdd(struct DacDevice *device);
50 
51 void DacDeviceRemove(struct DacDevice *device);
52 
53 struct DacDevice *DacDeviceGet(uint32_t number);
54 
55 void DacDevicePut(const struct DacDevice *device);
56 
57 int32_t DacDeviceWrite(struct DacDevice *device, uint32_t channel, uint32_t val);
58 
59 int32_t DacDeviceStart(struct DacDevice *device);
60 
61 int32_t DacDeviceStop(struct DacDevice *device);
62 
63 #ifdef __cplusplus
64 #if __cplusplus
65 }
66 #endif
67 #endif /* __cplusplus */
68 
69 #endif /* DAC_CORE_H */
70