1. Trang chủ
  2. » Công Nghệ Thông Tin

USB Complete fourth- P23 ppt

10 171 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 360,29 KB

Nội dung

Chapter 7 196 requests the host to send a class-specific Get_Extended_Event_Data request for more information about an event. A device using the bulk-only protocol cancels a transfer by stalling the bulk endpoints. The host then sends a class-specific Get_Device_Status request and uses the Clear Feature request to clear the stalled endpoints. The host cancels a transfer by sending a class-specific Cancel_Request request. A device is ready to resume data transfers when it returns OK (PIMA 15740 Response Code 2001h) in response to a Get_Device_Status request. &GUETKRVQTU In an interface descriptor, bInterfaceClass = 06h to indicate a still-image device, bInterfaceSubclass = 01h to indicate an image interface, and bInterfaceProtocol = 01h to indicate a still-image capture function. The interface must have descriptors for the bulk IN, bulk OUT, and interrupt IN endpoints. %NCUUURGEKHKE4GSWGUVU The class defines four control requests. Cancel_Request requests to cancel the PIMA 15740 transaction named in the request. Get_Extended_Event_Data (optional) requests extended information regarding an event or vendor condi- tion. Device_Reset_Request requests the device to return to the Idle state. The host can use this request after a bulk endpoint has returned a STALL or to clear a vendor-specific condition. Get_Device_Status requests information needed to clear halted endpoints. The host uses this request after a device has canceled a data transfer. %JKRU Just about any non-low-speed USB controller will have the three endpoints required by the still-image class. 9KPFQYU5WRRQTV Recent Windows editions support the Windows Image Acquisition (WIA) API for communicating with devices in the still-image class. Applications communi- cate with devices by using ReadFile, WriteFile, and DeviceIoControl com- mands. The usbscan.sys driver adds USB support to WIA in Windows XP and later. Beginning with Windows XP, cameras that use the Picture Transfer Protocol defined in PIMA 15740 require no vendor-provided driver components, Device Classes 197 though a vendor can provide a minidriver to support vendor-specific features and capabilities. For scanners, the vendor must provide a microdriver, which is a helper DLL that translates between the driver’s communications and a lan- guage the scanner understands, or a minidriver that works with the provided drivers to enable communications with the device. Windows 98 and Windows 2000 use an earlier Still Image architecture (STI). Product vendors must provide a user-mode driver to work with the provided STI driver. 6GUVCPF/GCUWTGOGPV The test-and-measurement class (USBTMC) is suited for instrumentation devices where the data on the bus doesn’t need guaranteed timing. These devices typically contain components such as ADCs, DACs, sensors, and trans- ducers. A device may be a stand-alone unit or a card in a larger computer. Before USB, many test-and-measurement devices used the IEEE-488 parallel interface, also known as the General Purpose Interface Bus (GPIB). The USB488 subclass of the test-and-measurement class defines protocols for com- municating using IEEE 488’s data format and commands. &QEWOGPVCVKQP The class’s specifications include the main Test and Measurement class specifi- cation and a separate document for the USB488 subclass. The IEEE 488 stan- dards are available from www.ieee.org. 1XGTXKGY A test-and-measurement device requires a bulk OUT endpoint and a bulk IN endpoint. An interrupt IN endpoint is required for devices in the USB488 sub- class and otherwise is optional for returning event and status information. The bulk pipes exchange messages consisting of a header followed by data. The bulk OUT endpoint receives command messages, and the bulk IN endpoint sends response messages. The header for a command message contains a mes- sage ID, a bTag value that identifies the transfer, and message-specific informa- tion. The header for a response message contains a message ID and bTag values of the command that prompted the response, followed by message-specific information. Chapter 7 198 &GUETKRVQTU The interface subclass specifies the test-and-measurement function. In the interface descriptor, bInterfaceClass = FEh to indicate an application-specific interface and bInterfaceSubClass = 03h to indicate the test-and-measurement class. There are no class-specific descriptors. %NCUUURGEKHKE4GSWGUVU The class defines eight control requests for controlling and requesting the status of an interface or transfer and requesting information about the interface’s attributes and capabilities. %JKRU Just about any non-low-speed device will have the two or three endpoints this class requires. 9KPFQYU5WRRQTV Windows doesn’t include a driver for this class. National Instruments provides a driver for use with the company’s hardware. Other options for test-and-mea- surement devices that use bulk transfers include the mass-storage class, the WinUSB driver, and vendor-specific drivers. A HID-class device can also per- form test and measurement functions. For an existing device with an IEEE-488 interface, a quick solution is to use a commercial IEEE-488/USB converter. 8KFGQ The video class supports digital camcorders, webcams, and other devices that send, receive, or manipulate transient or moving images. The class also supports transferring still images from video devices. &QEWOGPVCVKQP Multiple documents make up the video specification. The main class specifica- tion defines standard and class-specific descriptors and class-specific control requests for video devices. The video media transport terminal specification defines descriptors and requests for devices such as video cameras and digital VCRs, which stream data stored in sequential media and may require functions such as play, record, rewind, and eject. Separate specifications contain informa- Device Classes 199 tion for MJPEG, MPEG2-TS, and DV formats as well as generic frame-based, stream-based, and uncompressed payloads. Other specification documents include a video camera example, an FAQ, and an Identifiers document that gathers together identifier values defined in the other video-class specifications. 1XGTXKGY Figure 7-3 shows the elements that make up a video function in a USB device. Every function must have a VideoControl interface, which provides informa- tion about inputs, outputs, and other components of the function. Most func- tions also have one or more VideoStreaming interfaces that enable transferring video data. A Video Interface Collection consists of a VideoControl interface and its associated VideoStreaming interfaces. A device can have multiple, inde- pendent VideoControl interfaces and Video Interface Collections. The VideoControl interface uses the control endpoint and may use an interrupt IN endpoint. Each VideoStreaming interface has one isochronous or bulk end- point for video data and an optional bulk endpoint for still-image data. &GUETKRVQTU The video class defines an extensive set of descriptors that enable devices to pro- vide detailed information about the device’s abilities. Each Video Interface Col- Figure 7-3. A video interface consists of a VideoControl interface and zero or more VideoStreaming interfaces. Chapter 7 200 lection must have an interface association descriptor that specifies the interface number of the first VideoControl interface and the number of VideoStreaming interfaces associated with the function. The VideoControl Interface. The VideoControl interface (Figure 7-4) has a standard interface descriptor with bInterfaceClass = 0Eh to indicate the video class. The descriptor’s iInterface field must reference a string descriptor that contains a function name in U.S. English. (Other languages are optional.) A class-specific VideoControl interface descriptor consists of a VideoControl interface header descriptor followed by one or more Terminal and/or Unit descriptors. A Terminal is the starting or ending point for information that flows into or out of a function. A Terminal may represent a USB endpoint or another compo- Figure 7-4. The VideoControl interface provides information about inputs, outputs, and other components of a video function. Device Classes 201 nent such as a CCD sensor, display module, or composite-video input or out- put. A Unit transforms data flowing through a function. A Selector Unit routes a data stream to an output, a Processing Unit controls video attributes, and an Extension Unit performs a vendor-defined function. If the interface has an interrupt endpoint, the endpoint has a standard endpoint descriptor followed by a class-specific endpoint descriptor. The VideoStreaming Interface. Each VideoStreaming interface (Figure 7-5) has a standard interface descriptor. Following this descriptor, an interface with an IN endpoint has a class-specific VideoStreaming Input Header descriptor, and an interface with an OUT endpoint has a class-specific VideoStreaming Output Header descriptor. Figure 7-5. A VideoStreaming interface has an endpoint for video data and an optional endpoint for still-image data. Chapter 7 202 Following the Header descriptor is a Payload Format descriptor for each sup- ported video format. For frame-based formats, the Payload Format descriptor is followed by one or more Video Frame descriptors that describe the dimensions of the video frames and other characteristics specific to a format. Some devices that support still-image capture have a Still Image Frame descriptor. A Payload Format can also have a Color Matching descriptor to describe a color profile. Each VideoStreaming interface has one isochronous or bulk endpoint descrip- tor for video data and an optional bulk endpoint descriptor for still-image data. %NCUUURGEKHKE4GSWGUVU Class-specific control requests enable setting and reading the states of controls in VideoControl and VideoStreaming interfaces. %JKRU Video tends to require a lot of bus bandwidth, so controllers used in video applications are likely to support high speed. Vista Imaging’s ViCAM-III chip contains a USB controller and a programmable digital imaging engine that sup- ports video functions. Cypress Semiconductor has partnered with other compa- nies to offer reference designs that use EZ-USB controllers in various video applications. Video will likely be an early application for SuperSpeed chips. 9KPFQYU5WRRQTV Windows XP SP2 introduced a driver compatible with the video class version 1.0 (usbvideo.sys). Vendors of video-class devices that use the driver don’t need to provide any driver software but can provide a Control or Streaming exten- sion to support vendor-specific functions or features. Applications can access video devices using the DirectShow component of DirectX. DirectX version 9.2 added support for the usbvideo.sys driver. For earlier Windows editions, vendors of video devices must provide a minid- river to specify a format for streaming video, implement device-specific func- tions and properties, and perform bulk transfers if required for video data. The Windows USBCAMD driver manages isochronous data transfers, including synchronizing, starting, and stopping the communications and recovering from errors. The driver communicates with the Windows stream-class driver and with the lower-level USB drivers. Device Classes 203 +ORNGOGPVKPI0QPUVCPFCTF(WPEVKQPU Some devices perform functions that don’t have an obvious match to a USB class. Other functions might fit into a class such as test and measurement or device firmware upgrade, but the lack of a driver in Windows and other operat- ing systems might prompt one to look for a different approach. Many legacy serial- and parallel-port devices perform vendor-specific functions and need to convert to USB. Another function that doesn’t fit a defined class is host-to-host communications. USB is flexible enough to accommodate all of these needs. %JQQUKPIC&TKXGT Class drivers that are suitable for some devices with vendor-defined functions include HID, communications device, and mass storage. HIDs are limited to control and interrupt transfers but can transfer data for any purpose. A virtual COM port in the communications device class can exchange data in bulk trans- fers. Mass storage is an option for devices that transfer data in files if the host and device support the same file system. For standard but unsupported classes such as test and measurement and device firmware upgrade, you might be able to obtain a class driver from a third party. 7UKPIC)GPGTKE&TKXGT A generic driver can be a solution for devices that don’t fit a standard class. Generic drivers typically enable applications to request control, interrupt, bulk, and isochronous transfers using a driver-specific API. Microsoft’s WinUSB driver is an option if the host systems use Windows XP and later and the device doesn’t use isochronous transfers. Chapter 14 has more about WinUSB. Other sources offer generic drivers that have more capabilities and are compatible with earlier Windows editions. Vendors include Andrew Pargeter & Associates, Jungo Ltd., Tetradyne Software, Inc., and Thesycon Sys- temsoftware & Consulting GmbH. Many of these drivers are in toolkits that generate the required INF file and include example application code. As Chap- ter 6 explained, some chip companies also provide generic drivers for use with their chips. Chapter 7 204 %QPXGTVKPIHTQO45 The RS-232 serial port was a feature on the very first PCs and persisted for many years on PCs and peripherals. Just about any device that uses RS-232 can use USB instead. There are several approaches to making the switch. Some RS-232 devices fit into a defined USB class. The communications device class includes modems. The HID class provides usages for pointing devices, uninterruptible power supplies, and point-of-sale devices. For many other devices, FTDI Chip’s FT232R USB UART introduced in Chapter 6 provides a quick way to upgrade a design to USB. The chip can con- vert an existing RS-232 device to USB with minimal design changes and in most cases no changes to host software or device firmware. Figure 7-6 shows an example. A typical device with an RS-232 interface con- tains a UART that converts between the serial data used in RS-232 communi- cations and the parallel data the CPU uses. The signals on the line side of the UART connect to converters that translate between RS-232 voltages and the 5V logic used by the UART. The line side of the converter connects to a cable to the remote computer with an RS-232 interface. To convert from RS-232 to USB, you replace the RS-232 converter with an FT232R. On the host com- puter, FTDI Chip’s Virtual COM port driver enables applications to access the device using the same functions used for RS-232 communications. Many RS-232/USB adapter modules contain little more than an FT232R or similar chip, an RS-232 interface chip, and connectors for RS-232 and USB. An RS-232 device with an external adapter gives users the choice of using USB or RS-232. When using a USB/RS-232 adapter, devices that use the status and control sig- nals in unconventional ways and with critical timing requirements may require modifications to device hardware or firmware or application software. %QPXGTVKPIHTQOVJG2CTCNNGN2QTV Another port that PCs had from the beginning was the parallel port, which many devices besides printers used. For parallel-port printers, adapter modules are available to enable connecting to a PC via USB. Devices with other functions may require redesigning for USB. The device might use the WinUSB driver or a generic or custom driver. The device will need new application software to communicate with the driver. A periph- eral-side parallel-port interface has 8 bidirectional data pins, 5 status outputs, Device Classes 205 and 4 control inputs. Thus a USB controller with 17 I/O bits can emulate a parallel port. The device will need vendor-specific firmware to translate between the USB and parallel-port data, plus a host driver and new application software. 2%VQ2%%QOOWPKECVKQPU With one exception, USB doesn’t allow hosts to exchange data with each other directly. Every USB communication must be between a host and a device. Yet Figure 7-6. FTDI’s FT232R USB UART can convert devices with RS-232 interfaces to USB. A driver provided by FTDI causes the device to appear as a COM-port device to host applications. . devices, FTDI Chip’s FT232R USB UART introduced in Chapter 6 provides a quick way to upgrade a design to USB. The chip can con- vert an existing RS-232 device to USB with minimal design changes. modules are available to enable connecting to a PC via USB. Devices with other functions may require redesigning for USB. The device might use the WinUSB driver or a generic or custom driver. The device. application software. 2%VQ2%%QOOWPKECVKQPU With one exception, USB doesn’t allow hosts to exchange data with each other directly. Every USB communication must be between a host and a device. Yet Figure 7-6. FTDI’s FT232R USB UART can convert

Ngày đăng: 04/07/2014, 07:20

TỪ KHÓA LIÊN QUAN