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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [io/] [usb/] [msd/] [slave/] [current/] [doc/] [usbs_msd.sgml] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
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
  eCos Support for USB Mass Storage Peripherals
40
 
41
  
42
 
43
  
44
    
45
      Introduction
46
    
47
    
48
      Introduction
49
      
50
        eCos support for USB Mass Storage Peripherals
51
      
52
    
53
 
54
    Introduction
55
      
56
        Currently, the eCos USB-Mass Storage Device (MSD) slave package
57
        provides support only for the SCSI transparent command set. The
58
        package flexibility allows future extension for other sub-class,
59
        .i.e. RBC, UFI etc..
60
        The package requires the actual storage media to use the eCos disk
61
        interface. Disk sector size is assumed 512 bytes.
62
      
63
      
64
        The USB-MSD package is not tied to any specific
65
        hardware. It requires the presence of USB hardware on the
66
        target and a suitable device driver to make endpoints
67
        available for this code to use. The configuration system
68
        cannot load the eCos package automatically for specific
69
        targets, in the way that a USB device driver or an ethernet
70
        driver can be loaded automatically. Instead, the package has
71
        to be added explicitly. When using the command line tools this
72
        will involve an operation like the following:
73
      
74
      
75
        $ ecosconfig add usbs_msd
76
      
77
      
78
        Typically, this will automatically cause the USB device driver
79
        to become active. The USB-Mass Storage Device driver runs as a
80
        thread, therefore requires the kernel package to be active. To
81
        start the MSD interface, user must call the usbs_msd_start()
82
        function. No other user intervention is required.
83
        The MSD driver will interact directly with the storage media.
84
        Care should be taken not to mount/use the filesystem present on
85
        the media while used as a mass storage. This could potentially
86
        damage the filesystem.
87
      
88
    
89
  
90
 
91
  
92
  
93
 
94
  
95
    
96
      Configuration
97
    
98
    
99
      Configuration
100
      Configuration USB Mass Storage Peripherals
101
    
102
 
103
    Configuration
104
      
105
        The USB Mass Storage Device interface uses the bulk transfer mode. It needs
106
        three endpoints for the communication with the host to be complete.
107
        The control endpoint (commonly EP0), the transmission and reception
108
        endpoints. The default CDL file contains configuration for
109
        the USB-Mass Storage Device 0. While it is uncommon to have several USB
110
        ports on a device, it is not impossible, hence user can update the package and
111
        create a second device .e.g. MSD1.
112
      
113
 
114
      Endpoints
115
      
116
        Each endpoint shall be configured according to the underlying hardware.
117
        The endpoints configuration includes, the structure name, endpoint number
118
        and buffer size according to the USB chip specification.
119
 
120
        The control endpoint is selected with
121
        CYGDAT_IO_USB_SLAVE_MSD0_EP0.
122
        The default values is set to "usbs_at91_ep0". This is the control
123
        endpoint for the Atmel AT91 USB device driver.
124
 
125
         The TX and RX endpoints can be assigned statically or dynamically (assuming the USB
126
         device driver supports it). In case of static configuration, the bulk IN and bulk OUT
127
         endpoints are configured with CYGDAT_IO_USB_SLAVE_MSD0_TX_EP
128
         and CYGDAT_IO_USB_SLAVE_MSD0_RX_EP respectively.
129
 
130
        In addition, the  TX and RX enpoints number must be provided by the user.
131
        They are configured with  CYGNUM_IO_USB_SLAVE_MSD0_TX_EP_NUM
132
        and CYGNUM_IO_USB_SLAVE_MSD0_RX_EP_NUM
133
 
134
        In case of dynamic endpoints configuration, only the endpoint number is mandatory.
135
      
136
 
137
      
138
        The last endpoints configuration parameters are the entpoints buffer size. They are set with:
139
      
140
      CYGNUM_IO_USB_SLAVE_MSD0_EP0_MAX_PACKET_SIZE
141
      CYGNUM_IO_USB_SLAVE_MSD0_TX_EP_MAX_PACKET_SIZE
142
      CYGNUM_IO_USB_SLAVE_MSD0_RX_EP_MAX_PACKET_SIZE
143
      
144
        A mass storage device must stall one or both bulk endpoints in
145
        several situations. However, not all eCos USB device drivers seems
146
        to implement this functionality correctly. Hence, this option is
147
        disable by default. Testing shows that both Linux and Windows can
148
        handle mass storage device with stall disable as long as all data transfer phase
