1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
/*
* Copyright (C) 2010-2012 Motorola, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307, USA
*/
#ifndef __MSP430_H__
#define __MSP430_H__
/** The following define the IOCTL command values via the ioctl macros */
#define MSP430_IOCTL_BASE 77
#define MSP430_IOCTL_BOOTLOADERMODE \
_IOW(MSP430_IOCTL_BASE, 0, unsigned char)
#define MSP430_IOCTL_NORMALMODE \
_IOW(MSP430_IOCTL_BASE, 1, unsigned char)
#define MSP430_IOCTL_MASSERASE \
_IOW(MSP430_IOCTL_BASE, 2, unsigned char)
#define MSP430_IOCTL_SETSTARTADDR \
_IOW(MSP430_IOCTL_BASE, 3, unsigned int)
#define MSP430_IOCTL_TEST_READ \
_IOR(MSP430_IOCTL_BASE, 4, unsigned char)
#define MSP430_IOCTL_TEST_WRITE \
_IOW(MSP430_IOCTL_BASE, 5, unsigned char)
#define MSP430_IOCTL_TEST_WRITE_READ \
_IOWR(MSP430_IOCTL_BASE, 6, unsigned short)
#define MSP430_IOCTL_SET_MAG_DELAY \
_IOW(MSP430_IOCTL_BASE, 7, unsigned short)
#define MSP430_IOCTL_TEST_BOOTMODE \
_IOW(MSP430_IOCTL_BASE, 8, unsigned char)
#define MSP430_IOCTL_SET_ACC_DELAY \
_IOW(MSP430_IOCTL_BASE, 9, unsigned short)
#define MSP430_IOCTL_SET_MOTION_DELAY \
_IOW(MSP430_IOCTL_BASE, 10, unsigned char)
#define MSP430_IOCTL_SET_GYRO_DELAY \
_IOW(MSP430_IOCTL_BASE, 11, unsigned short)
#define MSP430_IOCTL_SET_DEBUG \
_IOW(MSP430_IOCTL_BASE, 12, unsigned char)
#define MSP430_IOCTL_SET_USER_PROFILE \
_IOW(MSP430_IOCTL_BASE, 13, int)
#define MSP430_IOCTL_SET_GPS_DATA \
_IOW(MSP430_IOCTL_BASE, 14, int)
#define MSP430_IOCTL_SET_PRES_DELAY \
_IOW(MSP430_IOCTL_BASE, 15, unsigned short)
#define MSP430_IOCTL_SET_REF_ALTITUDE \
_IOW(MSP430_IOCTL_BASE, 16, int)
#define MSP430_IOCTL_SET_ACTIVE_MODE \
_IOW(MSP430_IOCTL_BASE, 17, unsigned char)
#define MSP430_IOCTL_SET_PASSIVE_MODE \
_IOW(MSP430_IOCTL_BASE, 18, unsigned char)
#define MSP430_IOCTL_SET_FACTORY_MODE \
_IOW(MSP430_IOCTL_BASE, 19, unsigned char)
#define MSP430_IOCTL_GET_SENSORS \
_IOR(MSP430_IOCTL_BASE, 20, unsigned char)
#define MSP430_IOCTL_SET_SENSORS \
_IOW(MSP430_IOCTL_BASE, 21, unsigned char)
#define MSP430_IOCTL_GET_VERSION \
_IOR(MSP430_IOCTL_BASE, 22, unsigned char)
#define MSP430_IOCTL_SET_MONITOR_DELAY \
_IOW(MSP430_IOCTL_BASE, 23, unsigned char)
#define MSP430_IOCTL_GET_DOCK_STATUS \
_IOR(MSP430_IOCTL_BASE, 24, unsigned char)
#define MSP430_IOCTL_SET_ORIENTATION_DELAY \
_IOW(MSP430_IOCTL_BASE, 25, unsigned char)
#define MSP430_IOCTL_SET_EQUIPMENT_TYPE \
_IOW(MSP430_IOCTL_BASE, 26, unsigned char)
#define MSP430_IOCTL_SET_POWER_MODE \
_IOW(MSP430_IOCTL_BASE, 27, unsigned char)
#define MSP430_IOCTL_GET_ALGOS \
_IOR(MSP430_IOCTL_BASE, 28, char*)
#define MSP430_IOCTL_SET_ALGOS \
_IOW(MSP430_IOCTL_BASE, 29, char*)
#define MSP430_IOCTL_GET_MAG_CAL \
_IOR(MSP430_IOCTL_BASE, 30, unsigned char*)
#define MSP430_IOCTL_SET_MAG_CAL \
_IOW(MSP430_IOCTL_BASE, 31, unsigned char*)
/* 32 unused */
#define MSP430_IOCTL_SET_MOTION_DUR \
_IOW(MSP430_IOCTL_BASE, 33, unsigned int)
/* 34 unused */
#define MSP430_IOCTL_SET_ZRMOTION_DUR \
_IOW(MSP430_IOCTL_BASE, 35, unsigned int)
#define MSP430_IOCTL_GET_WAKESENSORS \
_IOR(MSP430_IOCTL_BASE, 36, unsigned char)
#define MSP430_IOCTL_SET_WAKESENSORS \
_IOW(MSP430_IOCTL_BASE, 37, unsigned char)
#define MSP430_IOCTL_GET_VERNAME \
_IOW(MSP430_IOCTL_BASE, 38, char*)
#define MSP430_IOCTL_SET_POSIX_TIME \
_IOW(MSP430_IOCTL_BASE, 39, unsigned long)
#define MSP430_IOCTL_SET_CONTROL_REG \
_IOW(MSP430_IOCTL_BASE, 40, char*)
#define MSP430_IOCTL_GET_STATUS_REG \
_IOR(MSP430_IOCTL_BASE, 41, char*)
#define MSP430_IOCTL_GET_TOUCH_REG \
_IOR(MSP430_IOCTL_BASE, 42, char*)
#define MSP430_IOCTL_SET_ALGO_REQ \
_IOR(MSP430_IOCTL_BASE, 43, char*)
#define MSP430_IOCTL_GET_ALGO_EVT \
_IOR(MSP430_IOCTL_BASE, 44, char*)
#define MSP430_IOCTL_GET_AOD_INSTRUMENTATION_REG \
_IOR(MSP430_IOCTL_BASE, 45, char*)
#define MSP430_IOCTL_WRITE_REG \
_IOR(MSP430_IOCTL_BASE, 46, char*)
#define MSP430_IOCTL_READ_REG \
_IOR(MSP430_IOCTL_BASE, 47, char*)
#define MSP430_IOCTL_SET_STEP_COUNTER_DELAY \
_IOW(MSP430_IOCTL_BASE, 48, unsigned short)
#define MSP430_IOCTL_ENABLE_BREATHING \
_IOW(MSP430_IOCTL_BASE, 49, unsigned char)
#define FW_VERSION_SIZE 12
#define MSP_CONTROL_REG_SIZE 200
#define MSP_STATUS_REG_SIZE 8
#define MSP_TOUCH_REG_SIZE 8
#define MSP_MAG_CAL_SIZE 26
#define MSP_AOD_INSTRUMENTATION_REG_SIZE 256
#ifdef __KERNEL__
#define LIGHTING_TABLE_SIZE 32
struct msp430_platform_data {
int (*init)(void);
void (*exit)(void);
int (*power_on)(void);
int (*power_off)(void);
int gpio_reset;
int gpio_bslen;
int gpio_wakeirq;
int gpio_int;
int gpio_mipi_req;
int gpio_mipi_busy;
unsigned int bslen_pin_active_value;
u16 lux_table[LIGHTING_TABLE_SIZE];
u8 brightness_table[LIGHTING_TABLE_SIZE];
char fw_version[FW_VERSION_SIZE];
int ct406_detect_threshold;
int ct406_undetect_threshold;
int ct406_recalibrate_threshold;
int ct406_pulse_count;
};
#endif /* __KERNEL__ */
/* Mask values */
/* Non wakable sensors */
#define M_ACCEL 0x0001
#define M_GYRO 0x0002
#define M_PRESSURE 0x0004
#define M_ECOMPASS 0x0008
#define M_TEMPERATURE 0x0010
#define M_ALS 0x0020
#define M_LIN_ACCEL 0x0100
#define M_QUATERNION 0x0200
#define M_GRAVITY 0x0400
#define M_DISP_ROTATE 0x0800
#define M_DISP_BRIGHTNESS 0x1000
#define M_STEP_DETECTOR 0x2000
#define M_STEP_COUNTER 0x4000
/* wake sensor status */
#define M_DOCK 0x0001
#define M_PROXIMITY 0x0002
#define M_TOUCH 0x0004
#define M_QUICKPEEK 0x0010
#define M_HUB_RESET 0x0080
#define M_FLATUP 0x0100
#define M_FLATDOWN 0x0200
#define M_STOWED 0x0400
#define M_CAMERA_ACT 0x0800
#define M_NFC 0x1000
#define M_SIM 0x2000
#define M_LOG_MSG 0x8000
/* algo config mask */
#define M_MMOVEME 0x0001
#define M_NOMMOVE 0x0002
#define M_ALGO_MODALITY 0x0008
#define M_ALGO_ORIENTATION 0x0010
#define M_ALGO_STOWED 0x0020
#define M_ALGO_ACCUM_MODALITY 0x0040
#define M_ALGO_ACCUM_MVMT 0x0080
/* generic interrupt mask */
#define M_GENERIC_INTRPT 0x0080
/* algo index */
#define MSP_IDX_MODALITY 0
#define MSP_IDX_ORIENTATION 1
#define MSP_IDX_STOWED 2
#define MSP_IDX_ACCUM_MODALITY 3
#define MSP_IDX_ACCUM_MVMT 4
#define MSP_NUM_ALGOS 5
#define MSP_EVT_SZ_TRANSITION 7
#define MSP_EVT_SZ_ACCUM_STATE 2
#define MSP_EVT_SZ_ACCUM_MVMT 4
struct msp430_android_sensor_data {
int64_t timestamp;
signed short data1;
signed short data2;
signed short data3;
signed short data4;
signed short data5;
signed short data6;
unsigned char type;
unsigned char status;
};
struct msp430_moto_sensor_data {
int64_t timestamp;
signed short data1;
signed short data2;
signed short data3;
signed short data4;
unsigned char type;
};
enum MSP430_data_types {
DT_ACCEL,
DT_GYRO,
DT_PRESSURE,
DT_MAG,
DT_ORIENT,
DT_TEMP,
DT_ALS,
DT_LIN_ACCEL,
DT_QUATERNION,
DT_GRAVITY,
DT_DISP_ROTATE,
DT_DISP_BRIGHT,
DT_DOCK,
DT_PROX,
DT_FLAT_UP,
DT_FLAT_DOWN,
DT_STOWED,
DT_MMMOVE,
DT_NOMOVE,
DT_CAMERA_ACT,
DT_NFC,
DT_ALGO_EVT,
DT_ACCUM_MVMT,
DT_SIM,
DT_RESET,
DT_GENERIC_INT,
DT_STEP_COUNTER,
DT_STEP_DETECTOR
};
enum {
NO_DOCK,
DESK_DOCK,
CAR_DOCK
};
#ifdef __KERNEL__
#define QUICKDRAW_ESD_RECOVERED -1337
struct msp430_quickdraw_ops {
int (*prepare)(void *data, unsigned char panel_state);
int (*execute)(void *data, int buffer_id, int x, int y);
int (*erase)(void *data, int x1, int y1, int x2, int y2);
int (*cleanup)(void *data);
void *data; /* arbitrary data passed back to user */
};
void msp430_register_quickdraw(struct msp430_quickdraw_ops *handler);
void msp430_unregister_quickdraw(struct msp430_quickdraw_ops *handler);
#endif
#endif /* __MSP430_H__ */
|