1 /* 2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __HI_ADC_H__ 20 #define __HI_ADC_H__ 21 22 #include <linux/types.h> 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif /* __cplusplus */ 27 28 #define hi_adc_unused(x) (void)(x) 29 30 int lsadc_init(void); 31 void lsadc_exit(void); 32 33 #define LSADC_IOCTL_BASE 'A' 34 35 #define LSADC_CLOCK_REG_LENGTH 0x4 36 #define LSADC_REG_LENGTH 0x100 37 38 typedef enum hiIOC_NR_LSADC_E { 39 IOC_NR_LSADC_MODEL_SEL = 0, 40 IOC_NR_LSADC_CHN_ENABLE, 41 IOC_NR_LSADC_CHN_DISABLE, 42 IOC_NR_LSADC_START, 43 IOC_NR_LSADC_STOP, 44 IOC_NR_LSADC_GET_CHNVAL, 45 IOC_NR_LSADC_BUTT 46 } IOC_NR_LSADC_E; 47 48 #define LSADC_IOC_MODEL_SEL _IOWR(LSADC_IOCTL_BASE, IOC_NR_LSADC_MODEL_SEL, int) 49 #define LSADC_IOC_CHN_ENABLE _IOW(LSADC_IOCTL_BASE, IOC_NR_LSADC_CHN_ENABLE, int) 50 #define LSADC_IOC_CHN_DISABLE _IOW(LSADC_IOCTL_BASE, IOC_NR_LSADC_CHN_DISABLE, int) 51 #define LSADC_IOC_START _IO(LSADC_IOCTL_BASE, IOC_NR_LSADC_START) 52 #define LSADC_IOC_STOP _IO(LSADC_IOCTL_BASE, IOC_NR_LSADC_STOP) 53 #define LSADC_IOC_GET_CHNVAL _IOWR(LSADC_IOCTL_BASE, IOC_NR_LSADC_GET_CHNVAL, int) 54 55 #ifdef __cplusplus 56 } 57 #endif /* __cplusplus */ 58 59 #endif /* __HI_ADC_H__ */ 60