h3600_ts.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef __H3600_TS_H__
00039 #define __H3600_TS_H__
00040
00041 #include <linux/ioctl.h>
00042
00043 enum h3600_ts_minor_devices {
00044 TS_MINOR = 0,
00045 TSRAW_MINOR = 1,
00046 KEY_MINOR = 2
00047 };
00048
00049 typedef struct h3600_ts_calibration {
00050 int xscale;
00051 int xtrans;
00052 int yscale;
00053 int ytrans;
00054 int xyswap;
00055 } TS_CAL;
00056
00057 typedef struct h3600_ts_event {
00058 unsigned short pressure;
00059 unsigned short x;
00060 unsigned short y;
00061 unsigned short pad;
00062 } TS_EVENT;
00063
00064
00065 typedef struct h3600_ts_return {
00066 unsigned short pressure;
00067 unsigned short x;
00068 unsigned short y;
00069 unsigned short pad;
00070 } TS_RET;
00071
00072 enum power_button_mode {
00073 PBM_SUSPEND = 0,
00074 PBM_GENERATE_KEYPRESS = 1
00075 };
00076
00077
00078
00079
00080 typedef struct therm_dev {
00081 short data;
00082 } THERM_DEV;
00083
00084 #define H3600_BATT_CHEM_ALKALINE 0x01
00085 #define H3600_BATT_CHEM_NICD 0x02
00086 #define H3600_BATT_CHEM_NIMH 0x03
00087 #define H3600_BATT_CHEM_LION 0x04
00088 #define H3600_BATT_CHEM_LIPOLY 0x05
00089 #define H3600_BATT_CHEM_NOT_INSTALLED 0x06
00090 #define H3600_BATT_CHEM_UNKNOWN 0xff
00091
00092
00093 #define H3600_AC_STATUS_AC_OFFLINE 0x00
00094 #define H3600_AC_STATUS_AC_ONLINE 0x01
00095 #define H3600_AC_STATUS_AC_BACKUP 0x02
00096 #define H3600_AC_STATUS_AC_UNKNOWN 0xff
00097
00098
00099 #define H3600_BATT_STATUS_HIGH 0x01
00100 #define H3600_BATT_STATUS_LOW 0x02
00101 #define H3600_BATT_STATUS_CRITICAL 0x04
00102 #define H3600_BATT_STATUS_CHARGING 0x08
00103 #define H3600_BATT_STATUS_CHARGE_MAIN 0x10
00104 #define H3600_BATT_STATUS_DEAD 0x20
00105 #define H3600_BATT_NOT_INSTALLED 0x20
00106 #define H3600_BATT_STATUS_FULL 0x40
00107 #define H3600_BATT_STATUS_NOBATT 0x80
00108 #define H3600_BATT_STATUS_UNKNOWN 0xff
00109
00110 struct battery_data {
00111 unsigned char chemistry;
00112 unsigned char status;
00113 unsigned short voltage;
00114 unsigned short percentage;
00115 unsigned short life;
00116 };
00117
00118 struct h3600_battery {
00119 unsigned char ac_status;
00120 unsigned char battery_count;
00121 struct battery_data battery[2];
00122 };
00123
00124
00125
00126 #define EEPROM_RD_BUFSIZ 6
00127 #define EEPROM_WR_BUFSIZ 5
00128 #define SPI_RD_BUFSIZ 16
00129 #define SPI_WR_BUFSIZ 7
00130
00131
00132
00133
00134 typedef struct h3600_eeprom_read_request {
00135 unsigned char addr;
00136 unsigned char len;
00137 unsigned short buff[EEPROM_RD_BUFSIZ];
00138 } EEPROM_READ;
00139
00140 typedef struct h3600_eeprom_write_request {
00141 unsigned char len;
00142 unsigned char addr;
00143 unsigned short buff[EEPROM_WR_BUFSIZ];
00144 } EEPROM_WRITE;
00145
00146
00147
00148
00149 typedef struct h3600_spi_read_request {
00150 unsigned short addr;
00151 unsigned char len;
00152 unsigned char buff[SPI_RD_BUFSIZ];
00153 } SPI_READ;
00154
00155 #define SPI_READ_STATUS_BYTE 0xffff
00156
00157 typedef struct h3600_spi_write_request {
00158 unsigned short len;
00159 unsigned short addr;
00160 unsigned char buff[SPI_WR_BUFSIZ];
00161 } SPI_WRITE;
00162
00163
00164
00165
00166
00167
00168 typedef struct h3600_ts_version {
00169 unsigned char host_version[8];
00170 unsigned char pack_version[8];
00171 unsigned char boot_type;
00172 } VER_RET;
00173
00174 typedef struct h3600_ts_led {
00175 unsigned char OffOnBlink;
00176 unsigned char TotalTime;
00177 unsigned char OnTime;
00178 unsigned char OffTime;
00179 } LED_IN;
00180
00181 enum flite_mode {
00182 FLITE_MODE1 = 1,
00183 FLITE_AUTO_MODE = 1,
00184 FLITE_MANUAL_MODE = 2,
00185 FLITE_GET_LIGHT_SENSOR = 3
00186 };
00187 enum flite_pwr {
00188 FLITE_PWR_OFF = 0,
00189 FLITE_PWR_ON = 1
00190 };
00191
00192 typedef struct h3600_ts_flite {
00193 unsigned char mode;
00194 unsigned char pwr;
00195 unsigned char brightness;
00196 } FLITE_IN;
00197
00198
00199
00200
00201 struct h3600_ts_backlight {
00202 enum flite_pwr power;
00203 unsigned char brightness;
00204 };
00205
00206 struct h3600_ts_contrast {
00207 unsigned char contrast;
00208 };
00209
00210
00211
00212
00213 #define IOC_H3600_TS_MAGIC 'f'
00214
00215
00216 #define GET_VERSION _IOR(IOC_H3600_TS_MAGIC, 1, struct h3600_ts_version )
00217 #define READ_EEPROM _IOWR(IOC_H3600_TS_MAGIC, 2, struct h3600_eeprom_read_request)
00218 #define WRITE_EEPROM _IOWR(IOC_H3600_TS_MAGIC, 3, struct h3600_eeprom_write_request)
00219 #define GET_THERMAL _IOR(IOC_H3600_TS_MAGIC, 4, struct therm_dev)
00220 #define LED_ON _IOW(IOC_H3600_TS_MAGIC, 5, struct h3600_ts_led)
00221 #define GET_BATTERY_STATUS _IOR(IOC_H3600_TS_MAGIC, 6, struct h3600_battery)
00222 #define FLITE_ON _IOW(IOC_H3600_TS_MAGIC, 7, struct h3600_ts_flite)
00223 #define READ_SPI _IOWR(IOC_H3600_TS_MAGIC, 8, struct h3600_spi_read_request)
00224 #define WRITE_SPI _IOWR(IOC_H3600_TS_MAGIC, 9, struct h3600_spi_write_request)
00225 #define TS_GET_CAL _IOR(IOC_H3600_TS_MAGIC, 10, struct h3600_ts_calibration)
00226 #define TS_SET_CAL _IOW(IOC_H3600_TS_MAGIC, 11, struct h3600_ts_calibration)
00227
00228
00229 #define TS_GET_BACKLIGHT _IOR(IOC_H3600_TS_MAGIC, 20, struct h3600_ts_backlight)
00230 #define TS_SET_BACKLIGHT _IOW(IOC_H3600_TS_MAGIC, 20, struct h3600_ts_backlight)
00231 #define TS_GET_CONTRAST _IOR(IOC_H3600_TS_MAGIC, 21, struct h3600_ts_contrast)
00232 #define TS_SET_CONTRAST _IOW(IOC_H3600_TS_MAGIC, 21, struct h3600_ts_contrast)
00233
00234 #endif