summaryrefslogtreecommitdiff
path: root/include/linux/m4sensorhub_client_ioctl.h
blob: a6e2c455c4c5cf94812e505f0f18970282296abc (plain)
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
/*
 * Copyright (c) 2012, Motorola, Inc. All Rights Reserved.
 *
 * 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, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef __M4SENSORHUB_CLIENT_IOCTL_H__
#define __M4SENSORHUB_CLIENT_IOCTL_H__

/** The following define the IOCTL command values via the ioctl macros */

#define M4_SENSOR_IOCTL_BASE            		0xA2
#define M4_SENSOR_IOCTL_GET_TEMPRATURE  		_IOR(M4_SENSOR_IOCTL_BASE, 01, int)
#define M4_SENSOR_IOCTL_GET_PRESSURE    		_IOR(M4_SENSOR_IOCTL_BASE, 02, int)
#define M4_SENSOR_IOCTL_GET_GYRO        		_IOR(M4_SENSOR_IOCTL_BASE, 03, int)
#define M4_SENSOR_IOCTL_SET_DELAY       		_IOW(M4_SENSOR_IOCTL_BASE, 04, int)
#define M4_SENSOR_IOCTL_APP_GET_FLAG    		_IOR(M4_SENSOR_IOCTL_BASE, 05, int)
#define M4_SENSOR_IOCTL_APP_SET_FLAG    		_IOW(M4_SENSOR_IOCTL_BASE, 06, int)
#define M4_SENSOR_IOCTL_GET_PEDOMETER   		_IOR(M4_SENSOR_IOCTL_BASE, 07, int)
#define M4_SENSOR_IOCTL_GET_PASSIVE_DATA		_IOR(M4_SENSOR_IOCTL_BASE, 10, int)
#define M4_SENSOR_IOCTL_GET_SLEEP_DATA			_IOR(M4_SENSOR_IOCTL_BASE, 11, int)
#define M4_SENSOR_IOCTL_SET_POSIX_TIME			_IOW(M4_SENSOR_IOCTL_BASE, 12, int)
#define M4_SENSOR_IOCTL_SET_ACTIVE_MODE			_IOW(M4_SENSOR_IOCTL_BASE, 13, int)
#define M4_SENSOR_IOCTL_SET_PASSIVE_MODE 		_IOW(M4_SENSOR_IOCTL_BASE, 14, int)
#define M4_SENSOR_IOCTL_SLEEP_ANALYSIS			_IOW(M4_SENSOR_IOCTL_BASE, 15, int)
#define M4_SENSOR_IOCTL_SET_EQUIPMENT_TYPE		_IOW(M4_SENSOR_IOCTL_BASE, 16, int)
#define M4_SENSOR_IOCTL_SET_MANUAL_CALIB_WALK_SPEED	_IOW(M4_SENSOR_IOCTL_BASE, 17, int)
#define M4_SENSOR_IOCTL_SET_MANUAL_CALIB_JOG_SPEED	_IOW(M4_SENSOR_IOCTL_BASE, 20, int)
#define M4_SENSOR_IOCTL_SET_MANUAL_CALIB_RUN_SPEED	_IOW(M4_SENSOR_IOCTL_BASE, 21, int)
#define M4_SENSOR_IOCTL_SET_MANUAL_CALIB_STATUS		_IOW(M4_SENSOR_IOCTL_BASE, 22, int)
#define M4_SENSOR_IOCTL_SET_USER_PROFILE		_IOW(M4_SENSOR_IOCTL_BASE, 23, int)
#define M4_SENSOR_IOCTL_SET_USER_DISTANCE		_IOW(M4_SENSOR_IOCTL_BASE, 24, int)
#define M4_SENSOR_IOCTL_SET_USER_CALIB_TABLE		_IOW(M4_SENSOR_IOCTL_BASE, 25, int)
#define M4_SENSOR_IOCTL_GET_MANUAL_CALIB_STATUS		_IOR(M4_SENSOR_IOCTL_BASE, 26, int)
#define M4_SENSOR_IOCTL_ERASE_CALIB			_IOW(M4_SENSOR_IOCTL_BASE, 27, int)
#define M4_SENSOR_IOCTL_SET_SCREEN_ON_GESTURE_STATUS	_IOW(M4_SENSOR_IOCTL_BASE, 30, int)
#define M4_SENSOR_IOCTL_SET_ALTITUDE 			_IOW(M4_SENSOR_IOCTL_BASE, 31, int)
#define M4_SENSOR_IOCTL_GET_FUSION			_IOR(M4_SENSOR_IOCTL_BASE, 32, int)
#define M4_SENSOR_IOCTL_GET_COMPASS			_IOR(M4_SENSOR_IOCTL_BASE, 33, int)
#define M4_SENSOR_IOCTL_GET_ACCEL			_IOR(M4_SENSOR_IOCTL_BASE, 34, int)
#define M4_SENSOR_IOCTL_GYRO_SET_DELAY			_IOW(M4_SENSOR_IOCTL_BASE, 35, int)
#define M4_SENSOR_IOCTL_COMPASS_SET_DELAY		_IOW(M4_SENSOR_IOCTL_BASE, 36, int)
#define M4_SENSOR_IOCTL_ACCEL_SET_DELAY			_IOW(M4_SENSOR_IOCTL_BASE, 37, int)
#define M4_SENSOR_IOCTL_FUSION_SET_DELAY		_IOW(M4_SENSOR_IOCTL_BASE, 40, int)
#define M4_SENSOR_IOCTL_SET_SCREEN_STATUS _IOW(M4_SENSOR_IOCTL_BASE, 41, int)
#define M4_SENSOR_IOCTL_DL_SEND_PACKET    _IOW(M4_SENSOR_IOCTL_BASE, 42, int)
#define M4_SENSOR_IOCTL_SET_TIMEZONE_OFFSET _IOW(M4_SENSOR_IOCTL_BASE, 43, int)
#define M4_SENSOR_IOCTL_LOCK_CLOCKFACE    _IOW(M4_SENSOR_IOCTL_BASE, 44, int)
#define M4_SENSOR_IOCTL_SET_DAILYSTEP_OFFSET _IOW(M4_SENSOR_IOCTL_BASE, 45, int)

