?? ads8344_driver.h
字號:
/*---------------------------------------------------------------------------- * * nsyadc.h - AD Converter header file. * * Author: Jesse Jiang <jiangxiaogen@sina.com> * Copyright (C) 2007~2008 * * Updates history: * ----------------------------------------------------------- * 2007-07-21 Jesse Jiang v1.0 initial * 2007-12-03 Jesse Jiang fix the bug on queue management * * * Hardware: MCU: Samsung S3C44B0X * AD Converter: Burr-Brown ADS8344 * * OS: uClinux version 2.4.20 * * * *----------------------------------------------------------------------------*/#ifndef __NSY_ADC_H_#define __NSY_ADC_H_#ifdef __KERNEL__#include <linux/time.h> /* for timeval struct */#include <linux/ioctl.h> /* for the _IOR macro to define the ioctl commands */#endif/*----------------------------------------------------------------------------*//* Used to check the driver vs. userland program. * * If they have the same number, it means that 'struct ts_pen_info' and * 'struct adc_drv_params' have compatible semantics on both side. Otherwise * one side is outdated. * * The number has to be incremented if and only if updates in the driver lead * to any change in the semantics of these interface data structures (and not * if some internal mechanism of the driver are changed). *//* Userland programs can get this version number in params.version after * ioctl(fd, TS_PARAMS_GET, ¶ms). Userland programs must specify their * version compatibility by setting version_req to S3C44B0TS_VERSION before * doing ioctl(fd, TS_PARAMS_SET, ¶ms). * * If version_req does not match, ioctl(fd, TS_PARAMS_SET, ¶ms) would return * EBADRQC ('Invalid request code'). * * Note: * it is not possible to check the compatibility for 'struct ts_pen_info' * without doing an ioctl(fd, TS_PARAMS_SET, ¶ms). So, please, do an * ioctl(fd, TS_PARAMS_SET, ¶ms)! *//*----------------------------------------------------------------------------*//* Definition for the ioctl of the driver *//* Device is type misc then major=10 */#define NSY_ADC_MAJOR (10)#define ADC_VERSION (100)#define ADC_PARAMS_GET _IOR(NSY_ADC_MAJOR, 0, struct adc_drv_params)#define ADC_PARAMS_SET _IOR(NSY_ADC_MAJOR, 1, struct adc_drv_params) enum Sensor_Type { SNR_TYPE_DIGITAL = 0, SNR_TYPE_ANALOG, SNR_TYPE_UNKNOWN};enum Sensor_Mode { SNR_MODE_COUNT = 0, SNR_MODE_DUR, SNR_MODE_UNKNOWN};enum Sensor_Operation { SNR_OPER_NORMAL = 0, SNR_OPER_LOCK, SNR_OPER_UNKNOWN};#define SNR_IS_ON (0x01)#define SNR_IS_OFF (0x00)#define SNR_ID_UNKNOWN (0xff)#define SNR_VAL_INVALID (0xffff)/*----------------------------------------------------------------------------*//* Available info from pen position and status */struct adc_conv_info { char snr_channel; /* channel ID */ char snr_type; /* sensor type */ unsigned short snr_value; /* A/D conversion result */ struct timeval ad_timeval; /* time for A/D logging */ };/* Structure that define touch screen parameters */typedef struct adc_cha_param{ char snr_online; /* to indicate whether a sensor is * * online or offline * */ char snr_type; /* sensor type: dialog or digital */ char snr_mode; /* only for digital sensor * * SNR_MODE_COUNT : the count of pulse * * SNR_MODE_DUR : duration of a pulse * * SNR_MODE_INVALID: invalid mode * */ char snr_id; /* the sensor identification */ char snr_oper; /* operation status * * SNR_OPER_NORMAL : normal * * SNR_OPER_LOCK :out of operation* */} T_SNR_PARAM; struct adc_drv_params { int version_req; /* version number for check, returned by ADC_PARAMS_GET */ int sample_ms; /* time interval between sampling (ms) */ int deglitch_on; /* switch on or off deglitch functions */ int event_queue_on; /* switch on and off the event queue */ T_SNR_PARAM cha[6]; /* the struct parameter for the channel */};/* The item length in buffer queue */#define SNR_DATITEM_LEN sizeof(struct adc_conv_info)#endif /* __NSY_ADC_H_ */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -