blob: 51c967f04a554dc1449198a6e315b0427be5456a [file] [log] [blame]
Hongwei Zhangcb66a9e2019-06-05 16:37:19 -04001/*****************************************************************
2 *
3 * adcapp.c
4 * application specific driver header.
5 *
6 * Author: Rama Rao Bisa <ramab@ami.com>
7 *
8 * Copyright (C) <2019> <American Megatrends International LLC>
9 *
10 *****************************************************************/
11
12#ifndef __ADC_H__
13#define __ADC_H__
14
15#define READ_ADC_CHANNEL _IOC(_IOC_WRITE,'K',0x100,0x3FFF)
16#define READ_ADC_REF_VOLATGE _IOC(_IOC_WRITE,'K',0x101,0x3FFF)
17#define READ_ADC_RESOLUTION _IOC(_IOC_WRITE,'K',0x102,0x3FFF)
18#define ENABLE_EXT_REF_VOLTAGE _IOC(_IOC_WRITE,'K',0x103,0x3FFF)
19#define DISABLE_EXT_REF_VOLTAGE _IOC(_IOC_WRITE,'K',0x104,0x3FFF)
20#define ENABLE_ADC_CHANNEL _IOC(_IOC_WRITE,'K',0x105,0x3FFF)
21#define DISABLE_ADC_CHANNEL _IOC(_IOC_WRITE,'K',0x106,0x3FFF)
22
23#define PACKED __attribute__ ((packed))
24
25typedef struct
26{
27 uint8_t channel_num;
28 uint16_t channel_value;
29
30} PACKED get_adc_value_t;
31#if 0
32typedef struct
33{
34 int (*adc_read_channel) (uint16_t *adc_value, int channel);
35 int (*adc_get_resolution) (uint16_t *adc_resolution);
36 int (*adc_get_reference_voltage) (uint16_t *adc_ref_volatge);
37 int (*adc_reboot_notifier) (void);
38}adc_hal_operations_t;
39
40typedef struct
41{
42} adc_core_funcs_t;
43
44
45struct adc_hal
46{
47 adc_hal_operations_t *padc_hal_ops;
48};
49
50struct adc_dev
51{
52 struct adc_hal *padc_hal;
53};
54#endif
55
56#endif /* !__ADC_H__ */