summaryrefslogtreecommitdiff
path: root/components/drivers/usb/usbdevice/class/rndis.h
blob: 1374338c14d1dbc1ca6e6601b26f41698757af29 (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
218
219
220
221
222
/*
 * File      : rndis.h
 * This file is part of RT-Thread RTOS
 * COPYRIGHT (C) 2012, RT-Thread Development Team
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://www.rt-thread.org/license/LICENSE
 *
 * Change Logs:
 * Date           Author            Notes
 * 2012-12-24     heyuanjie87       first version
 */

#ifndef  __RNDIS_H__
#define  __RNDIS_H__

#include <rtthread.h>

#define USB_ETH_MTU	                    1500+14
#define RNDIS_MESSAGE_BUFFER_SIZE       128

#define RESPONSE_AVAILABLE            0x00000001

/* Remote NDIS version numbers */
#define RNDIS_MAJOR_VERSION	1
#define RNDIS_MINOR_VERSION 0

/* common status values */
#define RNDIS_STATUS_SUCCESS 			0X00000000
#define RNDIS_STATUS_FAILURE			0XC0000001
#define RNDIS_STATUS_INVALID_DATA		0XC0010015
#define RNDIS_STATUS_NOT_SUPPORTED 		0XC00000BB
#define RNDIS_STATUS_MEDIA_CONNECT		0X4001000B
#define RNDIS_STATUS_MEDIA_DISCONNECT	0X4001000C

/* Remote NDIS message types */
#define REMOTE_NDIS_PACKET_MSG			0x00000001
#define REMOTE_NDIS_INITIALIZE_MSG		0X00000002
#define REMOTE_NDIS_HALT_MSG			0X00000003
#define REMOTE_NDIS_QUERY_MSG			0X00000004
#define REMOTE_NDIS_SET_MSG				0X00000005
#define REMOTE_NDIS_RESET_MSG			0X00000006
#define REMOTE_NDIS_INDICATE_STATUS_MSG 0X00000007
#define REMOTE_NDIS_KEEPALIVE_MSG		0X00000008
#define REMOTE_NDIS_INITIALIZE_CMPLT	0X80000002
#define REMOTE_NDIS_QUERY_CMPLT			0X80000004
#define REMOTE_NDIS_SET_CMPLT			0X80000005
#define REMOTE_NDIS_RESET_CMPLT			0X80000006
#define REMOTE_NDIS_KEEPALIVE_CMPLT		0X80000008

/* device flags */
#define RNDIS_DF_CONNECTIONLESS			0x00000001
#define RNDIS_DF_CONNECTION_ORIENTED	0x00000002
/* mediums */
#define RNDIS_MEDIUM_802_3				0x00000000

struct ucls_rndis
{
    uep_t notify;
    rt_uint32_t filter;
    rt_bool_t header;
    rt_uint8_t rndis_state;
    rt_uint8_t media_state;
    rt_uint8_t ethaddr[6];
};

/* Remote NDIS generic message type */
struct rndis_gen_msg
{
    rt_uint32_t	MessageType;
    rt_uint32_t	MessageLength;
};
typedef struct rndis_gen_msg* rndis_gen_msg_t;

struct rndis_packet_msg
{
	rt_uint32_t	MessageType;
	rt_uint32_t	MessageLength;
	rt_uint32_t	DataOffset;
	rt_uint32_t	DataLength;
	rt_uint32_t	OOBDataOffset;
	rt_uint32_t	OOBDataLength;
	rt_uint32_t	NumOOBDataElements;
	rt_uint32_t	PerPacketInfoOffset;
	rt_uint32_t	PerPacketInfoLength;
	rt_uint32_t	VcHandle;
	rt_uint32_t	Reserved;
};
typedef struct rndis_packet_msg* rndis_packet_msg_t;

/* Remote NDIS Initialize Message */
struct rndis_init_msg
{
    rt_uint32_t MessageType;
    rt_uint32_t	MessageLength;
    rt_uint32_t	RequestId;
    rt_uint32_t	MajorVersion;
    rt_uint32_t	MinorVersion;
    rt_uint32_t	MaxTransferSize;
};
typedef struct rndis_init_msg* rndis_init_msg_t;

/* Response */
struct rndis_init_cmplt
{
    rt_uint32_t	MessageType;
    rt_uint32_t	MessageLength;
    rt_uint32_t	RequestId;
    rt_uint32_t	Status;
    rt_uint32_t	MajorVersion;
    rt_uint32_t	MinorVersion;
    rt_uint32_t	DeviceFlags;
    rt_uint32_t	Medium;
    rt_uint32_t MaxPacketsPerTransfer;
    rt_uint32_t	MaxTransferSize;
    rt_uint32_t PacketAlignmentFactor;
    rt_uint32_t	AfListOffset;
    rt_uint32_t	AfListSize;
};
typedef struct rndis_init_cmplt* rndis_init_cmplt_t;

/* Remote NDIS Halt Message */
struct rndis_halt_msg
{
    rt_uint32_t	MessageType;
    rt_uint32_t	MessageLength;
    rt_uint32_t	RequestId;
};

/* Remote NDIS Query Message */
struct rndis_query_msg
{
    rt_uint32_t	MessageType;
    rt_uint32_t	MessageLength;
    rt_uint32_t	RequestId;
    rt_uint32_t	Oid;
    rt_uint32_t	InformationBufferLength;
    rt_uint32_t	InformationBufferOffset;
    rt_uint32_t	DeviceVcHandle;
};
typedef struct rndis_query_msg* rndis_query_msg_t;

/* Response */
struct rndis_query_cmplt
{
    rt_uint32_t	MessageType;
    rt_uint32_t	MessageLength;
    rt_uint32_t	RequestId;
    rt_uint32_t	Status;
    rt_uint32_t	InformationBufferLength;
    rt_uint32_t	InformationBufferOffset;
};
typedef struct rndis_query_cmplt* rndis_query_cmplt_t;

/* Remote NDIS Set Message */
struct rndis_set_msg
{
    rt_uint32_t	MessageType;
    rt_uint32_t	MessageLength;
    rt_uint32_t	RequestId;
    rt_uint32_t	Oid;
    rt_uint32_t	InformationBufferLength;
    rt_uint32_t	InformationBufferOffset;
    rt_uint32_t	DeviceVcHandle;
};
typedef struct rndis_set_msg* rndis_set_msg_t;

/* Response */
struct rndis_set_cmplt
{
    rt_uint32_t	MessageType;
    rt_uint32_t	MessageLength;
    rt_uint32_t	RequestId;
    rt_uint32_t	Status;
};
typedef struct rndis_set_cmplt* rndis_set_cmplt_t;

/* Remote NDIS Soft Reset Message */
struct rndis_reset_msg
{
    rt_uint32_t	MessageType;
    rt_uint32_t	MessageLength;
    rt_uint32_t	Reserved;
};

/* Remote NDIS Indicate Status Message */
struct rndis_indicate_status_msg
{
    rt_uint32_t MessageType;
    rt_uint32_t	MessageLength;
    rt_uint32_t	Status;
    rt_uint32_t	StatusBufferLength;
    rt_uint32_t	StatusBufferOffset;
};
typedef struct rndis_indicate_status_msg* rndis_indicate_status_msg_t;

struct rndis_keepalive_msg
{
	rt_uint32_t	MessageType;
	rt_uint32_t	MessageLength;
	rt_uint32_t	RequestID;
};
typedef struct rndis_keepalive_msg* rndis_keepalive_msg_t;

/* Response: */
struct rndis_keepalive_cmplt
{
	rt_uint32_t	MessageType;
	rt_uint32_t	MessageLength;
	rt_uint32_t	RequestId;
	rt_uint32_t	Status;
};
typedef struct rndis_keepalive_cmplt* rndis_keepalive_cmplt_t;







#endif