Host (pci/usb) port. Over view. Host Port Selection. Configuration Spaces. PCI Configuration Space, страница 29

b.  Load the USB Setup Counter Register with the number of bytes to be transmitted

c.  Set the appropriate state of the internal ‘command_complete’ status variable. (If last transfer, ‘command_complete = 1. If more data to transfer, ‘command_complete’ = 0).

5.  Clear the high byte of the USB Control Register.

MCU returns to its idle loop to await the next interrupt from the Endpoint 0 hardware block. Examples in the MCU firmware that support USB commands of this type:

Get Descriptor

Type 4: INS/OUTS with Single Data Stage for Non-Chapter 9 Specific Commands

1.  Read the upper byte of the USB Control Register to determine if this is the first time entering this code segment. Initial entry is indicated by bits ISE, IIN, IOU, and BY set to a 1.

2.  Determine if the access is to MCU space versus DSP space by interrogating the MSB.

3.  USB Setup Token Command Register Byte 3 (1 = MCU, 0 = DSP).

4.  If MCU space, convert bytes 2 and 3 of the USB Setup Token Command Register into the proper MCU address. If DSP space, load bytes 2 and 3 directly into the USB Register I/O Address Register.

5.  Determine if the access is an OUT or IN by interrogating byte 0 of the USB Setup Token Command Register.

6.  If Read from MCU space (an IN transaction):

a.  Load the appropriate data to be transmitted into the USB Setup Token Data Register.

b.  Load the USB Setup Counter Register with the number of bytes to be transmitted.

c.  Set ‘command_complete’ status variable = 1.

d.  Clear the high byte of the USB Control Register.

e.  Return to the MCU idle loop

7.  If Read from DSP space (an IN transaction):

a.  Set bit 15 = 1 and bit 14 = 0 of USB Register I/O Address Reg-ister to start the read cycle.

b.  Poll bit 15 of the USB Register I/O Address Register until a value of 0 returns, indicating that the read cycle is complete.

c.  Load the USB Setup Token Data Register with the data returned in the USB Register I/O Data Register.

d.  Load USB Setup Counter Register with the number of bytes to be transmitted.

e.  Set ‘command_complete’ status variable = 1.

f.  Clear the high byte of the USB Control Register.

g.  Return to the MCU idle loop

8.  If Write to MCU space (an OUT transaction):

a.  Load the appropriate register with the data from the USB Setup Token Data Register.

b.  Clear the USB Setup Counter Register

c.  Clear its internal ‘command_complete’ status variable.

d.  Clear the high byte of the USB Control Register

e.  Return to the MCU idle loop.

9.  If Write to DSP space (an OUT transaction):

a.  Load the USB Register I/O Data Register with the data from the USB Setup Token Data Register.

b.  Set bit 15 = 1 and bit 14 = 1 of USB Register I/O Address Reg-ister to start the write cycle.

c.  Poll bit 15 of the USB Register I/O Address Register until a value of 0 returns indicating that the write cycle is complete.

d.  Clear the USB Setup Counter Register

e.  Clear its internal ‘command_complete’ status variable.

f.  Clear the high byte of the USB Control Register

g.  Return to the MCU idle loop.

The vendor specific command USB REGIO is the MCU firmware command that uses the above model. Use it for all non-Chapter 9 specific requests that involve hardware accesses to either MCU space or DSP space in which there is a single data stage.

Type 5: MCU Firmware Download (Variable Length OUT)

1.  Read the upper byte of the USB Control Register to determine if this is the first time entering this code segment. Initial entry is indicated by bits ISE, IIN, IOU, and BY set to a 1.

2.  If initial entry (processing the SETUP Token):