aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mpu3050/mldl_cfg.h
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
commitfcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch)
treea57612d1888735a2ec7972891b68c1ac5ec8faea /drivers/misc/mpu3050/mldl_cfg.h
parent8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff)
Added missing tegra files.HEADmaster
Diffstat (limited to 'drivers/misc/mpu3050/mldl_cfg.h')
-rw-r--r--drivers/misc/mpu3050/mldl_cfg.h199
1 files changed, 199 insertions, 0 deletions
diff --git a/drivers/misc/mpu3050/mldl_cfg.h b/drivers/misc/mpu3050/mldl_cfg.h
new file mode 100644
index 00000000000..ad6a211c5d8
--- /dev/null
+++ b/drivers/misc/mpu3050/mldl_cfg.h
@@ -0,0 +1,199 @@
1/*
2 $License:
3 Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 $
18 */
19
20/**
21 * @addtogroup MLDL
22 *
23 * @{
24 * @file mldl_cfg.h
25 * @brief The Motion Library Driver Layer Configuration header file.
26 */
27
28#ifndef __MLDL_CFG_H__
29#define __MLDL_CFG_H__
30
31/* ------------------ */
32/* - Include Files. - */
33/* ------------------ */
34
35#include "mlsl.h"
36#include "mpu.h"
37
38/* --------------------- */
39/* - Defines. - */
40/* --------------------- */
41
42 /*************************************************************************/
43 /* Sensors */
44 /*************************************************************************/
45
46#define ML_X_GYRO (0x0001)
47#define ML_Y_GYRO (0x0002)
48#define ML_Z_GYRO (0x0004)
49#define ML_DMP_PROCESSOR (0x0008)
50
51#define ML_X_ACCEL (0x0010)
52#define ML_Y_ACCEL (0x0020)
53#define ML_Z_ACCEL (0x0040)
54
55#define ML_X_COMPASS (0x0080)
56#define ML_Y_COMPASS (0x0100)
57#define ML_Z_COMPASS (0x0200)
58
59#define ML_X_PRESSURE (0x0300)
60#define ML_Y_PRESSURE (0x0800)
61#define ML_Z_PRESSURE (0x1000)
62
63#define ML_TEMPERATURE (0x2000)
64#define ML_TIME (0x4000)
65
66#define ML_THREE_AXIS_GYRO (0x000F)
67#define ML_THREE_AXIS_ACCEL (0x0070)
68#define ML_THREE_AXIS_COMPASS (0x0380)
69#define ML_THREE_AXIS_PRESSURE (0x1C00)
70
71#define ML_FIVE_AXIS (0x007B)
72#define ML_SIX_AXIS_GYRO_ACCEL (0x007F)
73#define ML_SIX_AXIS_ACCEL_COMPASS (0x03F0)
74#define ML_NINE_AXIS (0x03FF)
75#define ML_ALL_SENSORS (0x7FFF)
76
77#define SAMPLING_RATE_HZ(mldl_cfg) \
78 ((((((mldl_cfg)->lpf) == 0) || (((mldl_cfg)->lpf) == 7)) \
79 ? (8000) \
80 : (1000)) \
81 / ((mldl_cfg)->divider + 1))
82
83#define SAMPLING_PERIOD_US(mldl_cfg) \
84 ((1000000L * ((mldl_cfg)->divider + 1)) / \
85 (((((mldl_cfg)->lpf) == 0) || (((mldl_cfg)->lpf) == 7)) \
86 ? (8000) \
87 : (1000)))
88/* --------------------- */
89/* - Variables. - */
90/* --------------------- */
91
92/* Platform data for the MPU */
93struct mldl_cfg {
94 /* MPU related configuration */
95 unsigned long requested_sensors;
96 unsigned char ignore_system_suspend;
97 unsigned char addr;
98 unsigned char int_config;
99 unsigned char ext_sync;
100 unsigned char full_scale;
101 unsigned char lpf;
102 unsigned char clk_src;
103 unsigned char divider;
104 unsigned char dmp_enable;
105 unsigned char fifo_enable;
106 unsigned char dmp_cfg1;
107 unsigned char dmp_cfg2;
108 unsigned char gyro_power;
109 unsigned char offset_tc[MPU_NUM_AXES];
110 unsigned short offset[MPU_NUM_AXES];
111 unsigned char ram[MPU_MEM_NUM_RAM_BANKS][MPU_MEM_BANK_SIZE];
112
113 /* MPU Related stored status and info */
114 unsigned char silicon_revision;
115 unsigned char product_id;
116 unsigned short trim;
117
118 /* Driver/Kernel related state information */
119 int gyro_is_bypassed;
120 int dmp_is_running;
121 int gyro_is_suspended;
122 int accel_is_suspended;
123 int compass_is_suspended;
124 int pressure_is_suspended;
125 int gyro_needs_reset;
126
127 /* Slave related information */
128 struct ext_slave_descr *accel;
129 struct ext_slave_descr *compass;
130 struct ext_slave_descr *pressure;
131
132 /* Platform Data */
133 struct mpu3050_platform_data *pdata;
134};
135
136
137int mpu3050_open(struct mldl_cfg *mldl_cfg,
138 void *mlsl_handle,
139 void *accel_handle,
140 void *compass_handle,
141 void *pressure_handle);
142int mpu3050_close(struct mldl_cfg *mldl_cfg,
143 void *mlsl_handle,
144 void *accel_handle,
145 void *compass_handle,
146 void *pressure_handle);
147int mpu3050_resume(struct mldl_cfg *mldl_cfg,
148 void *gyro_handle,
149 void *accel_handle,
150 void *compass_handle,
151 void *pressure_handle,
152 bool resume_gyro,
153 bool resume_accel,
154 bool resume_compass,
155 bool resume_pressure);
156int mpu3050_suspend(struct mldl_cfg *mldl_cfg,
157 void *gyro_handle,
158 void *accel_handle,
159 void *compass_handle,
160 void *pressure_handle,
161 bool suspend_gyro,
162 bool suspend_accel,
163 bool suspend_compass,
164 bool suspend_pressure);
165int mpu3050_read_accel(struct mldl_cfg *mldl_cfg,
166 void *accel_handle,
167 unsigned char *data);
168int mpu3050_read_compass(struct mldl_cfg *mldl_cfg,
169 void *compass_handle,
170 unsigned char *data);
171int mpu3050_read_pressure(struct mldl_cfg *mldl_cfg, void *mlsl_handle,
172 unsigned char *data);
173
174int mpu3050_config_accel(struct mldl_cfg *mldl_cfg,
175 void *accel_handle,
176 struct ext_slave_config *data);
177int mpu3050_config_compass(struct mldl_cfg *mldl_cfg,
178 void *compass_handle,
179 struct ext_slave_config *data);
180int mpu3050_config_pressure(struct mldl_cfg *mldl_cfg,
181 void *pressure_handle,
182 struct ext_slave_config *data);
183
184int mpu3050_get_config_accel(struct mldl_cfg *mldl_cfg,
185 void *accel_handle,
186 struct ext_slave_config *data);
187int mpu3050_get_config_compass(struct mldl_cfg *mldl_cfg,
188 void *compass_handle,
189 struct ext_slave_config *data);
190int mpu3050_get_config_pressure(struct mldl_cfg *mldl_cfg,
191 void *pressure_handle,
192 struct ext_slave_config *data);
193
194
195#endif /* __MLDL_CFG_H__ */
196
197/**
198 *@}
199 */