#define M4_SENSOR_DL_MAX_FILE_SIZE 16
#define M4_SENSOR_DL_MAX_PACKET_SIZE 2048

enum M4_SENSOR_DL_CMDS {
	M4_SENSOR_DL_CMD_GET_CHECKSUM,
	M4_SENSOR_DL_CMD_OPEN_FILE,
	M4_SENSOR_DL_CMD_WRITE_FILE,
	M4_SENSOR_DL_CMD_CLOSE_FILE,
	M4_SENSOR_DL_CMD_DELETE_FILE,
};

enum M4_SENSOR_DL_ERROR_CODES {
	M4_SENSOR_DL_SUCCESS,
	M4_SENSOR_DL_ERROR_GET_CHECKSUM,
	M4_SENSOR_DL_ERROR_OPEN_FILE,
	M4_SENSOR_DL_ERROR_WRITE_FILE,
	M4_SENSOR_DL_ERROR_CLOSE_FILE,
	M4_SENSOR_DL_ERROR_DELETE_FILE,
	M4_SENSOR_DL_ERROR_INVALID_SIZE,
	/*internal error between M4<==>Kernel*/
	M4_SENSOR_DL_ERROR_SEND_CMD = 0x80,
	M4_SENSOR_DL_ERROR_DATA_CHECKSUM,
};

#define M4_MAX_LOG_LEVEL	3
#define get_log_level(loglevel, mask) ((loglevel >> mask) & 0x3)

struct m4sh_user_profile {
	unsigned char gender;
	unsigned char age;
	unsigned char height;
	unsigned char weight;
};

struct m4sh_workout_data {
	int msp_distance;
	int user_distance;
};

struct m4sh_download_packet{
	unsigned char command;
	unsigned char status;
	unsigned short size;
	unsigned int  checksum;
	char filename[M4_SENSOR_DL_MAX_FILE_SIZE];
	unsigned char buffer[M4_SENSOR_DL_MAX_PACKET_SIZE];
};

enum m4sh_log_level_mask {
	GEN_MASK_BIT_1,
	GEN_MASK_BIT_2,
	TIMER_MASK_BIT_1,
	TIMER_MASK_BIT_2,
	ACCEL_MASK_BIT_1,
	ACCEL_MASK_BIT_2,
	TMP_MASK_BIT_1,
	TMP_MASK_BIT_2,
	BMP_MASK_BIT_1,
	BMP_MASK_BIT_2,
	PEDO_MASK_BIT_1,
	PEDO_MASK_BIT_2,
	TCMD_MASK_BIT_1,
	TCMD_MASK_BIT_2,
	GYRO_MASK_BIT_1,
	GYRO_MASK_BIT_2,
	COMPASS_MASK_BIT_1,
	COMPASS_MASK_BIT_2,
	FUSION_MASK_BIT_1,
	FUSION_MASK_BIT_2,
	METS_MASK_BIT_1,
	METS_MASK_BIT_2,
	GESTURE_MASK_BIT_1,
	GESTURE_MASK_BIT_2,
	POWER_MASK_BIT_1,
	POWER_MASK_BIT_2,
	CORRELATION_MASK_BIT_1,
	CORRELATION_MASK_BIT_2,
	GPS_MASK_BIT_1,
	GPS_MASK_BIT_2,
	DOWNLOAD_MASK_BIT_1,
	DOWNLOAD_MASK_BIT_2,
	AUDIO_MASK_BIT_1,
	AUDIO_MASK_BIT_2,
	DISPLAY_MASK_BIT_1,
	DISPLAY_MASK_BIT_2,
	WRIST_MASK_BIT_1,
	WRIST_MASK_BIT_2,
};

#endif  /* __M4SENSORHUB_CLIENT_IOCTL_H__ */