-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathremotejoy.h
187 lines (157 loc) · 3.73 KB
/
remotejoy.h
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
#ifndef _REMOTE_JOY_H_
#define _REMOTE_JOY_H_
#define HOSTFSDRIVER_PID (0x1C9)
#define SONY_VID (0x54C)
#define HOSTFS_MAX_BLOCK (64*1024)
#define HOSTFS_BULK_MAXWRITE (1024*1024)
#define HOSTFS_MAGIC 0x782F0812
#define ASYNC_MAGIC 0x782F0813
#define BULK_MAGIC 0x782F0814
#define JOY_MAGIC 0x909ACCEF
#define TYPE_JOY_CMD 1
#define TYPE_JOY_DAT 2
#define ASYNC_CMD_DEBUG 1
#define RJL_VERSION 190
#define HOSTFS_CMD_HELLO(ver) ((0x8FFC<<16)|ver)
/* Screen commands */
#define SCREEN_CMD_ACTIVE (1<<0)
#define SCREEN_CMD_SCROFF (1<<1)
#define SCREEN_CMD_DEBUG (1<<2)
#define SCREEN_CMD_ASYNC (1<<3)
/* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
/* | ADRESS2 | ADRESS1 | PRIORITY | MODE |FPS|A|D|S|A| */
/* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
#define SCREEN_CMD_SET_TRNSFPS(x) ((x)<<4)
#define SCREEN_CMD_GET_TRNSFPS(x) (((x)>>4)&0x03)
#define SCREEN_CMD_SET_TRNSMODE(x) ((x)<<6)
#define SCREEN_CMD_GET_TRNSMODE(x) (((x)>>6)&0x0F)
#define SCREEN_CMD_SET_PRIORITY(x) ((x)<<10)
#define SCREEN_CMD_GET_PRIORITY(x) (((x)>>10)&0x3F)
#define SCREEN_CMD_SET_ADRESS1(x) ((x)<<16)
#define SCREEN_CMD_GET_ADRESS1(x) (((x)>>16)&0xFF)
#define SCREEN_CMD_SET_ADRESS2(x) ((x)<<24)
#define SCREEN_CMD_GET_ADRESS2(x) (((x)>>24)&0xFF)
/* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
/* | TRNSH | TRNSW | TRNSY | TRNSX | */
/* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
#define SCREEN_CMD_SET_TRNSX(x) ((x)<<0)
#define SCREEN_CMD_GET_TRNSX(x) (((x)>>0)&0x7F)
#define SCREEN_CMD_SET_TRNSY(x) ((x)<<7)
#define SCREEN_CMD_GET_TRNSY(x) (((x)>>7)&0x1FF)
#define SCREEN_CMD_SET_TRNSW(x) ((x)<<16)
#define SCREEN_CMD_GET_TRNSW(x) (((x)>>16)&0x7F)
#define SCREEN_CMD_SET_TRNSH(x) ((x)<<23)
#define SCREEN_CMD_GET_TRNSH(x) (((x)>>23)&0x1FF)
#ifdef _MSC_VER
typedef unsigned int uint32_t;
#pragma pack(push, 1)
struct JoyEvent
{
unsigned int magic;
int type;
unsigned int value1;
unsigned int value2;
};
#pragma pack(pop)
#pragma pack(push, 1)
struct JoyScrHeader
{
unsigned int magic;
int mode; /* 0-3 */
int size;
int ref;
};
#pragma pack(pop)
enum USB_ASYNC_CHANNELS
{
ASYNC_SHELL = 0,
ASYNC_GDB = 1,
ASYNC_STDOUT = 2,
ASYNC_STDERR = 3,
ASYNC_USER = 4,
};
#pragma pack(push, 1)
struct HostFsCmd
{
uint32_t magic;
uint32_t command;
uint32_t extralen;
};
#pragma pack(pop)
#pragma pack(push, 1)
struct HostFsHelloCmd
{
struct HostFsCmd cmd;
};
#pragma pack(pop)
#pragma pack(push, 1)
struct HostFsHelloResp
{
struct HostFsCmd cmd;
};
#pragma pack(pop)
#pragma pack(push, 1)
struct AsyncCommand
{
uint32_t magic;
uint32_t channel;
};
#pragma pack(pop)
#pragma pack(push, 1)
struct BulkCommand
{
uint32_t magic;
uint32_t channel;
uint32_t size;
};
#pragma pack(pop)
#else // _MSC_VER
struct JoyEvent
{
unsigned int magic;
int type;
unsigned int value1;
unsigned int value2;
} __attribute__((packed));
struct JoyScrHeader
{
unsigned int magic;
int mode; /* 0-3 */
int size;
int ref;
} __attribute__((packed));
enum USB_ASYNC_CHANNELS
{
ASYNC_SHELL = 0,
ASYNC_GDB = 1,
ASYNC_STDOUT = 2,
ASYNC_STDERR = 3,
ASYNC_USER = 4,
};
struct HostFsCmd
{
uint32_t magic;
uint32_t command;
uint32_t extralen;
} __attribute__((packed));
struct HostFsHelloCmd
{
struct HostFsCmd cmd;
} __attribute__((packed));
struct HostFsHelloResp
{
struct HostFsCmd cmd;
} __attribute__((packed));
struct AsyncCommand
{
uint32_t magic;
uint32_t channel;
} __attribute__((packed));
struct BulkCommand
{
uint32_t magic;
uint32_t channel;
uint32_t size;
} __attribute__((packed));
#endif // _MSC_VER
#endif // _REMOTE_JOY_H_