OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [io/] [usb/] [slave/] [current/] [tests/] [protocol.h] - Blame information for rev 825

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//=================================================================
2
//
3
//        protocol.h
4
//
5
//        USB testing - host<->target protocol
6
//
7
//==========================================================================
8
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
9
// -------------------------------------------                              
10
// This file is part of eCos, the Embedded Configurable Operating System.   
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under    
14
// the terms of the GNU General Public License as published by the Free     
15
// Software Foundation; either version 2 or (at your option) any later      
16
// version.                                                                 
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT      
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
21
// for more details.                                                        
22
//
23
// You should have received a copy of the GNU General Public License        
24
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
25
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
26
//
27
// As a special exception, if other files instantiate templates or use      
28
// macros or inline functions from this file, or you compile this file      
29
// and link it with other works to produce a work based on this file,       
30
// this file does not by itself cause the resulting work to be covered by   
31
// the GNU General Public License. However the source code for this file    
32
// must still be made available in accordance with section (3) of the GNU   
33
// General Public License v2.                                               
34
//
35
// This exception does not invalidate any other reasons why a work based    
36
// on this file might be covered by the GNU General Public License.         
37
// -------------------------------------------                              
38
// ####ECOSGPLCOPYRIGHTEND####                                              
39
//==========================================================================
40
//#####DESCRIPTIONBEGIN####
41
//
42
// This header file is shared between target and host, and serves to
43
// define certain aspects of the protocol used between the two such
44
// as request codes.
45
//
46
// Author(s):     bartv
47
// Date:          2001-07-04
48
//####DESCRIPTIONEND####
49
//==========================================================================
50
 
51
// The largest control packet that will be sent or expected.
52
#define USBTEST_MAX_CONTROL_DATA        255
53
 
54
// The largest error message that can be sent.
55
#define USBTEST_MAX_MESSAGE             254
56
 
57
// The largest bulk transfer that will be sent or expected. Because of
58
// the use of the USB devfs support in the Linux kernel this is
59
// currently limited to a single page, i.e. 4096 bytes. To allow for
60
// padding, it is actually reduced to a slightly smaller size of 4090
61
// bytes. This should still be sufficient to test most interesting
62
// boundary conditions, apart from the transition to >64K. 
63
//
64
// A small amount of additional buffer space should be allocated by
65
// both host and target to allow for padding and possibly cache
66
// alignment. All other protocols involve smaller transfers than this,
67
// <= 64 bytes for interrupt transfers, <= 1023 for isochronous.
68
#define USBTEST_MAX_BULK_DATA           (4096)
69
#define USBTEST_MAX_BULK_DATA_EXTRA     1024
70
 
71
// The maximum number of tests that can be run concurrently. Each
72
// needs a separate thread, stack, and buffer so there are memory
73
// consumption implications.
74
#define USBTEST_MAX_CONCURRENT_TESTS    8
75
 
76
// Allow the host to find out the number of endpoints supported on
77
// this target. The theoretical maximum number of endpoints is 91
78
// (endpoint 0 control, endpoint 1-15 for both IN and OUT bulk, iso
79
// and interrupt) so a single byte response will suffice. The value
80
// and index fields are not used.
81
#define USBTEST_MAX_ENDPOINTS           91
82
#define USBTEST_ENDPOINT_COUNT          0x001
83
 
84
// Get hold of additional information about a specific entry in the
85
// array of endpoint details. The index field in the request
86
// identifies the entry of interest. The reply information is as per
87
// the usbs_testing_endpoint structure, and consists of:
88
//   1) one byte, the endpoint type (control, bulk, ...)
89
//   2) one byte, the endpoint number (as opposed to the array index number)
90
//   3) one byte for direction, USB_DIR_IN or USB_DIR_OUT
91
//   4) one byte for max_in_padding, usually 0
92
//   5) four bytes for min_size, 32-bit little-endian integer
93
//   6) four bytes for max_size, 32-bit little-endian integer
94
//   7) an additional n bytes for the devtab name, max ~240 bytes
95
//      although usually far less.
96
#define USBTEST_ENDPOINT_DETAILS        0x002
97
 
