1/*
2 $License:
3   Copyright 2011 InvenSense, Inc.
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16  $
17 */
18#ifndef DMPKEY_H__
19#define DMPKEY_H__
20
21#define KEY_CFG_25  0
22#define KEY_CFG_24                 (KEY_CFG_25+1)
23#define KEY_CFG_26                 (KEY_CFG_24+1)
24#define KEY_CFG_21                 (KEY_CFG_26+1)
25#define KEY_CFG_20                 (KEY_CFG_21+1)
26#define KEY_CFG_TAP4               (KEY_CFG_20+1)
27#define KEY_CFG_TAP5               (KEY_CFG_TAP4+1)
28#define KEY_CFG_TAP6               (KEY_CFG_TAP5+1)
29#define KEY_CFG_TAP7               (KEY_CFG_TAP6+1)
30#define KEY_CFG_TAP0               (KEY_CFG_TAP7+1)
31#define KEY_CFG_TAP1               (KEY_CFG_TAP0+1)
32#define KEY_CFG_TAP2               (KEY_CFG_TAP1+1)
33#define KEY_CFG_TAP3               (KEY_CFG_TAP2+1)
34#define KEY_CFG_TAP_QUANTIZE       (KEY_CFG_TAP3+1)
35#define KEY_CFG_TAP_JERK           (KEY_CFG_TAP_QUANTIZE+1)
36#define KEY_CFG_TAP_SAVE_ACCB      (KEY_CFG_TAP_JERK+1)
37#define KEY_CFG_TAP_CLEAR_STICKY   (KEY_CFG_TAP_SAVE_ACCB+1)
38#define KEY_FCFG_ACCEL_INPUT       (KEY_CFG_TAP_CLEAR_STICKY +1)
39#define KEY_FCFG_ACCEL_INIT        (KEY_FCFG_ACCEL_INPUT+1)
40#define KEY_CFG_23                 (KEY_FCFG_ACCEL_INIT+1)
41#define KEY_FCFG_1                 (KEY_CFG_23+1)
42#define KEY_FCFG_3                 (KEY_FCFG_1+1)
43#define KEY_FCFG_2                 (KEY_FCFG_3+1)
44#define KEY_CFG_3D                 (KEY_FCFG_2+1)
45#define KEY_CFG_3B                 (KEY_CFG_3D+1)
46#define KEY_CFG_3C                 (KEY_CFG_3B+1)
47#define KEY_FCFG_5                 (KEY_CFG_3C+1)
48#define KEY_FCFG_4                 (KEY_FCFG_5+1)
49#define KEY_FCFG_7                 (KEY_FCFG_4+1)
50#define KEY_FCFG_FSCALE            (KEY_FCFG_7+1)
51#define KEY_FCFG_AZ                (KEY_FCFG_FSCALE+1)
52#define KEY_FCFG_6                 (KEY_FCFG_AZ+1)
53#define KEY_FCFG_LSB4              (KEY_FCFG_6+1)
54#define KEY_CFG_12                 (KEY_FCFG_LSB4+1)
55#define KEY_CFG_14                 (KEY_CFG_12+1)
56#define KEY_CFG_15                 (KEY_CFG_14+1)
57#define KEY_CFG_16                 (KEY_CFG_15+1)
58#define KEY_CFG_18                 (KEY_CFG_16+1)
59#define KEY_CFG_6                  (KEY_CFG_18 + 1)
60#define KEY_CFG_7                  (KEY_CFG_6+1)
61#define KEY_CFG_4                  (KEY_CFG_7+1)
62#define KEY_CFG_5                  (KEY_CFG_4+1)
63#define KEY_CFG_2                  (KEY_CFG_5+1)
64#define KEY_CFG_3                  (KEY_CFG_2+1)
65#define KEY_CFG_1                  (KEY_CFG_3+1)
66#define KEY_CFG_EXTERNAL           (KEY_CFG_1+1)
67#define KEY_CFG_8                  (KEY_CFG_EXTERNAL+1)
68#define KEY_CFG_9                  (KEY_CFG_8+1)
69#define KEY_CFG_ORIENT_3           (KEY_CFG_9 + 1)
70#define KEY_CFG_ORIENT_2           (KEY_CFG_ORIENT_3 + 1)
71#define KEY_CFG_ORIENT_1           (KEY_CFG_ORIENT_2 + 1)
72#define KEY_CFG_GYRO_SOURCE        (KEY_CFG_ORIENT_1 + 1)
73#define KEY_CFG_ORIENT_IRQ_1       (KEY_CFG_GYRO_SOURCE + 1)
74#define KEY_CFG_ORIENT_IRQ_2       (KEY_CFG_ORIENT_IRQ_1 + 1)
75#define KEY_CFG_ORIENT_IRQ_3       (KEY_CFG_ORIENT_IRQ_2 + 1)
76#define KEY_FCFG_MAG_VAL           (KEY_CFG_ORIENT_IRQ_3 + 1)
77#define KEY_FCFG_MAG_MOV           (KEY_FCFG_MAG_VAL + 1)
78
79#define KEY_D_0_22                 (KEY_FCFG_MAG_MOV + 1)
80#define KEY_D_0_24                 (KEY_D_0_22+1)
81#define KEY_D_0_36                 (KEY_D_0_24+1)
82#define KEY_D_0_52                 (KEY_D_0_36+1)
83#define KEY_D_0_96                 (KEY_D_0_52+1)
84#define KEY_D_0_104                (KEY_D_0_96+1)
85#define KEY_D_0_108                (KEY_D_0_104+1)
86#define KEY_D_0_163                (KEY_D_0_108+1)
87#define KEY_D_0_188                (KEY_D_0_163+1)
88#define KEY_D_0_192                (KEY_D_0_188+1)
89#define KEY_D_0_224                (KEY_D_0_192+1)
90#define KEY_D_0_228                (KEY_D_0_224+1)
91#define KEY_D_0_232                (KEY_D_0_228+1)
92#define KEY_D_0_236                (KEY_D_0_232+1)
93
94#define KEY_DMP_PREVPTAT           (KEY_D_0_236+1)
95#define KEY_D_1_2                  (KEY_DMP_PREVPTAT+1)
96#define KEY_D_1_4                  (KEY_D_1_2 + 1)
97#define KEY_D_1_8                  (KEY_D_1_4 + 1)
98#define KEY_D_1_10                 (KEY_D_1_8+1)
99#define KEY_D_1_24                 (KEY_D_1_10+1)
100#define KEY_D_1_28                 (KEY_D_1_24+1)
101#define KEY_D_1_92                 (KEY_D_1_28+1)
102#define KEY_D_1_96                 (KEY_D_1_92+1)
103#define KEY_D_1_98                 (KEY_D_1_96+1)
104#define KEY_D_1_106                (KEY_D_1_98+1)
105#define KEY_D_1_108                (KEY_D_1_106+1)
106#define KEY_D_1_112                (KEY_D_1_108+1)
107#define KEY_D_1_128                (KEY_D_1_112+1)
108#define KEY_D_1_152                (KEY_D_1_128+1)
109#define KEY_D_1_168                (KEY_D_1_152+1)
110#define KEY_D_1_175                (KEY_D_1_168+1)
111#define KEY_D_1_178                (KEY_D_1_175+1)
112#define KEY_D_1_179                (KEY_D_1_178+1)
113#define KEY_D_1_236                (KEY_D_1_179+1)
114#define KEY_D_1_244                (KEY_D_1_236+1)
115#define KEY_D_2_12                 (KEY_D_1_244+1)
116#define KEY_D_2_96                 (KEY_D_2_12+1)
117#define KEY_D_2_108                (KEY_D_2_96+1)
118#define KEY_D_2_244                (KEY_D_2_108+1)
119#define KEY_D_2_248                (KEY_D_2_244+1)
120#define KEY_D_2_252                (KEY_D_2_248+1)
121
122// Compass Keys
123#define KEY_CPASS_BIAS_X            (KEY_D_2_252+1)
124#define KEY_CPASS_BIAS_Y            (KEY_CPASS_BIAS_X+1)
125#define KEY_CPASS_BIAS_Z            (KEY_CPASS_BIAS_Y+1)
126#define KEY_CPASS_MTX_00            (KEY_CPASS_BIAS_Z+1)
127#define KEY_CPASS_MTX_01            (KEY_CPASS_MTX_00+1)
128#define KEY_CPASS_MTX_02            (KEY_CPASS_MTX_01+1)
129#define KEY_CPASS_MTX_10            (KEY_CPASS_MTX_02+1)
130#define KEY_CPASS_MTX_11            (KEY_CPASS_MTX_10+1)
131#define KEY_CPASS_MTX_12            (KEY_CPASS_MTX_11+1)
132#define KEY_CPASS_MTX_20            (KEY_CPASS_MTX_12+1)
133#define KEY_CPASS_MTX_21            (KEY_CPASS_MTX_20+1)
134#define KEY_CPASS_MTX_22            (KEY_CPASS_MTX_21+1)
135
136// Mantis Keys
137#define KEY_CFG_MOTION_BIAS         (KEY_CPASS_MTX_22+1)
138
139#define KEY_DMP_TAPW_MIN           (KEY_CFG_MOTION_BIAS+1)
140#define KEY_DMP_TAP_THR_X          (KEY_DMP_TAPW_MIN+1)
141#define KEY_DMP_TAP_THR_Y          (KEY_DMP_TAP_THR_X+1)
142#define KEY_DMP_TAP_THR_Z          (KEY_DMP_TAP_THR_Y+1)
143#define KEY_DMP_SH_TH_Y            (KEY_DMP_TAP_THR_Z+1)
144#define KEY_DMP_SH_TH_X            (KEY_DMP_SH_TH_Y+1)
145#define KEY_DMP_SH_TH_Z            (KEY_DMP_SH_TH_X+1)
146#define KEY_DMP_ORIENT             (KEY_DMP_SH_TH_Z+1)
147#define KEY_D_ACT0                 (KEY_DMP_ORIENT+1)
148#define KEY_D_ACSX                 (KEY_D_ACT0+1)
149#define KEY_D_ACSY                 (KEY_D_ACSX+1)
150#define KEY_D_ACSZ                 (KEY_D_ACSY+1)
151
152// Pedometer Standalone only keys
153#define KEY_D_PEDSTD_BP_B          (KEY_D_ACSZ+1)
154#define KEY_D_PEDSTD_HP_A          (KEY_D_PEDSTD_BP_B+1)
155#define KEY_D_PEDSTD_HP_B          (KEY_D_PEDSTD_HP_A+1)
156#define KEY_D_PEDSTD_BP_A4         (KEY_D_PEDSTD_HP_B+1)
157#define KEY_D_PEDSTD_BP_A3         (KEY_D_PEDSTD_BP_A4+1)
158#define KEY_D_PEDSTD_BP_A2         (KEY_D_PEDSTD_BP_A3+1)
159#define KEY_D_PEDSTD_BP_A1         (KEY_D_PEDSTD_BP_A2+1)
160#define KEY_D_PEDSTD_INT_THRSH     (KEY_D_PEDSTD_BP_A1+1)
161#define KEY_D_PEDSTD_CLIP          (KEY_D_PEDSTD_INT_THRSH+1)
162#define KEY_D_PEDSTD_SB            (KEY_D_PEDSTD_CLIP+1)
163#define KEY_D_PEDSTD_SB_TIME       (KEY_D_PEDSTD_SB+1)
164#define KEY_D_PEDSTD_PEAKTHRSH     (KEY_D_PEDSTD_SB_TIME+1)
165#define KEY_D_PEDSTD_TIML          (KEY_D_PEDSTD_PEAKTHRSH+1)
166#define KEY_D_PEDSTD_TIMH          (KEY_D_PEDSTD_TIML+1)
167#define KEY_D_PEDSTD_PEAK          (KEY_D_PEDSTD_TIMH+1)
168#define KEY_D_PEDSTD_TIMECTR       (KEY_D_PEDSTD_PEAK+1)
169#define KEY_D_PEDSTD_STEPCTR       (KEY_D_PEDSTD_TIMECTR+1)
170#define KEY_D_PEDSTD_WALKTIME      (KEY_D_PEDSTD_STEPCTR+1)
171
172// EIS Keys
173#define KEY_P_EIS_FIFO_FOOTER      (KEY_D_PEDSTD_WALKTIME+1)
174#define KEY_P_EIS_FIFO_YSHIFT      (KEY_P_EIS_FIFO_FOOTER+1)
175#define KEY_P_EIS_DATA_RATE        (KEY_P_EIS_FIFO_YSHIFT+1)
176#define KEY_P_EIS_FIFO_XSHIFT      (KEY_P_EIS_DATA_RATE+1)
177#define KEY_P_EIS_FIFO_SYNC        (KEY_P_EIS_FIFO_XSHIFT+1)
178#define KEY_P_EIS_FIFO_ZSHIFT      (KEY_P_EIS_FIFO_SYNC+1)
179#define KEY_P_EIS_FIFO_READY       (KEY_P_EIS_FIFO_ZSHIFT+1)
180#define KEY_DMP_FOOTER             (KEY_P_EIS_FIFO_READY+1)
181#define KEY_DMP_INTX_HC            (KEY_DMP_FOOTER+1)
182#define KEY_DMP_INTX_PH            (KEY_DMP_INTX_HC+1)
183#define KEY_DMP_INTX_SH            (KEY_DMP_INTX_PH+1)
184#define KEY_DMP_AINV_SH            (KEY_DMP_INTX_SH +1)
185#define KEY_DMP_A_INV_XH           (KEY_DMP_AINV_SH+1)
186#define KEY_DMP_AINV_PH            (KEY_DMP_A_INV_XH+1)
187#define KEY_DMP_CTHX_H             (KEY_DMP_AINV_PH+1)
188#define KEY_DMP_CTHY_H             (KEY_DMP_CTHX_H+1)
189#define KEY_DMP_CTHZ_H             (KEY_DMP_CTHY_H+1)
190#define KEY_DMP_NCTHX_H            (KEY_DMP_CTHZ_H+1)
191#define KEY_DMP_NCTHY_H            (KEY_DMP_NCTHX_H+1)
192#define KEY_DMP_NCTHZ_H            (KEY_DMP_NCTHY_H+1)
193#define KEY_DMP_CTSQ_XH            (KEY_DMP_NCTHZ_H+1)
194#define KEY_DMP_CTSQ_YH            (KEY_DMP_CTSQ_XH+1)
195#define KEY_DMP_CTSQ_ZH            (KEY_DMP_CTSQ_YH+1)
196#define KEY_DMP_INTX_H             (KEY_DMP_CTSQ_ZH+1)
197#define KEY_DMP_INTY_H             (KEY_DMP_INTX_H+1)
198#define KEY_DMP_INTZ_H             (KEY_DMP_INTY_H+1)
199#define KEY_DMP_HPX_H              (KEY_DMP_INTZ_H+1)
200#define KEY_DMP_HPY_H              (KEY_DMP_HPX_H+1)
201#define KEY_DMP_HPZ_H              (KEY_DMP_HPY_H+1)
202
203// Stream Keys
204#define KEY_STREAM_P_GYRO_Z        (KEY_DMP_HPZ_H + 1)
205#define KEY_STREAM_P_GYRO_Y        (KEY_STREAM_P_GYRO_Z+1)
206#define KEY_STREAM_P_GYRO_X        (KEY_STREAM_P_GYRO_Y+1)
207#define KEY_STREAM_P_TEMP          (KEY_STREAM_P_GYRO_X+1)
208#define KEY_STREAM_P_AUX_Y         (KEY_STREAM_P_TEMP+1)
209#define KEY_STREAM_P_AUX_X         (KEY_STREAM_P_AUX_Y+1)
210#define KEY_STREAM_P_AUX_Z         (KEY_STREAM_P_AUX_X+1)
211#define KEY_STREAM_P_ACCEL_Y       (KEY_STREAM_P_AUX_Z+1)
212#define KEY_STREAM_P_ACCEL_X       (KEY_STREAM_P_ACCEL_Y+1)
213#define KEY_STREAM_P_FOOTER        (KEY_STREAM_P_ACCEL_X+1)
214#define KEY_STREAM_P_ACCEL_Z       (KEY_STREAM_P_FOOTER+1)
215
216#define NUM_KEYS (KEY_STREAM_P_ACCEL_Z+1)
217
218    typedef struct {
219        unsigned short key;
220        unsigned short addr;
221    } tKeyLabel;
222
223#define DINA0A 0x0a
224#define DINA22 0x22
225#define DINA42 0x42
226#define DINA5A 0x5a
227
228#define DINA06 0x06
229#define DINA0E 0x0e
230#define DINA16 0x16
231#define DINA1E 0x1e
232#define DINA26 0x26
233#define DINA2E 0x2e
234#define DINA36 0x36
235#define DINA3E 0x3e
236#define DINA46 0x46
237#define DINA4E 0x4e
238#define DINA56 0x56
239#define DINA5E 0x5e
240#define DINA66 0x66
241#define DINA6E 0x6e
242#define DINA76 0x76
243#define DINA7E 0x7e
244
245#define DINA00 0x00
246#define DINA08 0x08
247#define DINA10 0x10
248#define DINA18 0x18
249#define DINA20 0x20
250#define DINA28 0x28
251#define DINA30 0x30
252#define DINA38 0x38
253#define DINA40 0x40
254#define DINA48 0x48
255#define DINA50 0x50
256#define DINA58 0x58
257#define DINA60 0x60
258#define DINA68 0x68
259#define DINA70 0x70
260#define DINA78 0x78
261
262#define DINA04 0x04
263#define DINA0C 0x0c
264#define DINA14 0x14
265#define DINA1C 0x1C
266#define DINA24 0x24
267#define DINA2C 0x2c
268#define DINA34 0x34
269#define DINA3C 0x3c
270#define DINA44 0x44
271#define DINA4C 0x4c
272#define DINA54 0x54
273#define DINA5C 0x5c
274#define DINA64 0x64
275#define DINA6C 0x6c
276#define DINA74 0x74
277#define DINA7C 0x7c
278
279#define DINA01 0x01
280#define DINA09 0x09
281#define DINA11 0x11
282#define DINA19 0x19
283#define DINA21 0x21
284#define DINA29 0x29
285#define DINA31 0x31
286#define DINA39 0x39
287#define DINA41 0x41
288#define DINA49 0x49
289#define DINA51 0x51
290#define DINA59 0x59
291#define DINA61 0x61
292#define DINA69 0x69
293#define DINA71 0x71
294#define DINA79 0x79
295
296#define DINA25 0x25
297#define DINA2D 0x2d
298#define DINA35 0x35
299#define DINA3D 0x3d
300#define DINA4D 0x4d
301#define DINA55 0x55
302#define DINA5D 0x5D
303#define DINA6D 0x6d
304#define DINA75 0x75
305#define DINA7D 0x7d
306
307#define DINC00 0x00
308#define DINC01 0x01
309#define DINC02 0x02
310#define DINC03 0x03
311#define DINC08 0x08
312#define DINC09 0x09
313#define DINC0A 0x0a
314#define DINC0B 0x0b
315#define DINC10 0x10
316#define DINC11 0x11
317#define DINC12 0x12
318#define DINC13 0x13
319#define DINC18 0x18
320#define DINC19 0x19
321#define DINC1A 0x1a
322#define DINC1B 0x1b
323
324#define DINC20 0x20
325#define DINC21 0x21
326#define DINC22 0x22
327#define DINC23 0x23
328#define DINC28 0x28
329#define DINC29 0x29
330#define DINC2A 0x2a
331#define DINC2B 0x2b
332#define DINC30 0x30
333#define DINC31 0x31
334#define DINC32 0x32
335#define DINC33 0x33
336#define DINC38 0x38
337#define DINC39 0x39
338#define DINC3A 0x3a
339#define DINC3B 0x3b
340
341#define DINC40 0x40
342#define DINC41 0x41
343#define DINC42 0x42
344#define DINC43 0x43
345#define DINC48 0x48
346#define DINC49 0x49
347#define DINC4A 0x4a
348#define DINC4B 0x4b
349#define DINC50 0x50
350#define DINC51 0x51
351#define DINC52 0x52
352#define DINC53 0x53
353#define DINC58 0x58
354#define DINC59 0x59
355#define DINC5A 0x5a
356#define DINC5B 0x5b
357
358#define DINC60 0x60
359#define DINC61 0x61
360#define DINC62 0x62
361#define DINC63 0x63
362#define DINC68 0x68
363#define DINC69 0x69
364#define DINC6A 0x6a
365#define DINC6B 0x6b
366#define DINC70 0x70
367#define DINC71 0x71
368#define DINC72 0x72
369#define DINC73 0x73
370#define DINC78 0x78
371#define DINC79 0x79
372#define DINC7A 0x7a
373#define DINC7B 0x7b
374
375#if defined CONFIG_MPU_SENSORS_MPU3050
376#define DINA80 0x80
377#define DINA90 0x90
378#define DINAA0 0xa0
379#define DINAC9 0xc9
380#define DINACB 0xcb
381#define DINACD 0xcd
382#define DINACF 0xcf
383#define DINAC8 0xc8
384#define DINACA 0xca
385#define DINACC 0xcc
386#define DINACE 0xce
387#define DINAD8 0xd8
388#define DINADD 0xdd
389#define DINAF8 0xf8
390#define DINAFE 0xfe
391#define DINAC0 0xc0
392#define DINAC1 0xc1
393#define DINAC2 0xc2
394#define DINAC3 0xc3
395#define DINAC4 0xc4
396#define DINAC5 0xc5
397#elif defined CONFIG_MPU_SENSORS_MPU6050A2 || \
398	defined CONFIG_MPU_SENSORS_MPU6050B1
399
400#define DINA80 0x80
401#define DINA90 0x90
402#define DINAA0 0xa0
403#define DINAC9 0xc9
404#define DINACB 0xcb
405#define DINACD 0xcd
406#define DINACF 0xcf
407#define DINAC8 0xc8
408#define DINACA 0xca
409#define DINACC 0xcc
410#define DINACE 0xce
411#define DINAD8 0xd8
412#define DINADD 0xdd
413#define DINAF8 0xf0
414#define DINAFE 0xfe
415
416#define DINBF8 0xf8
417#define DINAC0 0xb0
418#define DINAC1 0xb1
419#define DINAC2 0xb4
420#define DINAC3 0xb5
421#define DINAC4 0xb8
422#define DINAC5 0xb9
423#define DINBC0 0xc0
424#define DINBC2 0xc2
425#define DINBC4 0xc4
426#define DINBC6 0xc6
427#else
428#error No CONFIG_MPU_SENSORS_xxxx has been defined.
429#endif
430
431
432#endif // DMPKEY_H__
433