149
        are handled correctly. Enpoint stall can be enable with
150
        CYGSEM_IO_USB_SLAVE_MSD_STALL_ENABLE.
151
      
152
      
153
      Enumeration
154
      
155
        The USB MSD device will make its vendor:product ID known to
156
        the host. This should be configured
157
        with CYGNUM_IO_USB_SLAVE_MSD0_VENDOR_ID and
158
        CYGNUM_IO_USB_SLAVE_MSD0_PRODUCT_ID NOTE:
159
        The default configurations are not valid for commercial products, but
160
        should work for testing.
161
      
162
       
163
        The USB enumeration also contains text strings to describe the
164
        device. The manufacturer string can be set with
165
        CYGDAT_IO_USB_SLAVE_MSD0_MFG_STR. The product name
166
        can be set with CYGDAT_IO_USB_SLAVE_MSD0_MFG_STR,
167
        finally, the serial number can be set
168
        with CYGDAT_IO_USB_SLAVE_MSD0_SERIAL_STR.
169
      
170
      
171
      Storage
172
      
173
        To access the storage media, the USB MSD package requires the storage
174
        media to use the eCos disk interface. The disk sector size is assumed
175
        to be 512 bytes. Multiple logical units are supported by the package
176
        (2 by default).
177
        More logical units can be supported by changing the
178
        USBS_MSD_CBW_MAX_LUN definition according
179
        to the user needs. Two logical units can be either 2 partitions on the same
180
        disk or 2 partitions on 2 different physical disks.
181
        The first logical unit can be set with
182
        CYGDAT_IO_USB_SLAVE_MSD0_LUN0_NAME. The default value
183
        is assigned to "/dev/ramdisk0/1", the first partition of the ramdisk
184
         used by the test application.
185
      
186
      
187
    
188
  
189
 
190
  
191
  
192
 
193
  
194
    
195
      Host Configuration
196
    
197
    
198
      Host Configuration
199
      Host Configuration for USB Mass Storage like Peripherals
200
      
201
    
202
 
203
    
204
      Host Configuration
205
      
206
        With modern host operating system, no specific configuration of the
207
        host shall be required to bring up the eCos USB-Mass Storage Device.
208
      
209
      SCSI command set
210
      
211
       The USB-Mass Storage device will respond to a set of SCSI commands:
212
      
213
      INQUIRY
214
      READ_CAPACITY
215
      READ_10
216
      WRITE_10
217
      REQUEST_SENSE
218
      TEST_UNIT_READY
219
      
220
      and partially to the commands:
221
      
222
      SENSE_6
223
      VERIFY_10
224
      REVENT_ALLOW_MEDIUM_REMOVAL
225
      
226
      
227
      
228
    
229
  
230
 
231
  
232
  
233
 
234
  
235
   
236
      Example
237
    
238
    
239
      Example
240
      Example for USB Mass Storage like Peripherals
241
      
242
    
243
    
244
      RAM disk
245
      
246
        The "ram disk" is a test application supplied to verify / debug the USB-Mass Storage
247
        package. The minimal functionality of this test case is to create a tiny "ram disk"
248
        device large of around 32 sectors of 512 bytes each. The disk devtab entry
249
        is "/dev/ramdisk0". A FAT12 filesystem is created on top of it
250
        as the first partition of the disk. The partition is therefore accessible from
251
        "/dev/ramdisk0/1". The default behavior of the application is to
252
        start the USB MSD thread. Once plugged into the host machine, an empty drive
253
        called eCos-3.0 shall appear in the host explorer.
254
        To test further, the FAT filesystem package can be included while compiling the test
255
        application. If included, before the MSD driver is started, the application will
256
        create 2 files (fee and foo) and 1 directory (bar) in the filesystem. Both files and
257
        directory shall appear in the host explorer.
258
      
259
      Configuration
260
      
261
        The test application was primarly tested with the AT91 architecture. The control
262
        endpoint is set to "usbs_at91_ep0" and the buffer size
263
        to 8 bytes.
264
        The TX endpoint is set to "usbs_at91_ep1" and the buffer size
265
        to 64 bytes (with Tx (USB IN) endpoint number set to 1).
266
        The RX endpoint is set to "usbs_at91_ep2" and the buffer size
267
        to 64 bytes (with Rx (USB OUT) endpoint number set to 2).
268
      
269
      
270
   
271
  
272
 
273
  
274
275

powered by: WebSVN 2.1.0

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