aboutsummaryrefslogtreecommitdiff
path: root/include/linux/htc_mode_server.h
blob: 0b76d226172986f6fa98839094c9f1b26b429ec5 (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
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
/*
 * HTC mode Server Header
 *
 * Copyright (C) 2011 HTC Corporation
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * 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.
 *
 */
#ifndef _HTC_MODE_SERVER_H_
#define _HTC_MODE_SERVER_H_

#include <linux/completion.h>

#define HSML_PROTOCOL_VERSION		0x0006
#define HSML_07_PROTOCOL_VERSION		0x0008

#define HTC_MODE_CONTROL_REQ		0x12

#define CLIENT_INFO_SERVER_ROTATE_USED		(1 << 1)

#define CTRL_CONF_TOUCH_EVENT_SUPPORTED		(1 << 0)
#define CTRL_CONF_NUM_SIMULTANEOUS_TOUCH	(4 << 1)


#define HSML_SERVER_NONCE_SIZE 		20
#define HSML_CLIENT_SIG_SIZE		168
#define HSML_SERVER_SIG_SIZE		148

enum {
	CLIENT_INFO_MESGID = 0,
	SERVER_INFO_MESGID,
	TOUCH_EVENT_MESGID,
	AUTH_SERVER_NONCE_MESGID,
	AUTH_CLIENT_NONCE_MESGID,
	AUTH_RESPONSE_MESGID,
	OBU_INFO_MESGID
};

enum {
	HSML_FB_HEADER_ID = 0,
	HSML_TOUCH_EVENT_ID,
	HSML_KEY_EVENT_ID
};

enum {
	FB_HEADER_MSGID = 0,

};

enum {
	HSML_06_REQ_GET_SERVER_VERSION = 0x40,
	HSML_06_REQ_SEND_CLIENT_INFO,
	HSML_06_REQ_GET_SERVER_INFO,
	HSML_06_REQ_GET_FB,
	HSML_06_REQ_STOP,
	HSML_06_REQ_SEND_EXTENDED_CLIENT_INFO,
	HSML_06_REQ_GET_SERVER_NONCE,
	HSML_06_REQ_SET_CLIENT_AUTH,
	HSML_06_REQ_GET_SERVER_AUTH,
	HSML_06_REQ_SET_MAX_CHARGING_CURRENT,

	HSML_06_REQ_COUNT
};

struct msm_client_info {
	u8 mesg_id;
	u16 width;
	u16 height;
	u32 display_conf;
	u32 pixel_format;
	u32 ctrl_conf;
} __attribute__ ((__packed__));

struct msm_server_info {
	u8 mesg_id;
	u16 width;
	u16 height;
	u32 pixel_format;
	u32 ctrl_conf;
} __attribute__ ((__packed__));


struct htcmode_protocol {
	u16 version;
	u16 vendor;
	u8 request;
	struct msm_client_info client_info;
	struct msm_server_info server_info;
	char nonce[HSML_SERVER_NONCE_SIZE];
	u8 client_sig[HSML_CLIENT_SIG_SIZE];
	u8 server_sig[HSML_SERVER_SIG_SIZE];
	u8 notify_authenticator;
	u8 auth_in_progress;
	u8 auth_result;
	u8 debug_mode;
};

struct hsml_header {
	u8 msg_id;
	u16 x;
	u16 y;
	u16 w;
	u16 h;
	u8 signature[8];
	u8 reserved[494];
	u8 checksum;
} __attribute__ ((__packed__));

struct touch_content {
	u16 x;
	u16 y;
	u8 event_id;
	u8 pressure;
} __attribute__ ((__packed__));

struct touch_event {
	u8 mesg_id;
    u8 num_touch;
} __attribute__ ((__packed__));

struct key_event {
	u8 mesg_id;
    u8 down;
    u32 code;
} __attribute__ ((__packed__));


enum {
	HSML_08_REQ_GET_SERVER_VERSION = 0x40,
	HSML_08_REQ_NUM_COMPRESSION_SETTINGS,
	HSML_08_REQ_GET_SERVER_CONFIGURATION,
	HSML_08_REQ_SET_SERVER_CONFIGURATION,
	HSML_08_REQ_GET_FB,
	HSML_08_REQ_STOP,
	HSML_08_REQ_GET_SERVER_DISPLAY,
	HSML_08_REQ_SET_SERVER_DISPLAY,
	HSML_08_REQ_SET_MAX_FRAME_RATE,

	HSML_08_REQ_COUNT,
	HSML_08_REQ_MIRROR_LINK = 0xf0
};

enum {
	HSML_MSG_TOUCH	= 1,
};

enum {
	HSML_SERVER_CAP_H264 = 0,
	HSML_SERVER_CAP_HDCP,
	HSML_SERVER_CAP_TOUCH
};

enum {
	PIXEL_FORMAT_ARGB888 = 0,
	PIXEL_FORMAT_RGB565,
	PIXEL_FORMAT_RGB555,
	PIXEL_FORMAT_RGB444,
	PIXEL_FORMAT_RGB343,
	PIXEL_FORMAT_16_GRAY,
	PIXEL_FORMAT_8_GRAY
};

struct get_server_configuation {
	u32 dwCapabilities;
	u32 dwTouchConfiguration;
} __attribute__ ((__packed__));

struct set_server_configuation {
	u32 dwCapabilities;
	u32 dwTouchConfiguration;
	u8  bProfile;
	u8  bLevel;
} __attribute__ ((__packed__));

struct get_display_capabilities {
	u32 dwResolutionSupported;
	u32 dwPixelFormatSupported;
} __attribute__ ((__packed__));

static u32 display_setting[32][2] = {
	{640,360},{640,480},{720,480},{720,576},
	{800,480},{800,600},{848,480},{854,480},
	{864,480},{960,540},{1024,600},{1024,768},
	{1152,864},{1280,720},{1280,768},{1280,800},
	{1280,1024},{1360,768},{1400,900},{1400,900},
	{1400,1050},{1600,900},{1600,1200},{1680,1024},
	{1680,1050},{1920,1080},{1920,1200},{0,0},
	{0,0},{0,0},{0,0},{0,0},
};

struct set_display_info {
	u16 wWidth;
	u16 wHeight;
	u8 bPixelFormat;
	u16 wMaxGrayLevel;
} __attribute__ ((__packed__));

struct hsml_protocol {
	u16 version;
	u16 vendor;
	u8 request;
	u32 MaxFPS;
	struct get_server_configuation get_server_configuation_info;
	struct set_server_configuation set_server_configuation_info;
	struct get_display_capabilities get_display_capabilities_info;
	struct set_display_info set_display_info;
	u8 debug_mode;
};

#endif