98
// Report pass or failure. The host will send a string of up to
99
// MAX_CONTROL_DATA bytes. The value and index fields are not used.
100
#define USBTEST_PASS                    0x003
101
#define USBTEST_PASS_EXIT               0x004
102
#define USBTEST_FAIL                    0x005
103
#define USBTEST_FAIL_EXIT               0x006
104
 
105
// Synchronise. One problem with the current eCos USB API is that
106
// there is no way to have a delayed response to a control message.
107
// Any such support would be tricky, there are significant differences
108
// in the hardware implementations and also timing constraints that
109
// need to be satisfied. Instead the entire response to any control
110
// request has to be prepared at DSR level. Usually this does not
111
// cause any problems, e.g. for handling the standard control
112
// messages, but for USB testing it may not be possible to handle a
113
// request entirely at DSR level - yet the next full request should
114
// not come in until the current one has been handled at thread-level.
115
// To work around this there is support for a synchronization control
116
// message. The return value is a single byte, 1 if the target is
117
// ready for new requests, 0 if there is a still a request being
118
// processed. The host can then perform some polling.
119
#define USBTEST_SYNCH                   0x007
120
 
121
// Abort. There is no easy way to get both host and target back to a
122
// known state, so abort the current test run.
123
#define USBTEST_ABORT                   0x008
124
 
125
// Cancel the current batch of tests. Something has gone wrong at the
126
// Tcl level, so any tests already prepared must be abandoned. No
127
// additional data is required.
128
#define USBTEST_CANCEL                  0x009
129
 
130
// Start the current batch of tests. No additional data is involved
131
// or expected.
132
#define USBTEST_START                   0x00A
133
 
134
// Has the current batch of tests finished? The host side polls the
135
// target at regular intervals for this information.
136
#define USBTEST_FINISHED                0x00B
137
 
138
// Set the test-terminated flag. Something has gone wrong, probably a
139
// timeout.
140
#define USBTEST_SET_TERMINATED          0x00C
141
 
142
// Get hold of recovery information for thread i in the target, where
143
// the index field of the request identifies the thread. The result
144
// is zero-bytes if the specified test has already finished, otherwise
145
// a recovery structure.
146
#define USBTEST_GET_RECOVERY            0x00D
147
 
148
// The target should perform a recovery action to unlock a thread
149
// on the host. The request holds a recovery structure.
150
#define USBTEST_PERFORM_RECOVERY        0x00E
151
 
152
// Collect the test result. The result is a single byte that indicates
153
// pass or fail, optionally followed by a failure message.
154
#define USBTEST_GET_RESULT              0x00F
155
 
156
// The current batch of tests has completed. Perform any final clean-ups.
157
#define USBTEST_BATCH_DONE              0x010
158
 
159
// Set the verbosity level on the target-side
160
#define USBTEST_VERBOSE                 0x011
161
 
162
// Perform endpoint initialization to ensure host and target
163
// can actually communicate over a given endpoint
164
#define USBTEST_INIT_CONTROL            0x012
165
#define USBTEST_INIT_BULK_IN            0x013
166
#define USBTEST_INIT_BULK_OUT           0x014
167
#define USBTEST_INIT_ISO_IN             0x015
168
#define USBTEST_INIT_ISO_OUT            0x016
169
#define USBTEST_INIT_INTERRUPT_IN       0x017
170
#define USBTEST_INIT_INTERRUPT_OUT      0x018
171
 
172
 
173
// A standard bulk test. The data consists of a UsbTest_Bulk
174
// structure, suitably packed.
175
#define USBTEST_TEST_BULK               0x040
176
 
177
// A control-IN test. The host will send reserved control messages with
178
// an appropriate length field, and the target should return that data.
179
#define USBTEST_TEST_CONTROL_IN         0x041
180
 
181
// Sub-protocols for reserved control messages, supporting test operations
182
// other than control-IN.
183
#define USBTEST_RESERVED_CONTROL_IN     0x01
184
 
185
// Work around a problem with control messages that involve additional
186
// data from host to target. This problem is not yet well-understood.
187
// The workaround involves sending multiple control packets with
188
// up to four bytes encoded in the index and value fields.
189
#define USBTEST_CONTROL_DATA1           0x0F1
190
#define USBTEST_CONTROL_DATA2           0x0F2
191
#define USBTEST_CONTROL_DATA3           0x0F3
192
#define USBTEST_CONTROL_DATA4           0x0F4
193
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.