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

a.  Read the USB Setup Token Command Register bytes 6 and 7 to determine the total length of the code that is to be downloaded.

b.  Read the USB Setup Token Command Register bytes 2 and 3 to determine the starting address in PM memory space to place the code.

c.  Clear the USB Setup Counter Register.

d.  Clear the high byte of the USB Control Register

e.  Return to the MCU idle loop to await the next interrupt from the Endpoint 0 hardware block, which indicates the data has arrived from the host.

3.  If not initial entry (processing the data from the OUT transaction):

a.  Read the USB Setup Counter Register to determine how many bytes arrived. (# of bytes transferred = 14 – count value. See USB Setup Counter Register description).

b.  Read the proper number of bytes from the USB Setup Token Data Register and write them to MCU PM RAM.

c.  Determine if the host is trying to send more bytes in the Data

Stage than what was told the MCU during the SETUP stage (Length bytes 6 and 7 of the USB Setup Token Command Register).

d.  If true, instruct the Endpoint 0 block to send STALL condition:

(1.)  Clear the USB SETUP Counter Register

(2.)  Set ER bit in the USB Control Register

(3.)  Return to the MCU idle loop

e.  If not true, determine if additional data stages are needed.

If more data stages are expected:

(1.)  Clear USB Setup Counter Register.

(2.)  Clear the high byte of USB Control Register

(3.)  Return to the MCU idle loop to await the next interrupt from the Endpoint 0 hardware block, which indicates more data has arrived.

If this is the final data stage:

(1.)  Clear the USB Setup Counter Register

(2.)  Clear its internal ‘command_complete’ status variable.

(3.)  Clear the high byte of the USB Control Register (4.) Return to the MCU idle loop.

This is the structure found in the function called ‘usb_mcucode’ in the

MCU ROM firmware.

Ex a m p le Initia liza tion Proc e ss

After attachment to the USB bus, the ADSP-2192 identifies itself as a CONFIG device with 1 Endpoint: one control EP0. This causes a generic user CONFIG driver to load.

The CONFIG driver downloads appropriate MCU code to set up the MCU. This code includes the specific device descriptors, interfaces, and Endpoints.

The external Serial EEPROM is read by the DSP, and the changeable USB descriptive fields are transferred to the MCU. The CONFIG driver, through the control EP0 pipe, generates a register read to determine the configuration value. Based on this configuration code, the host downloads the proper USB configurations to the MCU.

The driver writes the USB Control Register, which causes the device to disconnect and then reconnect so that the new downloaded configuration is enumerated by the system. Each interface, upon enumeration, loads the appropriate user device driver.

An example of this procedure is configuring the ADSP-2192 to be a modem.

1.  The ADSP-2192 is attached to USB bus. System enumerates the CONFIG device in the ADSP-2192 first. A user-specific driver is loaded.

2.  The user driver reads the device descriptor, which identifies the card as a user-specific device, such as a modem.

3.  The user driver downloads USB configuration and MCU code to the MCU for Interface 1, which is the modem. Configuration specifies which Endpoints are used and their definitions. A typical configuration for a modem would be:

Table 8-40. Typical Configuration (Modem)

Endpoint

Type

Maximum

Packet Size

Comment

1

BULK OUT

64

DSP CODE

4

BULK IN

64

MODEM RCV

5

BULK OUT

64

MODEM XMT

6

INT IN

16

STATUS