📄 readme.txt
字号:
**********************************************************************
* Copyright (C) 2001 Texas Instruments, Inc. *
* All Rights Reserved *
* *
* This is a readme file for VC5509 USB Demo Application *
* *
* Created: 03 May 2001 $MH$ *
* *
* Updates: *
* *
* 19 Jul 2001 $MH$ *
* *
* Cleaned up the description of the code execution flow and *
* added description for the isochronous and the Host DMA *
* transfer mode *
* *
**********************************************************************
This demo example is an USB Chapter 9 compliant full speed USB device
which uses two bulk and one interrupt endpoint to move data back and
forth with an USB host. The demo application shows the usage of the
VC5509 USB module support library routines. The example is designed
such a way that the developers can use it as a framework to build their
application on top of it. By replacing the descriptors and adding or
replacing the endpoints, endpoint event handlers, and the USB request
handlers, one can easily create a fully functional custom USB device.
**********************************************************************
* *
* SOURCE FILES *
* *
**********************************************************************
usb_main.c
This is the main routine for 5509 USB demo application. The main routine
initializes the DSP clock, USB API vector pointer, USB PLL, endpoint
objects, and the USB module. Finally, the main routine programs the
DSP interrupt vector pointer registers, enable the USB interrupt, and
connects the USB module to the USB up stream port.
usb_req.c
USB Chapter 9 standard device request handler routines. Users can expand
the USB request handling capabilities by adding new request handler
routines and updating request handler lookup table accordingly.
usb_ctrl.c
Endpoint 0 event handler routine. This routine responds to all USB
bus events, such as RESET, SUSPEND, RESUME, etc, and SETUP packets.
When a SETUP packet received the endpoint 0 event handler parses
through the USB request handler lookup table and calls the appropriate
routine request handler routine which is defined in usb_req.c file.
usb_dscr.c
USB descriptor file. This file shows how to create USB
descriptors using the data structure supported by the USB module
support library. Users can easily create their own descriptor
by adding or modifying the descriptors as required by their
application
vectors.asm
Interrupt vector table for VC5509
**********************************************************************
* *
* Header Files *
* *
**********************************************************************
usb_api.h
Header file for USB module support library routines
usb_const.h
Defines symbolic constants that are used to create USB descriptors,
request handler table, and decode USB Setup packets.
usb_ctrl.h
Header file for usb_ctrl.c
usb_req.h
Header file for usb_req.c
usb_stdinc.h
Redefinition of some standard C data types to make coding easy
**********************************************************************
* *
* OTHER FILES *
* *
**********************************************************************
usb_demo.cmd
------------
Linker command file to build the demo USB application
usb_demo.map
------------
Map file for usb_demo.out
usb_demo.out
------------
Executable file ready to run on the VC5509 platform.
usb_demo.pjt
------------
CCS2.0 project file for USB demo application.
readme.txt
------------
This file
**********************************************************************
* *
* EXECUTION FLOW *
* *
**********************************************************************
Once the USB module is connected to the up stream port following
things happen:
a. The USB host contoller resets the USB module
b. The USB Event Dispatcher broadcast the RESET event to 0-OUT.
2-IN, and 3-IN endpoints by calling the respective endpoint
event handler routines in sequence.
c. In response to the RESET event the USB_ctl_handler() calls
USB_ctl( ) which terminates all endpoint activities and
reconfigures the USB module by call USB_init() API.
d. In response to the RESET event the USB_bulkInEvHandler()
calls the USB_bulkInDatHandler( ) which posts a bulk
transfer via 2-OUT endpoint.
c. In response to the RESET event the USB_endpt3EvHandler()
calls the USB_endpt3DatHandler( ) which posts an interrupt
transfer via 3-IN endpoint.
e. Host sends SETUP packets requesting descriptors for enumeration
purpose.
f. The USB Event Dispatcher broadcast the SETUP event to the
USB_ctl_handler(). The USB_ctl_handler() calls the USB_ctl()
routine. The USB_ctl() parses through the USB request handler
table and calls the appropriate request handler routine to
send the requested descriptor to the host.
g. Host sends multiple SETUP packets to complete the enumeration
process.
h. Host loads the device driver(s) to communicate with USB module.
--------x--------
BULK DATA TRANSFER:
Endpoint 2 IN/OUT are used to demonstrate bulk data transfer.
The example code loops some arbitrary number (max 64) of bytes
of data back to the host(PC) through endpoint 2 IN. Since the
DSP loop back data received from the host, the host must send
the data to DSP first to initiate the bulk data transfer.
HOW IT WORKS:
1. Host application sends some arbitrary number (max 64) of bytes
of data to 2-OUT endpoint.
2. Data moves into the Endpt2Buff[33] and generates a EOT(end of
transfer) event for 2-OUT endpoint.
3. USB Event Dispatcher boardcast the EOT event to USB_bulkOutEvHandler()
which in turn calls USB_bulkOutDatHandler(..).
4. The USB_bulkOutDatHandler(..) loops the received data back to
the host via 2-IN endpoint.
5. Host reads (sends IN token) the data, the data moves out of the
endpoint 2-IN buffer and generates an EOT event for 2-IN endpoint.
6. USB Event Dispatcher boardcast the EOT event to USB_bulkInEvHandler()
which in turn calls USB_bulkInDatHandler(..).
7. The USB_bulkInDatHandler(..) posts a bulk transfer via 2-OUT endpoint.
8. Step 1 through 7 continues as long the host application keeps on
sending and receiving data via 2-OUT and 2-IN endpoint respectively.
------x------
INTERRUPT DATA TRANSFER:
Endpoint 3 IN is used to demonstrate interrupt data transfer.
The example code sends 1 to 16 bytes of data when the host
polls the endpoint 3 IN by sending an IN token. The DSP starts
with sending 1 byte of data when the host polls the endpoint for
the first time. 2 bytes of data sent to host during the second
poll. The number of bytes sent to the host increments sequencially
with each IN token received by the DSP. When the number bytes sent
to the host reaches the maximum limit (16 bytes), the DSP starts
over the sequence by sending 1 byte of data during the next poll
by the host.
HOW IT WORKS:
1. For the interrupt endpoint the host application sends an IN token.
2. Data moves out of the 3-IN endpoint and generates an EOT event.
3. USB Event Dispatcher boardcast the EOT event to USB_endpt3EvHandler()
which in turn calls USB_endpt3DatHandler(..).
4. The USB_endpt3DatHandler(..)posts the next interrupt transfer via
3-IN endpoint.
5. Step 1 through 4 continues as long the host application keeps on
reading data from 3-IN endpoint.
------x------
ISOCHRONOUS DATA TRANSFER:
Endpoint 5 IN is used to demonstrate isochronous data transfer.
The example code sends 2 bytes of data representing the USB frame
number during each isochronous transfer. Pre-start-of-frame interrupt
is used in the example to retrieve the current frame number and send
value to the endpoint 5 IN buffer to make the iso data ready before
the USB module detects a start-of-frame (SOF) signal on the bus.
Note:
In iso mode the dedicated DMA channel associated with the endpoint is
triggered when only when a SOF is detected on the bus. Hence after a
iso transfer is posted by the example software the data is seen on the
bus 1 frames later (during the first SOF the DMA moves the data to the
endpoint buffer, when the second SOF arrives the data waiting in the
endpoint buffer moves out.
HOW IT WORKS:
1. The USB module generates a PSOF interrupt
2. USB Event Dispatcher boardcast the PSOF event to USB_isoInEvHandler()
which in turn calls USB_isoInDatHandler(..).
3. The USB_isoInDatHandler(..)posts an iso transfer of two bytes of data
consists of current USB frame number via 5-IN endpoint.
4. The USB module gets SOF, the DMA channel associated with the endpoint
5 IN moves the data to endpoint buffer allocated in the USB shared RAM
5. The USB module gets the next PSOF, next iso transfer is initiated by
repeating step 2 and 3.
6. The USB module gets the next SOF, the two bytes of data (frame #) in
the endpoint buffer moves out to bus. The DMA fills up the endpoint
buffer with the next two bytes of data for the next transfer that was
initiated in step 5.
7. Step 1 through 6 continues as long the USB module detects SOF signals
on the bus.
------x------
HOST DMA TRANSFER:
Endpoint 4 IN and OUT are used to demonstrate Host DMA transfer.
The example code sets up the endpoints for host DMA mode and waits
for the host to initiate a read or write request.
Note:
In the host DMA mode the endpoints appear as bulk endpoint to a host.
in this mode all transfers are limited to 5 - 64 bytes. The first
5 bytes holds the host dma protocol header and the option 59 byte holds
the raw data. Details on the Host DMA mode and Host DMA protocol header
can be found in the C55x USB peripheral user's guide.
HOW IT WORKS:
Host Write:
1. The host sends a bulk data packet to endpoint 4 OUT. The data packet
moves in the endpoint 4 OUT buffer.
2. The DMA state machine decodes the first 5 bytes of data packet for the
number of bytes of data to be moved and DSP address where the should go
to.
3. The DMA channel associated with the endpint 4 OUT moves the data from
the endpoint buffer to the DSP memory.
Host Read:
1. The host sends a 5 bytes of bulk data packet to endpoint 4 OUT.
The data packet moves in the endpoint 4 OUT buffer.
2. The DMA state machine decodes the 5-byte data packet for the DSP memory
address and the number of bytes (max 59) data to be sent to the host.
3. The DMA channel associated with the endpint 4 IN moves the data from
DSP memory to the endpoint buffer. The first 5 bytes of the enpoint
IN buffer is a copy of the 5-byte protocol header sent by the host.
Rest of the endpoint buffer holds the data bytes moved from the DSP
memory.
===================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -