Motorola USB08 Reference Manual

Universal serial bus evaluation board using the mc68hc908jb8.
Hide thumbs
DRM002/D
USB08 Universal Serial Bus
Evaluation Board
Using the MC68HC908JB8
Designer Reference Manual

   Summary of Contents for Motorola USB08

  • Page 1

    DRM002/D USB08 Universal Serial Bus Evaluation Board Using the MC68HC908JB8 Designer Reference Manual...

  • Page 2

    blank...

  • Page 3

    USB08 Universal Serial Bus Evaluation Board Using the MC68HC908JB8 By: Dipl.-Ing. Oliver Thamm Motorola and are registered trademarks of Motorola, Inc. DigitalDNA is a trademark of Motorola, Inc. USB08 Evaluation Board MOTOROLA MCT Elektronikladen GbR Hohe Str. 9-13 04107 Leipzig...

  • Page 4

    Motorola product could create a situation where personal injury or death may occur. Should Buyer purchase or use...

  • Page 5: Table Of Contents

    Designer Reference Manual — USB08 Evaluation Board Section 1. USB08 Quick Start ..... 17 Section 2. Hardware Description ....27 Section 3.

  • Page 6

    List of Sections Designer Reference Manual USB08 Evaluation Board List of Sections MOTOROLA...

  • Page 7: Table Of Contents

    MC68HC908JB8 Microcontroller ..... 28 USB08 Evaluation Board ......29 Circuit Description.

  • Page 8: Table Of Contents

    Introduction ........59 Characteristics of the USB08 Reference Design ... 60 USB Basics.

  • Page 9: Table Of Contents

    Supported Standard Device Requests ....81 Appendix B. USB08 Descriptors Contents ......... . 83 Introduction .

  • Page 10: Table Of Contents

    CRTSJB8.S ........120 USB08.LKF ........121 BUILD.BAT .

  • Page 11: Table Of Contents

    E.7.1.13 E.7.1.14 E.7.1.15 USB08 Evaluation Board MOTOROLA Device State Change Notifications ....148 Programming Interface ......149 Programming Interface Overview.

  • Page 12: Table Of Contents

    Registry Entries ........239 Table of Contents USB08 Evaluation Board MOTOROLA...

  • Page 13: Table Of Contents

    Driver Entry for USB08 in the Device Manager Window ..25 USB08 Evaluation Board ......30 PCB Component Side Layout Plan.

  • Page 14

    Title USB08 Evaluation Board Schematic ....129 USB Driver Stack ........138 USBIO Device and Pipe Objects Example .

  • Page 15: Table Of Contents

    MC68HC908JB8 Endpoint Configuration ....66 Bill of Materials for USB08 V 1.01 ..... 128 I/O Operations Supported by the USBIO Device Driver .

  • Page 16

    List of Tables Designer Reference Manual USB08 Evaluation Board List of Tables MOTOROLA...

  • Page 17: Section 1. Usb08 Quick Start, Contents, Introduction, Required System Configuration

    (universal serial bus) evaluation board demo application. The main component of the USB08 is the Motorola MC68HC908JB8 8-bit microcontroller (MCU). 1.3 Required System Configuration To connect the USB08, you will need a personal computer (PC) with one of the following Microsoft • •...

  • Page 18: Connecting The Demo Board To The Pc, Demo Board Connected To The Usb Hub

    USB cable is fixed on the USB08 board (downstream direction). In the upstream direction (PC/host side), the USB connections are always type A. Therefore, the cable of the USB08 demo board has a type A plug. The connection of the demo board is made directly to the USB socket of the PC or, as shown in the The board supply current can be delivered by the USB connection.

  • Page 19: Driver Installation, Found New Hardware Screen

    After the electrical connection of the demo board, the Windows operating system recognizes the presence of a new hardware component and shows the message Found New Hardware. USB08 Evaluation Board MOTOROLA Figure 1-2. Found New Hardware Screen USB08 Quick Start...

  • Page 20: Found New Hardware Wizard Start Screen

    USB08 Quick Start The hardware assistant, information for the USB08 evaluation board. Click the Next button. NOTE: The installation using the Windows 2000 operating system requires administrator rights. Designer Reference Manual Figure 1-3, now tries to find the suitable driver Figure 1-3.

  • Page 21: Locate Driver Files Screen

    Insert the USB08 product CD into the CD-ROM drive and mark the appropriate check box CD-ROM drives as shown in the Next button. USB08 Evaluation Board MOTOROLA Figure 1-4. Locate Driver Files Screen USB08 Quick Start USB08 Quick Start Driver Installation Figure 1-4.

  • Page 22: Driver Files Search Results Screen

    USB08 Quick Start As shown in information file usbio_el.inf in the root directory of the CD ROM. Confirm this selection by clicking Next. Designer Reference Manual Figure 1-5, the hardware assistant will find the driver Figure 1-5. Driver Files Search Results Screen...

  • Page 23: Found New Hardware Wizard Finish Screen

    USB device will be ready for use. NOTE: The installation does not require a restart of the computer, since this is a true Plug & Play installation. USB08 Evaluation Board MOTOROLA (Figure 1-6), the driver installation will be completed and the Figure 1-6.

  • Page 24: Starting The Windows Demo Application, Windows Demo Application Io08usb

    USB08 demo board. The LED symbols on the left upper side of the application window can be switched on or off by pressing the keys of the USB08 demo board. Designer Reference Manual...

  • Page 25: Driver Entry For Usb08 In The Device Manager Window

    (start button/settings/control panel/ system/device manager). The catalog entry USBIO controlled devices and the device entry USB08 Evaluation Board are visible only if the hardware is present. See Figure 1-8. Driver Entry for USB08 in the Device Manager Window...

  • Page 26

    USB08 Quick Start The Windows demo application, IO08USB.EXE, must be re-started in the case of a hardware connection interrupt. This is because an automatic resynchronization (though it would be possible) was not implemented here. The demo application is arranged as simply and as understandable as possible.

  • Page 27: Section 2. Hardware Description, Contents, Introduction

    MC68HC908JB8 Microcontroller ..... 28 USB08 Evaluation Board ......29 Circuit Description.

  • Page 28: Technical Data, Mc68hc908jb8 Microcontroller

    Hardware Description Beyond that, the USB08 enables the implementation and testing of its own M68HC08 software for evaluation purposes. For that purpose, the board contains a monitor mode interface for reprogramming and debugging. The monitor mode interface of the USB08 is compatible with Motorola development tools such as the M68ICS08JB8 and other third-party tools.

  • Page 29: Usb08 Evaluation Board

    2.3.2 USB08 Evaluation Board Features of the USB08 evaluation board include: • • • • • • • • • • • The USB08 evaluation board is shown in USB08 Evaluation Board MOTOROLA M68HC908JB8 MCU packaged in a 28-pin small-outline...

  • Page 30: Circuit Description, Usb08 Evaluation Board

    Hardware Description 2.4 Circuit Description A schematic of the USB08 demo board is provided in of Materials and external elements. A wide range of peripheral functions including the USB module and an 8-Kbyte FLASH memory are integrated on-chip. The MC68HC908JB8 is offered in several packages. For the USB08...

  • Page 31: Mcu Core Circuit And Usb Interface

    L1 and L2 are used. However, these measures are optional. The reset system of the M68HC08 shows clear differences from other Motorola MCUs (M68HC11 and M68HC12). For example, the capacitor C19 at the reset pin of this circuit could never be used in an M68HC11 system.

  • Page 32: Input/output Functions

    (ADC). The ADC implementation is described in detail in as in the application note entitled Simple A/D for MCUs without Built-in A/D Converters, Motorola document order number AN477/D. This application note can be found on the World Wide Web at: http://www.motorola.com/semiconductors/ The software ADC senses the resistance of: •...

  • Page 33: Monitor Mode Interface, Port A Monitor Mode Entry Levels

    7–10 V to the IRQ pin of the MCU. This voltage is generated by the RS232 transceiver’s (IC2) charge pump and limited to 8.2 V using the breakdown diode D7. JP1-A USB08 Evaluation Board MOTOROLA Table 2-1. Port A Monitor Mode Entry Levels...

  • Page 34: Monitor Mode Cable Pin Configuration

    A sub-D9 connector (crimping connection) on the PC side Table 2-2. Table 2-2. Monitor Mode Cable Pin Configuration X2 Pin USB08 Monitor T1OUT R1IN (3.3 V); however, the transceiver IC2 works with V Hardware Description PC RS232 Sub-D 9 Pin (5 V). The USB08 Evaluation Board MOTOROLA...

  • Page 35: User Rs232 Port

    USB08 board represents the device side. The reverse case happens, if a serial liquid crystal display (LCD) is to be operated at the user RS232 port. In this configuration, the USB08 board is the host and the LCD module represents the device side. The necessary RxD/TxD crossing is done by configuration of the bridges BR1 and BR2 in positions 2 and 3.

  • Page 36: Power Supply, Board Layout

    Hardware Description 2.4.5 Power Supply Power can be supplied to the USB08 board by using the USB or via the voltage regulator IC3. The change between these options is done by replacing the jumper JP2. If the jumper is placed in position 2–3 (Bus Powered), the operating power is supplied by V USB.

  • Page 37: Pcb Component Side Layout Plan, Detailed Layout Plan

    Hardware Description Board Layout Figure 2-2. PCB Component Side Layout Plan Figure 2-3. Detailed Layout Plan USB08 Evaluation Board Designer Reference Manual MOTOROLA Hardware Description...

  • Page 38: Jumpers And Bridges, Jumper Configuration

    PTC0 can be used without restriction. Closed* PTC0 serves as transmission line for the user RS232. Self-powered: power supply via voltage regulator 2-3* Bus-powered: power supply via USB 2-4. Table 2-4 shows the solder bridges configuration. Hardware Description Table 2-3. Function USB08 Evaluation Board MOTOROLA...

  • Page 39: Solder Bridges Configuration

    Solder Bridge and BR2 1. * = delivery status USB08 Evaluation Board MOTOROLA Figure 2-4. Solder Bridge Placement on Downside of the PCB Table 2-4. Solder Bridges Configuration Position 1-2* User RS232 configured in external device mode (PC) User RS232 configured in host mode (LCD connection) is not present at user RS232 port (standard).

  • Page 40

    PTD4 PTD5 PTD6 PTE3 PTE4 PTC0 2.7.2 Monitor Mode Connector X2 PC_RxD PC_TxD Designer Reference Manual PTA0 PTA1 PTA2 PTA3 PTA4 PTA5 PTA6 PTA7 PTE0 PTE1 PTE2 N.C. N.C. N.C. N.C. N.C. N.C. N.C. Hardware Description USB08 Evaluation Board MOTOROLA...

  • Page 41: Mc68hc908jb8 Memory Map, Memory Map

    0x0140 0xDC00 0xFC00 0xFFE0 For a detailed description of the MC68HC908JB8 memory map, in particular the addresses of control registers and interrupt vectors, refer to the MC68HC908JB8 Technical Data, Motorola document order number MC68HC908JB8/D. USB08 Evaluation Board MOTOROLA N.C. N.C.

  • Page 42

    Hardware Description Designer Reference Manual USB08 Evaluation Board Hardware Description MOTOROLA...

  • Page 43: Section 3. Software Module Descriptions

    3.13 3.2 Introduction This section describes the structure and interaction of the software modules. These software modules, running on the Motorola microcontroller MC68HC908JB8, form the firmware of the USB08 reference design. USB08 Evaluation Board MOTOROLA Section 3. Software Module Descriptions Introduction .

  • Page 44: General Structure Of The M68hc08 Firmware

    C startup code is required. U08232.C is merged. U08USB.C is also translated at the same time. It contains the static there is a corresponding header file (* H) with the same base Software Module Descriptions U08USB.C is used, the file USB08 Evaluation Board MOTOROLA...

  • Page 45: Structure And Dependencies Of The Firmware Files, How To Build The Compiler Project

    U08LED.H LED Functions U08ADC.H Soft ADC Module Figure 3-1. Structure and Dependencies of the Firmware Files USB08 Evaluation Board MOTOROLA shows the structure and interaction of the modules and files A list of source modules to be complied Translation options...

  • Page 46

    This batch file can be invoked under the MS-DOS to translate and link USB08 firmware components. The result of this process is a S-record file named USB08.S19, which can be loaded into the FLASH memory of the MC68HC908JB8. Another important file for controlling the translation is the linker file USB08.LKF:...

  • Page 47: Memory Utilization

    0x0076 0x0118 0xDC00 0xE300 0xFFF0 USB08 Evaluation Board MOTOROLA The starting addresses of the various segments are set. The text segment starts at the address 0xDC00 (for example, at the beginning of the internal FLASH memory). The constants immediately follow the text segment.

  • Page 48: Main Module U08main.c

    RS232) is renamed by a macro to getPipe(). If the USB version is active, getPipe() is mapped to getUSB(). initPipe() — communication module (RS232 or USB) initLED() — LED readouts initKey() — keyboard entry initSADC() — software analog-to-digital converter (ADC) Software Module Descriptions USB08 Evaluation Board MOTOROLA...

  • Page 49: Interrupt And Reset Vector Module Vecjb8.c

    MC68HC908JB8 uses eight (7 + 1) vectors. The last, highest position (address 0xFFFE/0xFFFF) is used by the reset vector. In the USB08 reference design, the key pad interrupts of the input/output (I/O) port A are used as well as the USB interrupts in case the USB implementation was activated.

  • Page 50: C Startup Module Crtsjb8.s, Push Button Module U08key.c

    MC68HC908JB8 keyboard interrupt module (KBI). The USB08 evaluation board uses three single keys which are connected to port lines PTA[4:6]. The switch noise reduction is performed via a resistor-capacitor (RC) combination at each key. This combination is made by: •...

  • Page 51

    KEY_MASK=0x02; KEY_MASK=0x80; KEY_MASK=0x70; KEY_MASK=0xF0; KEY_MASK=0xFF; The port bits included in the key scan have to follow one after another. USB08 Evaluation Board MOTOROLA KEY_FIRST=0; / / one key at PTA[0 ] KEY_FIRST=1; / / onea key at PTA[1 ] KEY_FIRST=7;...

  • Page 52: Measurement Of Resistor Values Using A Digital Input, Led Control With U08led.h

    The working principle is shown in Figure 3-2. Measurement of Resistor Values Using a Digital Input Designer Reference Manual Software Module Descriptions Figure 3-2. USB08 Evaluation Board MOTOROLA...

  • Page 53

    The result can be calculated using the relationship: The range of values of the result is between 0 and 1, if R1max = R0. The software ADC module of the USB08 application serves three A/D channels (see threshold voltage is sensed via the port pins PTE[0..2]. The switch function for charging/discharging the capacitor is realized by switching the port pins as outputs.

  • Page 54: Rs232 Communication Module U08232.c

    A detailed discussion of the software A/D converter used here is contained in the application note entitled Simple A/D for MCUs without Built-in A/D Converters, Motorola document order number AN477/D. This application note can be found on the World Wide Web at: http://www.motorola.com/semiconductors/...

  • Page 55

    It has to be taken into account that the bit rate production is determined by a certain number of execution cycles by the central processor unit (CPU), which temporarily USB08 Evaluation Board MOTOROLA initSSCI() — initialization of the software SCI module getSSCI() —...

  • Page 56: Usb Communication Module U08usb.c

    PC over an USB connection. This module can be linked (alternatively to the RS232 communication module U08232.C) into the USB08 application when the macro USE_USB_PIPE in the main module Just like RS232, the USB uses serial streams for the data communication.

  • Page 57: Compiler Specific Adjustments

    Cosmic C Compiler. This compiler supports the complete language scope available for ANSI-C. The porting of the firmware to another M68HC08 ANSI-C compiler should be possible without any problems, USB08 Evaluation Board MOTOROLA Filling of the receive buffer Sending of the characters in the send buffer via the USB Interface.

  • Page 58

    For example, the Cosmic C Compiler uses the modification @interrupt: @interrupt void interrupt_handler(); Other compilers use “#pragma” instructions to mark interrupt functions. Designer Reference Manual U08232.C Software Module Descriptions U08ADC.C also contain USB08 Evaluation Board MOTOROLA...

  • Page 59: Section 4. Universal Serial Bus (usb) Interface

    Introduction ........59 Characteristics of the USB08 Reference Design ... 60 USB Basics.

  • Page 60: Characteristics Of The Usb08 Reference Design

    4.3 Characteristics of the USB08 Reference Design The USB08 reference design shows, via a detailed example, how the integrated USB module of the Motorola microcontroller unit (MCU) MC68HC908JB8 can be used. The MCU is used for a measuring and control application and exchanges data with a PC via the USB.

  • Page 61

    USB devices and two or three commercial hubs. This reference design contains USB08 evaluation board firmware; therefore, this Plug & Play demo application can be evaluated immediately. Beyond that, all source code is provided in the form of C modules for the M68HC08 Cosmic C compiler.

  • Page 62: Low-speed Usb Packet Types, Usb Basics

    Transfers 0 to 8 data bytes Data As before (toggle Data0/1) Handshake Information was accepted Handshake Busy — send again later Handshake Information was incorrect Universal Serial Bus (USB) Interface Function Table 4-1, the bus traffic consists of USB08 Evaluation Board MOTOROLA...

  • Page 63

    STALL packet. SETUP Transaction OUT Transaction Regarding IN transactions, the data packet is sent by the device and the host closes the transaction with a handshake packet. IN Transaction USB08 Evaluation Board MOTOROLA Host Host SETUP (ADDR,EP) DATA0 (D1..D8)

  • Page 64

    In the status stage, empty DATA1 packets are sent. Designer Reference Manual Host Device IN (ADDR,EP) Setup Stage Status Stage SETUP,DATA0,ACK IN,DATA1,ACK Setup Stage Data Stage SETUP,DATA0,ACK IN,DATA1,ACK (...) Universal Serial Bus (USB) Interface Status Stage OUT,DATA1,ACK USB08 Evaluation Board MOTOROLA...

  • Page 65: Usb Implementation In The Reference Design, Activation Of The Usb Module, Endpoint Configuration

    For this, the macro USB_IPUE must be defined as 1. Alternatively, it is possible to add an external resistor on the USB08 evaluation board (see 4.5.2 Endpoint Configuration The integrated USB module of the MCHC908JB8 supports three endpoints.

  • Page 66: Usb Control Register 3 (ucr3), Mc68hc908jb8 Endpoint Configuration

    TX1ST OSTALL0 ISTALL0 TX1STR = Unimplemented Figure 4-2. USB Control Register 3 (UCR3) Universal Serial Bus (USB) Interface Function Device configuration Data transfer to the host Data transfer to the device PULLEN ENABLE2 ENABLE1 USB08 Evaluation Board MOTOROLA Bit 0...

  • Page 67: Usb Reset

    In addition, the end-of-packet interrupt will be enabled with EOPIE (suspend handling). USB08 Evaluation Board MOTOROLA USB Implementation in the Reference Design VECJB8.C). In the reference design, it points to...

  • Page 68: Usb Interrupt Register 0 (uir0), Usb Control Register 0 (ucr0)

    Figure 4-3. USB Interrupt Register 0 (UIR0) Bit 7 TOSEQ TX0E RX0E = Unimplemented Figure 4-4. USB Control Register 0 (UCR0) Universal Serial Bus (USB) Interface Bit 0 TXD1IE TXD0IE RXD0IE Bit 0 TP0SIZ3 TP0SIZ2 TP0SIZ1 TP0SIZ0 USB08 Evaluation Board MOTOROLA...

  • Page 69: Device Management With Endpoint 0, Enumeration, Assignment Of The Device Address

    1 (UIR1). Read: Write: Reset: Since a receive interrupt could be initiated by an OUT packet for the endpoint EP0, it must be determined whether the received information USB08 Evaluation Board MOTOROLA Bit 7 EOPF RSTF TXD2F RXD2F = Unimplemented Figure 4-5.

  • Page 70: Usb Status Register 0 (usr0)

    // Standard Request Code iword wValue; // Value Field iword wIndex; // Index or Offset Field iword wLength; // No. of Bytes to transfer (Data Stage) } setup_buffer; Universal Serial Bus (USB) Interface RP0SIZ3 RP0SIZ2 RP0SIZ1 RP0SIZ0 USB08 Evaluation Board MOTOROLA Bit 0...

  • Page 71: Usb Control Register 0 (ucr0)

    The device address is still located in the SetupBuffer. The service routine isrUSB() is again activated by a transmit interrupt for EP0. After decoding, if it was determined that the cause of the interrupt was an IN USB08 Evaluation Board MOTOROLA Bit 7...

  • Page 72: Requesting Descriptors, Usb Address Register (uaddr)

    SET_ADDRESS, described above. Designer Reference Manual Bit 7 USBEN UADD6 UADD5 UADD4 = Unimplemented Figure 4-8. USB Address Register (UADDR) Universal Serial Bus (USB) Interface Bit 0 UADD3 UADD2 UADD1 UADD0 USB08 Evaluation Board MOTOROLA...

  • Page 73

    The interchanging between DATA0 and DATA1 packets is called a data toggle and serves for error protection. Detailed information about the descriptors used in the reference design are contained in USB08 Evaluation Board MOTOROLA Appendix B. USB08 Universal Serial Bus (USB) Interface...

  • Page 74: Device Configuration, Stall Condition

    SetupBuffer. If this field is larger than zero, the USB08 is ready to be put into operation. For this purpose, the transmitter of endpoint 1 and the receiver of endpoint 2 will be enabled and the internal status of the device changed to CONFIGURED.

  • Page 75: Data Communication Via Endpoints Ep1 And Ep2, Usb Interrupt Register 1 (uir1)

    1. If RXD2F is set, an endpoint 2 receive interrupt is pending. Read: Write: Reset: USB08 Evaluation Board MOTOROLA Data Communication via Endpoints EP1 and EP2 Hands over the code for the endpoint concerned (0 81 for EP1, 0 02 for EP2) to wIndex...

  • Page 76: Receiving Data, Transmission Of Data, Usb Status Register 1 (usr1)

    10 ms. That means, Designer Reference Manual Bit 7 R2SEQ TXACK TXNAK TXSTL = Unimplemented Figure 4-10. USB Status Register 1 (USR1) Universal Serial Bus (USB) Interface Bit 0 RP2SIZ3 RP2SIZ2 RP2SIZ1 RP2SIZ0 U = Unaffected USB08 Evaluation Board MOTOROLA...

  • Page 77: Usb Control Register 1 (ucr1)

    Then, the endpoint answers a polling only with a NAK packet and does not occupy any additional bandwidth by sending an empty data packet. USB08 Evaluation Board MOTOROLA Data Communication via Endpoints EP1 and EP2...

  • Page 78: Host Interaction: Vendor Id And Product Id, Windows Device Driver

    1. The vendor ID (VID) marks the manufacturer. Normally, vendor 2. The product ID is (just like the VID) a 16-bit number. The PID The USB08 reference design uses the registered vendor ID of the manufacturer MCT Elektronikladen, which is 0x0C70. The product ID for the demo application is 0x0000.

  • Page 79

    1. First, the complexity of the USB handling increases, particularly on 2. Secondly and by far more devastating, is the circumstance that USB08 Evaluation Board MOTOROLA the firmware side. There are additional procedures, protocols, and descriptors to implement. Definitions of these additions are not a...

  • Page 80

    Universal Serial Bus (USB) Interface The USB08 reference design uses a third possibility, the universal USB device driver (USBIO) from the company Thesycon. This third-party USB driver is professionally maintained and updated as soon as new operating system conditions occur. The USBIO driver is used for the USB08 reference design as a free-of-charge adapted "Light EL"...

  • Page 81: Device Requests, Supported Standard Device Requests, Appendix A. Supported Standard

    Designer Reference Manual — USB08 Evaluation Board Appendix A. Supported Standard Device Requests Definition of the supported standard device requests are given here. SET_ADDRESS GET_DESCRIPTOR SET_CONFIGURATION CLEAR_FEATURE USB08 Evaluation Board MOTOROLA Standard Device Request Supported Standard Device Requests Supported Options...

  • Page 82

    Supported Standard Device Requests Designer Reference Manual USB08 Evaluation Board Supported Standard Device Requests MOTOROLA...

  • Page 83: Appendix B. Usb08 Descriptors, B.1 Contents, B.2 Introduction

    Designer Reference Manual — USB08 Evaluation Board B.1 Contents B.2 Introduction This appendix defines the USB08 descriptors. USB08 Evaluation Board MOTOROLA Appendix B. USB08 Descriptors Introduction ........83 Device Descriptor .

  • Page 84: B.3 Device Descriptor, B.4 Configuration Descriptor

    // No of Interfaces supported by this Conf // Designator Value for *this* Configuration // Index of String Desc for this Conf 0xc0, // Self-powered, no Remote-Wakeup // Max. Power Consumption in this Conf (*2mA) }; // end of ConfigDesc USB08 Descriptors USB08 Evaluation Board MOTOROLA...

  • Page 85: B.5 Interface Descriptor, B.6 Endpoint 1 Descriptor, B.7 Endpoint 2 Descriptor

    B.5 Interface Descriptor const interface_descriptor InterfaceDesc = B.6 Endpoint 1 Descriptor const endpoint_descriptor Endpoint1Desc = B.7 Endpoint 2 Descriptor const endpoint_descriptor Endpoint2Desc = USB08 Evaluation Board MOTOROLA // Size of this Descriptor in Bytes sizeof(interface_descriptor), DT_INTERFACE, // Descriptor Type (=4) // Number of *this* Interface (0..)

  • Page 86: B.8 String Descriptors

    ’T’, 0, ’ ’, 0, ’E’, 0, ’l’, 0, ’e’, 0, ’k’, 0, ’t’, 0, ’r’, 0, ’o’, 0, ’n’, 0, ’i’, 0, ’k’, 0, ’l’, 0, ’a’, 0, ’d’, 0, ’e’, 0, ’n’, 0 USB08 Descriptors USB08 Evaluation Board MOTOROLA...

  • Page 87

    // Product String //----------------------------------------------- #define SD2LEN sizeof("USB08 Evaluation Board")*2 //----------------------------------------------- const uchar String2Desc[SD2LEN] = { // Table of String Descriptors uchar * const StringDescTable[] = { USB08 Evaluation Board MOTOROLA // Size, Type SD2LEN, DT_STRING, // Unicode String ’U’, 0, ’S’, 0,...

  • Page 88

    USB08 Descriptors Designer Reference Manual USB08 Evaluation Board USB08 Descriptors MOTOROLA...

  • Page 89: Appendix C. Source Code Files, C.1 Contents

    USB08.MAP ........

  • Page 90: Hc908jb8.h

    _P(0x09) _P(0x0A) _P(0x0C) _P(0x0D) _P(0x0E) _P(0x0F) _P(0x10) _P(0x11) _P(0x12) _P(0x13) _P(0x14) _P(0x15) _P(0x16) _P(0x17) _P(0x18) _P(0x19) _P(0x1A) _P(0x1B) _P(0x1C) _P(0x1D) _P(0x1E) _P(0x1F) _P(0x20) _P(0x21) _P(0x22) _P(0x23) _P(0x24) _P(0x25) _P(0x26) _P(0x27) _P(0x28) _P(0x29) _P(0x2A) Source Code Files USB08 Evaluation Board MOTOROLA...

  • Page 91

    // Bits in UIR2: #define BM_EOPFR 0x80 //#define BM_RSTFR 0x40 #define BM_RXD2FR 0x10 #define BM_TXD1FR 0x08 #define BM_TXD0FR 0x02 #define BM_RXD0FR 0x01 // Bits in UCR0: USB08 Evaluation Board MOTOROLA _P(0x2B) _P(0x2C) _P(0x2D) _P(0x2E) _P(0x2F) _P(0x30) _P(0x31) _P(0x32) _P(0x33) _P(0x34) _P(0x35) _P(0x36)

  • Page 92

    // EP2 Enable // EP1 Enable // EP0 Rx Sequence Bit (DATA0/1) // Setup Token Detect Bit // EP0 Rx Data Packet Size // EP2 Rx Sequence Bit (DATA0/1) // EP2 Rx Data Packet Size Source Code Files USB08 Evaluation Board MOTOROLA...

  • Page 93: U08usb.h

    U08USB.H //============================================================================ // File: U08_USB.H // Func: Definitions for USB Data Types & Constants Header File for USB08 Demo Application // Auth: (C)2000 by MCT Elektronikladen GbR, Oliver Thamm http://www.elektronikladen.de/mct // Rem.: View/Edit this File with TAB-Size=4 //============================================================================ //-- Data Type Definitions --------------------------------------------------- typedef struct { uchar lo;...

  • Page 94

    // Characteristics (Direction,Type,Recipient) // Standard Request Code // Value Field // Index or Offset Field // Number of Bytes to transfer (Data Stage) 0x00 // (not used here) 0x01 0x02 0x03 0x04 0x80 Source Code Files USB08 Evaluation Board MOTOROLA...

  • Page 95

    #define DT_DEVICE #define DT_CONFIGURATION #define DT_STRING #define DT_INTERFACE #define DT_ENDPOINT //---------------------------------------------------------------------------- // Function Prototypes void initUSB(); uchar getUSB(); void putUSB(uchar c); @interrupt void isrUSB(); //============================================================================ USB08 Evaluation Board MOTOROLA 0x00 0x01 0x03 0x05 0x06 0x07 // optional 0x08 0x09 0x0a...

  • Page 96: U08232.h, U08led.h

    Source Code Files U08232.H //============================================================================ // File: U08_232.H // Func: Header File for RS232 Module of USB08 Demo App // Ver.: 1.00 // Auth: (C)2000,2001 by Oliver Thamm MCT Elektronikladen GbR http://hc08web.de/usb08 // Rem.: View/Edit this File with TAB-Size=4 //============================================================================ //-- Function Prototypes ----------------------------------------------------- void initSSCI();...

  • Page 97: U08main.c

    U08MAIN.C //============================================================================ // File: U08MAIN.C // Func: Main Module for USB08 Demo Application // Ver.: 1.00 // Auth: (C)2000,2001 by Oliver Thamm, MCT Elektronikladen GbR http://hc08web.de/usb08 // Make: Build the project using U08MAIN.C, U08KEY.C, and VECJB8.C, use CRTSJB8.S as C-Startup Module // Rem.: View/Edit this File with TAB-Size=4...

  • Page 98

    Designer Reference Manual // USB Reset Disable, COP Disable // clear TSTOP, Prescaler=0 // just for Debugging // init RS232 or USB Pipe // init LED Output // init Key Input // init Soft ADC Source Code Files USB08 Evaluation Board MOTOROLA...

  • Page 99

    // send data to output pipe io_buffer[0] = getKey(1); io_buffer[1] = getKey(2); io_buffer[2] = getKey(3); io_buffer[3] = adc[0]; io_buffer[4] = adc[1]; io_buffer[5] = adc[2]; n=0; do { putPipe(io_buffer[n++]); } while(n<8); //============================================================================ USB08 Evaluation Board MOTOROLA Source Code Files Source Code Files Contents Designer Reference Manual...

  • Page 100: U08desc.c

    U08DESC.C //============================================================================ // File: U08DESC.C // Func: Device-, Configuration- and String-Descriptors for USB08 Demo Application (all const Data, placed in Flash-ROM) // Ver.: 1.00 // Auth: (C)2000,2001 by Oliver Thamm, MCT Elektronikladen GbR http://hc08web.de/usb08 // Rem.: View/Edit this File with TAB-Size=4...

  • Page 101

    String0Desc[SD0LEN] = { // Size, Type SD0LEN, DT_STRING, // LangID Codes 0x09, 0x04 USB08 Evaluation Board MOTOROLA // Size of this Descriptor in Bytes // Descriptor Type (=4) // Number of *this* Interface (0..) // Alternative for this Interface (if any) // No of EPs used by this IF (excl.

  • Page 102

    ’E’, 0, ’l’, 0, ’e’, 0, ’k’, 0, ’t’, 0, ’r’, 0, ’o’, 0, ’n’, 0, ’i’, 0, ’k’, 0, ’l’, 0, ’a’, 0, ’d’, 0, ’e’, 0, ’n’, 0 Designer Reference Manual Source Code Files USB08 Evaluation Board MOTOROLA...

  • Page 103

    // Product String //----------------------------------------------- #define SD2LEN sizeof("USB08 Evaluation Board")*2 //----------------------------------------------- const uchar String2Desc[SD2LEN] = { // Size, Type SD2LEN, DT_STRING, // Unicode String ’U’, 0, ’S’, 0, ’B’, 0, ’0’, 0, ’8’, 0, ’ ’, 0, ’E’, 0, ’v’, 0, ’a’, 0,...

  • Page 104: U08usb.c

    Source Code Files U08USB.C //============================================================================ // File: U08USB.C // Func: USB Implementation Module for USB08 Demo Application // Ver.: 1.00 // Auth: (C)2000,2001 by Oliver Thamm, MCT Elektronikladen GbR http://hc08web.de/usb08 // Rem.: View/Edit this File with TAB-Size=4 //============================================================================ //---------------------------------------------------------------------------- #include "u08usb.h"...

  • Page 105

    (SetupBuffer.wValue.lo & 0x80)) forceSTALL(); else { // prepare to send empty DATA1 at next IN Transaction UCR0 = BM_T0SEQ + BM_TX0E + 0; //---------------------------------------------------------------------------- USB08 Evaluation Board MOTOROLA // check 0-fields // EP2 // clear STALL // Sequence = DATA0...

  • Page 106

    // prepare to send empty DATA1 at next IN Transaction UCR0 = BM_T0SEQ + BM_TX0E + 0; //---------------------------------------------------------------------------- Designer Reference Manual // EP1 Tx Enable, Data Size is 0 // EP2 Rx Enable // deactivate EP1 // deactivate EP2 Source Code Files USB08 Evaluation Board MOTOROLA...

  • Page 107

    UCR0 = BM_T0SEQ + BM_TX0E + n; // check if this is the last DATA packet to send if(n < 8) SetupBuffer.bRequest = REQUEST_COMPLETE; //---------------------------------------------------------------------------- USB08 Evaluation Board MOTOROLA // Get Device Descriptor // Get Configuration Descriptor // Get String Descriptor...

  • Page 108

    // Non-Standard Requests will not be handled! // Standard Request Decoder: // 1 // 5 // 6 // 9 // Activate EP0 Receiver // Deactivate EP0 Receiver + Transmitter // Reset EP0 Receive Flag // Activate EP0 Receiver Source Code Files USB08 Evaluation Board MOTOROLA...

  • Page 109

    // and do not re-enable EP0 Transmitter, since there is no more // data to send break; default: forceSTALL(); break; //---------------------------------------------------------------------------- USB08 Evaluation Board MOTOROLA // Deactivate EP0 Transmitter // Reset EP0 Transmit complete Flag Source Code Files Source Code Files Contents...

  • Page 110

    // Deactivate EP1 Transmitter // Reset EP1 Transmit complete Flag // Deactivate EP2 Receiver // Reset EP2 Receive Flag // Check Transfer Size // wait if TxBuffer is full // Activate EP2 Receiver Source Code Files USB08 Evaluation Board MOTOROLA...

  • Page 111

    = (TxBuf_WrIdx+1) & (MAX_TXBUF_SIZE-1); while(newIdx == TxBuf_RdIdx) // wait if TxBuffer is full TxBuffer[TxBuf_WrIdx] = c; TxBuf_WrIdx = newIdx; //---------------------------------------------------------------------------- USB08 Evaluation Board MOTOROLA // USB enable, default address // reset EP0 // reset EP1 // reset EP2 // clear TX1ST Flag...

  • Page 112

    // Enable EP1 and EP2 // EP0 Rx/Tx Intr Enable and // EP1 Tx and EP2 Rx Intr Enable // and End-of-Packet Intr Enable // EP0 Receive Enable // Device is powered and reset Source Code Files USB08 Evaluation Board MOTOROLA...

  • Page 113: U08232.c

    U08232.C //============================================================================ // File: U08232.C // Func: RS232 Implementation Module for USB08 Demo Application // Ver.: 1.00 // Auth: (C)2000,2001 by Oliver Thamm, MCT Elektronikladen GbR http://hc08web.de/usb08 // Rem.: View/Edit this File with TAB-Size=4 //============================================================================ //---------------------------------------------------------------------------- #include "hc08jb8.h" #include "u08232.h"...

  • Page 114

    // enable Output Driver for Tx // Rx is an Input Line // save current Interrupt Mask // disable Interrupts // send Startbit // send 8 Databits, LSB first // send Stopbit // restore previous Interrupt Mask Source Code Files USB08 Evaluation Board MOTOROLA...

  • Page 115

    // add framing error // handling if desired delayHalfBit(); setCCR(ccr_save); return c; //============================================================================ USB08 Evaluation Board MOTOROLA // save current Interrupt Mask // disable Interrupts // wait for H-L transition // get 8 Databits // check Rx Line during Stopbit...

  • Page 116: U08key.c

    Source Code Files U08KEY.C //============================================================================ // File: U08KEY.C // Func: Key Input Functions for USB08 // Ver.: 1.00 // Auth: (C)2000,2001 by Oliver Thamm, MCT Elektronikladen GbR http://hc08web.de/usb08 // Rem.: View/Edit this File with TAB-Size=4 //============================================================================ #include "hc08jb8.h" #include "u08key.h"...

  • Page 117: U08adc.c

    U08ADC.C //============================================================================ // File: U08ADC.C // Func: Software ADC for USB08 // Ver.: 1.00 // Auth: (C)2000,2001 by Oliver Thamm, MCT Elektronikladen GbR http://hc08web.de/usb08 // Rem.: View/Edit this File with TAB-Size=4 //============================================================================ #include "hc08jb8.h" #include "u08adc.h" //---------------------------------------------------------------------------- void initSADC() { // disable internal Pull-Ups on PTE POCR &= ~0x80;// disable PTE20P...

  • Page 118

    Designer Reference Manual // PTD[3..6] = L // Output // PTE[0..2] = H; // Output // PTE HiZ (Input) // PTD[3..5] = HiZ // Output // PTE HiZ (Input) // underflow // overflow Source Code Files USB08 Evaluation Board MOTOROLA...

  • Page 119: Vecjb8.c

    (* const _vectab[])() = { isrKey, isrDummy, isrDummy, isrDummy, isrDummy, isrUSB, isrDummy, _stext, USB08 Evaluation Board MOTOROLA /* startup routine /* Keypad /* TIMER overflow /* TIMER channel 1 /* TIMER channel 0 /* IRQ1 /* USB /* SWI...

  • Page 120: Crtsjb8.s

    ; initialize stack pointer ; start of bss ; start loop ; clear byte ; next byte ; up to the end ; and loop ; initialize stack pointer ; execute main ; and stay here Source Code Files USB08 Evaluation Board MOTOROLA...

  • Page 121: Usb08.lkf, Build.bat

    # Put your interrupt vectors file here if needed vecjb8.o +def __memory=@.bss +def __stack=0x013f BUILD.BAT cx6808 -v -l u08main.c u08adc.c u08key.c vecjb8.c clnk -m usb08.map -o usb08.h08 usb08.lkf chex -fm -h -o usb08.s19 usb08.h08 USB08 Evaluation Board MOTOROLA # program start address # constants follow code...

  • Page 122: Usb08.map

    Source Code Files USB08.MAP Map of usb08.h08 from link file usb08.lkf - Sun Jan 07 19:29:30 2001 Segments: start 0000dc00 end 0000e263 length start 0000e263 end 0000e2f5 length start 00000040 end 00000040 length start 00000040 end 00000041 length start 00000041 end 00000041 length...

  • Page 123

    __sbss 00000041 __stack 0000013f __stext 0000dc00 __vectab 0000fff0 USB08 Evaluation Board MOTOROLA (15) defined in u08main.o section .const defined in u08main.o section .const defined in u08main.o section .const *** not used *** defined in u08main.o section .const *** not used *** defined in u08main.o section .const...

  • Page 124

    .text used in crtsjb8.o defined in u08main.o section .text defined in u08adc.o section .text defined in u08main.o section .text defined in u08main.o section .text defined in (c:\programme\cosmic\cx08\Lib\libm.h08) ireg.o section .ubsct used in u08main.o Source Code Files USB08 Evaluation Board MOTOROLA...

  • Page 125

    S123DE406F012027C60043CE0044878AF695EE01899EEE048AF7956C0226026C01450043A7 S123DE606C0126017C4500457A957CC600452705F6A10825CFB63BA880A480FBAB30B73BAA S123DE80F6A1082405A6FFC70047A70381A7FD45003CF6A4DFF7A608B718957FA628E702FB S123DEA06F012021CE00628CD6006395EE01899EEE048AF7C600624CA40FC70062956C0247 S123DEC026026C017CC60062C100612705F6A10825D2B63CA880A480FBAB20B73CA70381FF S123DEE0A7FC450019F6A4EFF7A610B718A63095E7036F02B63EA40FE7012028C6004F4C1A S123DF00A40FF7C1005027FB95E602EE03878AF6CE004F8CD7005195F6C7004F6C032602A2 S123DF206C026A016D0126D4A610B719A70481A680B7383F3B3F3C3F19A644B71A3F1B3F34 S123DF4039A6FFB7184FC70042C700414CC700734FC70062C70061C70050C7004F8187C68F S123DF600050C1004F27F8CE00508CD6005195F7C600504CA40FC70050F68A81878987C637 S123DF8000614CA40F95F7C1006227FBE602CE00618CD7006395F6C70061A703818BB64010 S123DFA0870F3A0A4FC7004EA680B7182045013A0D0D3D05CDDD94203ACDDDED2035033A6D S123DFC005CDDDFD202D073A05CDDE8D2025093A05CDDEE0201D0D3A1ACDDF2F45001AF6E0 S123DFE0AA03F7A69BB73945003BF6AA10F7A602C7007386B7408A80A621B71F3F0A819DB4 S123E00080A7F3CDDF2F450007A607FAF7CDE0E0CDE1339A956F09AF0A9F9EEB0A9724055D S123E0208B9E6C018A898B95E60B5F4C26015CCDE15D8A88F7956C09E609A10326026F09A3 S123E0404FE7086C08BF40BB409724058B9E6C018A898BCDDF5E8A88F795E608A10825E3D5 S123E0607D2608450003F6AA012006450003F6A4FEF7956D012608450003F6AA0220064585 S123E0800003F6A4FDF7956D022608450003F6AA042006450003F6A4FBF75FA601CDE10619 S123E0A095F75FA602CDE10695E7015FA603CDE10695E702E60AE703E60BE704E60CE705CA S123E0C04FE7086C08BF40BB409724058B9E6C018AF65FCDDF7C95E608A10825E6CCE01739 S123E0E045001DF6AA01F7450000F6AA70F7450004F6AA70F7F6A48FF7A670B717A604B721 S123E100164FC70074818789A60395EB01E701A601EE012703485BFDC400742702A601A7A9 S123E12002818BB600AA8F43450074F8F7A604B7168A8045001DF6A47FF7818789A6049530 S123E1407466014BFAA604680569044BFA9EE605878A9EEE029EE606525FA702818789A78E S123E160F8A1032603956C09450003F6A487F7450007F6AA78F7450008F6AA07F7450009D8 S123E180F6AA07F79E6F019E6F029EE602A0019EE70224039E6A019EE602A0E89EE601A2AD S123E1A00325E7F6A4F8F7B60C95E706B60DE707B608E40926FAB60CE704B60DE007E705C0 S123E1C0E604E206E704450007F6A4C7F7450009F6AA07F79E6F019E6F029EE602A0019E0C S123E1E0E70224039E6A019EE602A0E89EE601A20325E7F6A4F8F7B60C95E706B60DE70740 USB08 Evaluation Board Designer Reference Manual MOTOROLA Source Code Files...

  • Page 126

    Source Code Files S123E200B608E40926FABE0C9EEF03B60D9EE7049EE008879F95E20797869EE006879F9503 S123E220E2059786A0649EE7049FA20095E702E603A051E602A2C325046F026F03E603E08E S123E24005E602E204250CE605A001E703E604A200E702E60387E60287E605EE04CDE13B26 S106E260A70C8183 S123E2631201100100000008700C000000010102000109022000010100C0000904000002EE S123E283FF01FF000705810308000A0705020308000A0403090428034D0043005400200070 S123E2A345006C0065006B00740072006F006E0069006B006C006100640065006E002E030A S123E2C35500530042003000380020004500760061006C0075006100740069006F006E00AD S115E2E3200042006F00610072006400E295E299E2C188 S113FFF0E122DFFFDFFFDFFFDFFFDF9DDFFFDC004C S903FFFFFE Designer Reference Manual USB08 Evaluation Board Source Code Files MOTOROLA...

  • Page 127: Appendix D. Bill Of Materials And Schematic, Bill Of Materials And Schematic

    Designer Reference Manual — USB08 Evaluation Board Appendix D. Bill of Materials and Schematic This appendix includes: • • USB08 Evaluation Board MOTOROLA USB08 V 1.01 bill of materials — USB08 evaluation board schematic — Bill of Materials and Schematic...

  • Page 128: D-1 Bill Of Materials For Usb08 V 1.01

    R8, R13, R14, R15 R10, R11, R12, R19 R16, R17 S1, S2, S3, S4, S5 X2, X3 Designer Reference Manual Table D-1. Bill of Materials for USB08 V 1.01 Part Bill of Materials and Schematic Value 22 pF 100 nF 10 µF...

  • Page 129: Usb08 Evaluation Board Schematic

    Figure D-1. USB08 Evaluation Board Schematic...

  • Page 130

    Bill of Materials and Schematic Designer Reference Manual USB08 Evaluation Board Bill of Materials and Schematic MOTOROLA...

  • Page 131: Driver (usbio), Appendix E. Universal Usb Device Driver (usbio

    Designer Reference Manual — USB08 Evaluation Board Appendix E. Universal USB Device Driver (USBIO) USBIO Universal USB Device Driver for Windows 98, Windows Millennium, and Windows 2000 Reference Manual Version 1.41 2000, December 20 By: Thesycon Copyright All Rights Reserved Reprinted with permission from Thesycon Systemsoftware &...

  • Page 132: E.1 Contents

    IOCTL_USBIO_CYCLE_PORT ..... . 172 IOCTL_USBIO_BIND_PIPE ......174 Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 133

    E.5.4 E.5.5 E.5.6 USB08 Evaluation Board MOTOROLA IOCTL_USBIO_UNBIND_PIPE ..... . 175 ICOTL_USBIO_RESET_PIPE ..... . .176 IOCTL_USBIO_ABORT_PIPE .

  • Page 134

    Uninstalling USBIO....... . 236 Building a Customized Driver Setup....237 Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 135: E.2 Introduction, E.3 Overview

    By using the generic USB device driver USBIO it is possible to get any USB device up and running without spending the time and the effort of developing a device driver. Especially, this might be useful during USB08 Evaluation Board MOTOROLA Universal USB Device Driver (USBIO)

  • Page 136: E.3.1 Platforms, E.3.2 Features

    Win32 application Provides an interface to USB endpoints (pipes) that is similar to files Fully supports asynchronous (overlapped) data transfer operations Supports the USB transfer types Control, Interrupt, Bulk, and Isochronous Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 137

    USBIO driver. But the delays that might be caused by the thread scheduler of the operating system should be taken into consideration. USB08 Evaluation Board MOTOROLA Multiple USB devices can be controlled by USBIO at the same time...

  • Page 138: E.4 Architecture, Usb Driver Stack

    Host Controller Driver. Which driver is used depends on the main-board chip set for the PC. For instance, Intel chipsets contain an Universal Host Controller. Universal USB Device Driver (USBIO) Other USB device drivers USBHUB.SYS Figure E-1: USB08 Evaluation Board MOTOROLA...

  • Page 139

    USBDI level. For that reason the programming interface of the USBIO device driver (USBIOI) is closely related to the USBDI. But many of the functions cannot be translated in an one-to-one relationship. USB08 Evaluation Board MOTOROLA USBD.SYS is the USB Bus Driver that controls and manages all devices connected to the USB.

  • Page 140: E.4.1 Usbio Object Model, E.4.1.1 Usbio Device Objects

    A default Device Interface ID (GUID) is built into the USBIO driver. This default ID is defined in USBIO_I.H. Each device object created by USBIO is registered by using this default ID. The default Device Designer Reference Manual SetupDiGetClassDevs() SetupDiEnumDeviceInterfaces() SetupDiGetDeviceInterfaceDetail() Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 141

    Former versions of USBIO (up to V1.16) used a different device naming scheme. The device name was generated by appending an instance number to a common prefix. So the device names were static. In order USB08 Evaluation Board MOTOROLA Universal USB Device Driver (USBIO)

  • Page 142: E.4.1.2 Usbio Pipe Objects

    The following example is intended to explain the relationships described above. In and two associated pipe objects exist within the USBIO data base. Designer Reference Manual Figure E-2 a configuration is shown where one device object Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 143: Usbio Device And Pipe Objects Example

    0x81 to its buffers. Handle3 is bound to the OUT pipe 0x02. By using Handle3 with the function WriteFile() the application can initiate data transfers from its buffers to endpoint 0x02 of the device. USB08 Evaluation Board MOTOROLA Handle1 User Mode...

  • Page 144: E.4.2 Establishing A Connection To The Device

    // use DevDetail->DevicePath as device name FileHandle = CreateFile( Designer Reference Manual NULL,NULL,DIGCF_DEVICEINTERFACE|DIGCF_PRESENT); &g_usbioID, DEVICE_NUMBER, &DevData ); 0, &ReqLen, NULL); ReqLen, &ReqLen, NULL); DevDetail->DevicePath, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL, OPEN_EXISTING, 0 /* or FILE_FLAG_OVERLAPPED */, NULL); Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 145

    More code samples that show the usage of the USBIO programming interface can be found in the USBIO Class Library (USBIOLIB), the USBIO demo application (USBIOAPP), and the simple console applications ReaderCpp and ReadPipe. USB08 Evaluation Board MOTOROLA IOCTL_USBIO_SET_CONFIGURATION, &SetConfiguration, sizeof(SetConfiguration), NULL,0, &BytesReturned,...

  • Page 146: E.4.3 Power Management

    For example, if a long time measurement should be performed the computer has to be prevented from going power down. For a description of the supported registry parameters, see Entries. Designer Reference Manual Universal USB Device Driver (USBIO) E.9 Registry USB08 Evaluation Board MOTOROLA...

  • Page 147

    The application may ignore this error and repeat the request. The re-submitted requests will be queued by the USBIO driver. They will be executed after the device is back in state D0. USB08 Evaluation Board MOTOROLA Universal USB Device Driver (USBIO)

  • Page 148: E.4.4 Device State Change Notifications

    So it may crash at some later point in time. The bug seems to be “well known”, it was discussed in some Usenet groups. Designer Reference Manual for details. We strongly recommend to Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 149: E.5 Programming Interface, E.5.1 Programming Interface Overview

    IOCTL_USBIO_GET_DEVICE_POWER_STATE IOCTL_USBIO_SET_DEVICE_POWER_STATE IOCTL_USBIO_BIND_PIPE IOCTL_USBIO_UNBIND_PIPE IOCTL_USBIO_RESET_PIPE IOCTL_USBIO_ABORT_PIPE IOCTL_USBIO_GET_PIPE_PARAMETERS IOCTL_USBIO_SET_PIPE_PARAMETERS IOCTL_USBIO_PIPE_CONTROL_TRANSFER_IN IOCTL_USBIO_PIPE_CONTROL_TRANSFER_OUT ReadFile WriteFile USB08 Evaluation Board MOTOROLA Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO) Programming Interface Used On Bus Action device — device request on default pipe device...

  • Page 150: E.5.2 Control Requests

    // pointer to buffer to supply input data // size of input buffer // pointer to buffer to receive output data // size of output buffer // output byte count // for asynchronous operation Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 151

    The size of the output buffer should be a multiple of the packet size of the default pipe (endpoint zero). USB08 Evaluation Board MOTOROLA 187) data structure. This data structure has to be filled completely...

  • Page 152

    Specifies the size, in bytes, of the buffer pointed to by lpOutBuffer. nOutBufferSize Comments USB devices do not have to support this operation. Designer Reference Manual 187) data structure. This data structure has to be filled completely Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 153

    Comments The SET_FEATURE request appears on the bus with the parameters specified in the IOCTL_USBIO_SET_FEATURE structure. USB08 Evaluation Board MOTOROLA 188) data structure. This data structure has to be filled completely Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO)

  • Page 154

    Comments The CLEAR_FEATURE request appears on the bus with the parameters specified in the IOCTL_USBIO_CLEAR_FEATURE structure. Designer Reference Manual 188) data structure. This data structure has to be filled completely Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 155

    The GET_STATUS request appears on the bus with the parameters specified in the USBIO_STATUS_REQUEST function returns the structure USBIO_STATUS_REQUEST_DATA (page USB08 Evaluation Board MOTOROLA 189) data structure. This data structure has to be filled completely 190) which contains two bytes of data.

  • Page 156

    Comments A GET_CONFIGURATION request appears on the bus. The structure USBIO_GET_CONFIGURATION_DATA configuration value. A value of zero means “not configured”. Designer Reference Manual Universal USB Device Driver (USBIO) (page 191) data structure. (page 191) returns the USB08 Evaluation Board MOTOROLA...

  • Page 157

    Comments A GET_INTERFACE request appears on the bus. The structure USBIO_GET_INTERFACE_DATA alternate setting of the interface specified in USBIO_GET_INTERFACE. USB08 Evaluation Board MOTOROLA 192) data structure. This data structure has to be filled completely Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO)

  • Page 158

    The USBD does not recognize the pipe correctly and returns an invalid pipe type, when the additional bits in bmAttributes are not masked off. This has to be done by the application. Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 159

    By default, the configuration descriptor that is reported by the device is passed to the USBD. If an user-defined configuration descriptor is stored with IOCTL_USBIO_STORE_CONFIG_DESCRIPTOR descriptor is used. USB08 Evaluation Board MOTOROLA 195) data structure. This data structure has to be filled completely 195).

  • Page 160

    A SET_CONFIGURATION request with the configuration value 0 appears on the bus. All pipe handles associated with the device will be unbound and all pending requests will be cancelled. Designer Reference Manual Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 161

    If this request returns with success, new pipe objects are available. The operation IOCTL_USBIO_GET_CONFIGURATION_INFO used to query all available pipes and interfaces. USB08 Evaluation Board MOTOROLA 194) data structure. This data structure has to be filled completely Universal USB Device Driver (USBIO)

  • Page 162

    OUT token with a zero length data packet. If no data phase is required an IN token appears on the bus with a zero length data packet from the USB device for acknowledge. Designer Reference Manual Universal USB Device Driver (USBIO) (page 196) data structure. USB08 Evaluation Board MOTOROLA...

  • Page 163

    IN token with a zero length data packet from the device. If no data phase is required an IN token appears on the bus and the device acknowledges with a zero length data packet. USB08 Evaluation Board MOTOROLA Universal USB Device Driver (USBIO)

  • Page 164

    The default state of the device parameters is defined by a set of registry parameters which are read by the USBIO driver at startup. The current state may be queried using this request. Designer Reference Manual 198) data structure. Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 165

    The default state of the device parameters is defined by a set of registry parameters which are read by the USBIO driver at startup.The current state may be modified using this request. USB08 Evaluation Board MOTOROLA 198) data structure. This data structure has to be filled completely...

  • Page 166

    Comments This operation returns information about all active pipes and interfaces that are available in the current configuration. Designer Reference Manual 204) data structure. Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 167

    Reset while the device is configured. If the device changes its USB descriptor set during an USB Reset the IOCTL_USBIO_CYCLE_PORT instead of IOCTL_USBIO_RESET_DEVICE. This request does not work if the system-provided multi-interface driver is used. USB08 Evaluation Board MOTOROLA USB Reset GET_DEVICE_DESCRIPTOR USB Reset SET_ADDRESS...

  • Page 168

    The returned frame number is a 32 bit value. The lower 11 bits of this value correspond to the frame number value in the Start Of Frame token on the bus. Designer Reference Manual 205) data structure. Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 169

    If the device is set to a power state different from D0 all pending requests should be cancelled before. See Also data structure USBIO_DEVICE_POWER USB08 Evaluation Board MOTOROLA 206) data structure. E.4.3 Power Management (page Universal USB Device Driver (USBIO)

  • Page 170

    Comments The device power state is maintained internally by the USBIO driver. This request may be used to query the current power state. Designer Reference Manual 206) data structure. Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 171

    Comments An application should check if the API version of the driver that is currently running matches with the version it expects. USB08 Evaluation Board MOTOROLA 186) data structure. Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO)

  • Page 172

    USB Reset GET_DEVICE_DESCRIPTOR USB Reset SET_ADDRESS GET_DEVICE_DESCRIPTOR GET_CONFIGURATION_DESRIPTOR the new device instance. Universal USB Device Driver (USBIO) 167) request, except that from USB08 Evaluation Board MOTOROLA...

  • Page 173

    (USBD). This request does not work if the system-provided multi-interface driver is used. This driver expects that all function device drivers send a CYCLE_PORT request within 5 seconds. USB08 Evaluation Board MOTOROLA (page Universal USB Device Driver (USBIO)

  • Page 174

    After this operation is successfully completed the pipe can be accessed using pipe related requests (e.g. read or write). See Also IOCTL_USBIO_SET_CONFIGURATION IOCTL_USBIO_GET_CONFIGURATION_INFO Designer Reference Manual Universal USB Device Driver (USBIO) (page 207) data (page 159) and (page 166) USB08 Evaluation Board MOTOROLA...

  • Page 175

    After this operation is successfully completed the handle is unbound and may be used to bind another pipe. It is not necessary to unbind a pipe handle before it is closed. Closing a handle unbinds it implicitly. USB08 Evaluation Board MOTOROLA Universal USB Device Driver (USBIO)

  • Page 176

    USB host controller will be reinitialized. Isochronous pipes will never be halted by the USBD. This is because on isochronous pipes no handshake is used to detect errors in data transmission. Designer Reference Manual Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 177

    Not used with this operation. Set to zero. nOutBufferSize Comments All outstanding read or write requests on the pipe are aborted and returned with an error status of USBIO_ERR_CANCELLED. USB08 Evaluation Board MOTOROLA Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO) Programming Interface...

  • Page 178

    The default state of the pipe parameters is defined by a set of registry parameters which are read by the USBIO driver at startup. The current state can be queried by using this request. Designer Reference Manual 208) data structure. Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 179

    The default state of the pipe parameters is defined by a set of registry parameters which are read by the USBIO driver at startup. The current state can be modified by using this request. USB08 Evaluation Board MOTOROLA 208) data structure. This data structure has to be filled completely...

  • Page 180

    This request is intended to be used with additional control pipes a device might provide. It is not possible to generate a control transfer for the default endpoint zero with this operation. Designer Reference Manual Universal USB Device Driver (USBIO) (page 209) data structure. This USB08 Evaluation Board MOTOROLA...

  • Page 181

    This request is intended to be used with additional control pipes a device might provide. It is not possible to generate a control transfer for the default endpoint zero with this operation. USB08 Evaluation Board MOTOROLA Universal USB Device Driver (USBIO)

  • Page 182: E.5.3 Data Transfer Requests, E.5.3.1 Bulk And Interrupt Transfers

    // handle of file to write // pointer to data to write to file // number of bytes to write // pointer to OVERLAPPED structure (page Universal USB Device Driver (USBIO) 194) structure on the Set USB08 Evaluation Board MOTOROLA...

  • Page 183: Layout Of An Isochronous Transfer Buffer

    (PC). The buffer is divided into data pieces (packets) of the FIFO size of the endpoint. The buffer size should be a multiple of the FIFO size. Otherwise the last transaction can cause a buffer overflow error. USB08 Evaluation Board MOTOROLA USBIO_ISO_TRANSFER ( NumberOfPackets = N;...

  • Page 184: E.5.3.2 Isochronous Transfers

    USBIO_ISO_PACKET Designer Reference Manual 179) operation. The default state is defined by the registry (page Universal USB Device Driver (USBIO) Figure E-3. The buffer (page 213) structure 210) structure that provides general (page 212) structure USB08 Evaluation Board MOTOROLA...

  • Page 185: E.5.4 Input And Output Structures

    E.5.4 Input and Output Structures This section provides a detailed description of the data structures that are used with the various input and output requests. USB08 Evaluation Board MOTOROLA (page 212) elements.

  • Page 186

    If this flag is set, the driver that is currently running is a LIGHT version that has some restrictions. Refer to ReadMe.txt for a description of the restrictions. 171) operation. Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 187

    LanguageId Specifies the Language ID for string descriptors. Set to zero for other descriptors. Comments This structure has to be used as an input for IOCTL_USBIO_GET_DESCRIPTOR IOCTL_USB_SET_DESCRIPTOR USB08 Evaluation Board MOTOROLA USBIO_REQUEST_RECIPIENT Recipient; UCHAR DescriptorType; UCHAR DescriptorIndex; USHORT LanguageId; Meaning...

  • Page 188

    Bus Specification 1.1, Chapter 9 for more information. Comments This structure has to be used as an input for IOCTL_USBIO_SET_FEATURE IOCTL_USBIO_CLEAR_FEATURE Designer Reference Manual USBIO_REQUEST_RECIPIENT Recipient; USHORT FeatureSelector; USHORT Index; (page Universal USB Device Driver (USBIO) (page 215). 153) and (page 154) requests. USB08 Evaluation Board MOTOROLA...

  • Page 189

    Specifies the index value for the get status request. The values are defined by the device. Refer to the Universal Serial Bus Specification 1.1, Chapter 9 for more information. Comments This structure has to be used as an input for IOCTL_USBIO_GET_STATUS USB08 Evaluation Board MOTOROLA USBIO_REQUEST_RECIPIENT Recipient; USHORT Index; 215). (page...

  • Page 190

    Refer to the Universal Serial Bus Specification 1.1, Chapter 9 for more information. Comments This structure is an output of IOCTL_USBIO_GET_STATUS requests. Designer Reference Manual USHORT Status; Universal USB Device Driver (USBIO) (page 155) USB08 Evaluation Board MOTOROLA...

  • Page 191

    A value of zero means the device is not configured. Refer to the Universal Serial Bus Specification 1.1, Chapter 9 for more information. Comments This structure is an output of IOCTL_USBIO_GET_CONFIGURATION (page USB08 Evaluation Board MOTOROLA UCHAR ConfigurationValue; 156) requests. Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO)

  • Page 192

    Universal Serial Bus Specification 1.1, Chapter 9 for more information. Comments This structure has to be used as an input for IOCTL_USBIO_GET_INTERFACE Designer Reference Manual USHORT Interface; Universal USB Device Driver (USBIO) (page 157) requests. USB08 Evaluation Board MOTOROLA...

  • Page 193

    Refer to the Universal Serial Bus Specification 1.1, Chapter 9 for more information. Comments This structure is an output of IOCTL_USBIO_GET_INTERFACE (page USB08 Evaluation Board MOTOROLA UCHAR AlternateSetting; 157) requests. Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO)

  • Page 194

    4096 (4K) should be used. Comments This structure has to be used as an input for IOCTL_USBIO_SET_INTERFACE IOCTL_USBIO_SET_CONFIGURATION Designer Reference Manual USHORT InterfaceIndex; USHORT AlternateSettingIndex; ULONG MaximumTransferSize; Universal USB Device Driver (USBIO) (page 161) and (page 159) requests. USB08 Evaluation Board MOTOROLA...

  • Page 195

    An array of USBIO_INTERFACE_SETTING that describes each interface in the configuration. There have to be NbOfInterfaces valid entries in this array. Comments This structure has to be used as an input for IOCTL_USBIO_SET_CONFIGURATION USB08 Evaluation Board MOTOROLA USHORT ConfigurationIndex; USHORT NbOfInterfaces; USBIO_INTERFACE_SETTING InterfaceList[USBIO_MAX_INTERFACES];...

  • Page 196

    If this flag is set, the USBIO driver does not return an error if a data packet received from the device is shorter than the maximum packet size of the endpoint. Otherwise, a short packet causes an error condition. 215). Universal USB Device Driver (USBIO) (page 216). USB08 Evaluation Board MOTOROLA...

  • Page 197

    Chapter 9. The meanings of the values are device dependent. This structure has to be used as an input for IOCTL_USBIO_CLASS_OR_VENDOR_IN_REQUEST IOCTL_USBIO_CLASS_OR_VENDOR_OUT_REQUEST operations. USB08 Evaluation Board MOTOROLA Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO) Programming Interface (page...

  • Page 198

    The Remote Wakeup feature requires that the device is opened by an application and an USB configuration is set (device is configured). The default state of this option is defined by the registry parameter EnableRemoteWakeup. Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 199

    The default time-out value is defined by the registry parameter RequestTimeout. Comments This structure is intended to be used with IOCTL_USBIO_GET_DEVICE_PARAMETERS IOCTL_USBIO_SET_DEVICE_PARAMETERS USB08 Evaluation Board MOTOROLA Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO) Programming Interface (page 164) and (page 165) operations.

  • Page 200

    Specifies the number of pipes that belong to this interface and alternate setting. Designer Reference Manual UCHAR InterfaceNumber; UCHAR AlternateSetting; UCHAR Class; UCHAR SubClass; UCHAR Protocol; UCHAR NumberOfPipes; UCHAR reserved1; UCHAR reserved2; Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 201

    Reserved field, set to zero. reserved2 Reserved field, set to zero. Comments This structure is an output of IOCTL_USBIO_GET_CONFIGURATION_INFO USB08 Evaluation Board MOTOROLA Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO) Programming Interface (page 166) operations. Designer Reference Manual...

  • Page 202

    USBIO_PIPE_TYPE PipeType; ULONG MaximumTransferSize; USHORT MaximumPacketSize; UCHAR EndpointAddress; UCHAR Interval; UCHAR InterfaceNumber; UCHAR reserved1; UCHAR reserved2; UCHAR reserved3; Bit 7 = 0: OUT endpoint Bit 7 = 1: IN endpoint Universal USB Device Driver (USBIO) (page 214). USB08 Evaluation Board MOTOROLA...

  • Page 203

    Reserved field, set to zero. Comments This structure is an output of IOCTL_USBIO_GET_CONFIGURATION_INFO Only active pipes from the current configuration are returned. USB08 Evaluation Board MOTOROLA Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO) Programming Interface (page...

  • Page 204

    Only active pipes from the current configuration are returned. Designer Reference Manual ULONG NbOfInterfaces; ULONG NbOfPipes; USBIO_INTERFACE_CONFIGURATION_INFO InterfaceInfo[USBIO_MAX_INTERFACES]; USBIO_PIPE_CONFIGURATION_INFO PipeInfo[USBIO_MAX_PIPES]; 200) structures that describes the interfaces.There are Universal USB Device Driver (USBIO) (page 202) (page 166) operations. USB08 Evaluation Board MOTOROLA...

  • Page 205

    Contains the current value of the frame counter maintained by the USBD. Comments This structure is an output of IOCTL_USBIO_GET_CURRENT_FRAME_NUMBER requests. USB08 Evaluation Board MOTOROLA ULONG FrameNumber; Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO) Programming Interface (page...

  • Page 206

    Contains the power state of the USB device. The values are defined by the USBIO_DEVICE_POWER_STATE type. Comments This structure is used with IOCTL_USBIO_GET_DEVICE_POWER_STATE IOCTL_USBIO_SET_DEVICE_POWER_STATE Designer Reference Manual USBIO_DEVICE_POWER_STATE DevicePowerState; Universal USB Device Driver (USBIO) (page 217) enumeration (page 170) and (page 169) requests. USB08 Evaluation Board MOTOROLA...

  • Page 207

    Refer to the Universal Serial Bus Specification 1.1, Chapter 9 for more information. Comments This structure has to be used as an input for IOCTL_USBIO_BIND_PIPE (page configuration can be bound. USB08 Evaluation Board MOTOROLA UCHAR EndpointAddress; Bit 7 = 1: OUT endpoint Bit 7 = 0: IN endpoint 174) operations.

  • Page 208

    Otherwise, a short packet causes an error condition. This option is meaningful for IN pipes only. (page 210)). Universal USB Device Driver (USBIO) (page 178) and (page 179) operations. USB08 Evaluation Board MOTOROLA...

  • Page 209

    Comments This structure has to be used as an input for IOCTL_USBIO_PIPE_CONTROL_TRANSFER_IN IOCTL_USBIO_PIPE_CONTROL_TRANSFER_OUT operations. USB08 Evaluation Board MOTOROLA ULONG Flags; UCHAR SetupPacket[8]; If this flag is set, the USBIO driver does not return an error if a data packet received from the device is shorter than the maximum packet size of the endpoint.

  • Page 210

    If this flag is set, the transfer will be started as soon as possible and the StartFrame parameter is ignored. This flag has to be used if a continuous data stream shall be sent to the isochronous endpoint of the USB device. Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 211

    This structure is the fixed size part of the USBIO_ISO_TRANSFER_HEADER an input for ReadFile and WriteFile operations with an isochronous pipe. the transfer buffer has to contain an USBIO_ISO_TRANSFER_HEADER USB08 Evaluation Board MOTOROLA Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO) Programming Interface...

  • Page 212

    The maximum number of data packets is limited by the registry parameter MaxIsoPackets. Designer Reference Manual ULONG Offset; ULONG Length; ULONG Status; Universal USB Device Driver (USBIO) (page 213) that has to be used as USB08 Evaluation Board MOTOROLA...

  • Page 213

    The IsoPacket array describes the location and the size of the data packets. Each data packet is transferred in a separate USB frame. There must not be gaps between the data packets in the transfer buffer. USB08 Evaluation Board MOTOROLA USBIO_ISO_TRANSFER IsoTransfer; USBIO_ISO_PACKET IsoPacket[1];...

  • Page 214: E.5.5 Enumeration Types

    _USBIO_PIPE_TYPE{ } USBIO_PIPE_TYPE; Comments The meaning of the values is defined by he Universal Serial Bus Specification 1.1, Chapter 9. Designer Reference Manual PipeTypeControl = 0,; PipeTypeIsochronous, PipeTypeBulk, PipeTypeInterrupt Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 215

    USB device request. Definition typedef enum _USBIO_REQUEST_RECIPIENT{ } USBIO_REQUEST_RECIPIENT; Comments The meaning of the values is defined by the Universal Serial Bus Specification 1.1, Chapter 9. USB08 Evaluation Board MOTOROLA RecipientDevice = 0, RecipientInterface, RecipientEndpoint, RecipientOther Universal USB Device Driver (USBIO)

  • Page 216

    USB Specification. This is because only Class and Vendor requests are supported by the USBD interface. Standard requests are generated internally by the USBD. Designer Reference Manual RequestTypeClass = 1, RequestTypeVendor Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 217

    Suspend DevicePowerStateD2 Suspend DevicePowerStateD3 Device off Comments The meaning of the values is defined by the Power Management specification. USB08 Evaluation Board MOTOROLA DevicePowerStateD0 = 0, DevicePowerStateD1, DevicePowerStateD2, DevicePowerStateD3 Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO) Programming Interface...

  • Page 218: E.5.6 Error Codes

    (0xE0000005L) (0xE0000006L) (0xE0000007L) (0xE0000008L) (0xE0000009L) (0xE000000AL) (0xE000000BL) (0xE000000CL) (0xE000000DL) (0xE000000FL) (0xE0000010L) (0xE0000030L) (0xE0000100L) (0xE0000200L) (0xE0000300L) (0xE0000400L) (0xE0000500L) (0xE0000600L) (0xE0000700L) (0xE0000800L) (0xE0000900L) (0xE0000A00L) (0xE0000B00L) (0xE0000C00L) (0xE0000D00L) (0xE0010000L) (0xE0020000L) (0xE0001000L) (0xE0001001L) (0xE0001002L) (0xE0001003L) (0xE0001004L) (0xE0001005L) (0xE0001006L) (0xE0001007L) (0xE0001008L) USB08 Evaluation Board MOTOROLA...

  • Page 219

    USBIO_ERR_VID_RESTRICTION USBIO_ERR_ISO_RESTRICTION USBIO_ERR_BULK_RESTRICTION USBIO_ERR_EP0_RESTRICTION USBIO_ERR_PIPE_RESTRICTION USBIO_ERR_PIPE_SIZE_RESTRICTION USBIO_ERR_DEVICE_NOT_FOUND USBIO_ERR_DEVICE_NOT_OPEN USBIO_ERR_NO_SUCH_DEVICE_INSTANCE USBIO_ERR_INVALID_FUNCTION_PARAM USB08 Evaluation Board MOTOROLA Table E-2. Error Codes Defined by the USBIO Device Driver (Continued) Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO) Programming Interface (0xE0001009L) (0xE000100AL) (0xE000100BL)

  • Page 220: E.6 Usbio Class Library, E.6.1 Cusbio Class, Usbio Class Library

    It is used for all subsequent requests to the device. Designer Reference Manual shows the classes included in the USBIOLIB and their CUsbIo CUsbIoPipe CUsbIoThread CUsbIoReader CUsbIoWriter Figure E-4. USBIO Class Library Universal USB Device Driver (USBIO) CUsbIoBuf CUsbIoBufPool USB08 Evaluation Board MOTOROLA...

  • Page 221: E.6.2 Cusbiopipe Class

    WaitForCompletion functions of the CUsbIoPipe class the buffer has to be described by a CUsbIoBuf object. The CUsbIoBuf helper class stores context information while the read or write operation is pending. USB08 Evaluation Board MOTOROLA Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO)

  • Page 222: E.6.3 Cusbiothread Class, E.6.4 Cusbioreaderclass, E.6.5 Cusbiowriter Class

    Write requests to the pipe. The thread’s main routine gets a buffer from an internal buffer pool and calls the virtual member function ProcessBuffer to fill the Designer Reference Manual Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 223: E.6.6 Cusbiobufclass, E.6.7 Cusbiobufpool Class, E.7 Usbio Demo Application

    All output data and all error messages are directed to this window. The button “Clear Output Window” discards the actual contents of the window. USB08 Evaluation Board MOTOROLA Universal USB Device Driver (USBIO) Universal USB Device Driver (USBIO)

  • Page 224: E.7.1 Dialog Pages For Device Operations, E.7.1.1 Device, E.7.1.2 Descriptors

    The descriptors are dumped to the output window. Some descriptors are interpreted. Unknown descriptors are presented as HEX dump. Related driver interfaces: • Designer Reference Manual IOCTL_USBIO_GET_DEVICE_PARAMETERS IOCTL_USBIO_SET_DEVICE_PARAMETERS IOCTL_USBIO_GET_DESCRIPTOR Universal USB Device Driver (USBIO) (page 164) (page 165) (page 151) USB08 Evaluation Board MOTOROLA...

  • Page 225: E.7.1.3 Configuration, E.7.1.4 Interface, E.7.1.5 Pipes

    This page allows to show all configured endpoints and interfaces by using the button “Get Configuration Info”. A new non-modal dialog for each configured pipe can be opened as well. Related driver interfaces: • • • USB08 Evaluation Board MOTOROLA IOCTL_USBIO_GET_DESCRIPTOR IOCTL_USBIO_GET_CONFIGURATION IOCTL_USBIO_STORE_CONFIG_DESCRIPTOR IOCTL_USBIO_SET_CONFIGURATION IOCTL_USBIO_UNCONFIGURE_DEVICE...

  • Page 226: E.7.1.6 Class Or Vendor Request, E.7.1.7 Feature, E.7.1.8 Other

    • Designer Reference Manual IOCTL_USBIO_CLASS_OR_VENDOR_IN_REQUEST (page 162) IOCTL_USBIO_CLASS_OR_VENDOR_OUT_REQUEST (page 163) IOCTL_USBIO_SET_FEATURE IOCTL_USBIO_CLEAR_FEATURE IOCTL_USBIO_GET_STATUS IOCTL_USBIO_RESET_DEVICE IOCTL_USBIO_GET_CURRENT_FRAME_NUMBER IOCTL_USBIO_SET_DEVICE_POWER_STATE IOCTL_USBIO_GET_DEVICE_POWER_STATE Universal USB Device Driver (USBIO) (page 153) (page 154) (page 155) (page 167) (page 168) (page 169) (page 170) USB08 Evaluation Board MOTOROLA...

  • Page 227: E.7.1.9 Dialog Pages For Pipe Operations, E.7.1.10 Pipe, E.7.1.11 Buffers

    In the “Max Error Count” field a maximum number of errors can be specified. When this number is exceeded, the data transfer is aborted. Each successful transfer resets the error counter to zero. USB08 Evaluation Board MOTOROLA IOCTL_USBIO_RESET_PIPE IOCTL_USBIO_ABORT_PIPE...

  • Page 228: E.7.1.12 Control, E.7.1.13 Read From Pipe To Output Window, E.7.1.14 Read From Pipe To File

    Isochronous pipe has to be “asynchronous”. The application does not support data rate feedback. Related driver interfaces: • ReadFile(); • Designer Reference Manual IOCTL_USBIO_PIPE_CONTROL_TRANSER_IN IOCTL_USBIO_PIPE_CONTROL_TRANSFER_OUT IOCTL_USBIO_ABORT_PIPE IOCTL_USBIO_ABORT_PIPE Universal USB Device Driver (USBIO) (page 180) (page 181) (page 177) (page 177) USB08 Evaluation Board MOTOROLA...

  • Page 229: E.7.1.15 Write From File To Pipe, Installation Issues, Automated Installation: The Usbio Installation Wizard

    These files can be used at a later time to manually install the USBIO driver for the same device, without using the Installation Wizard. USB08 Evaluation Board MOTOROLA IOCTL_USBIO_ABORT_PIPE Universal USB Device Driver (USBIO)

  • Page 230

    USBIO driver shall be installed for. The Hardware ID will be shown for the selected device. A Hardware ID is a string that is used internally by the operating system to unambiguously identify the Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 231

    If the device belongs to the HID class, a mouse or a keyboard for example, this can cause problems. • USB08 Evaluation Board MOTOROLA device. It is built from a bus identifier (USB), the 16-bit vendor ID (VID), the 16-bit product ID (PID), and optionally the revision code (REV).

  • Page 232: Manual Installation: The Usbio Setup Information File

    USBIO package. The application allows you to test several USB operations manually. Please refer to E.7 USBIO Demo Application information. To quit the USBIO Installation Wizard, click Finish. USB/VID_046D&PID_0100 USB/VID_046D&PID_C001&REV_0401 USB/CLASS_09&SUBCLASS_01&PROT_00 Universal USB Device Driver (USBIO) for further USB08 Evaluation Board MOTOROLA...

  • Page 233

    • • • • USB08 Evaluation Board MOTOROLA Copy the USBIO driver binary usbio.sys to a floppy disk or to a directory location of your choice. Copy the INF file usbio.inf provided with the USBIO package to the same location. Note that you can choose any name for the INF file, based on your company name or your product name for example.

  • Page 234

    Driver Wizard is started which is similar to the New Hardware Wizard mentioned above. Provide the wizard with the location of your installation files (usbio.inf and usbio.sys) and complete the driver installation by following the instructions shown on screen. Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 235

    Device Manager. • • • USB08 Evaluation Board MOTOROLA For some device classes, especially HID devices like mice and keyboards, Windows does not allow you to install a driver with a different device class. That means you have to modify the device class entry in the [Version] section of the usbio.inf file to match...

  • Page 236: Uninstalling Usbio

    Install a new driver for the device by clicking the button “Update Driver”. The operating system launchs the Upgrade Device Driver Wizard which searches for driver files or lets you select a driver. Universal USB Device Driver (USBIO) USB08 Evaluation Board MOTOROLA...

  • Page 237: Building A Customized Driver Setup

    • • • • • USB08 Evaluation Board MOTOROLA Choose a new name for the driver binary file usbio.sys. The name should not cause conflicts with drivers provided by Windows. Rename the file usbio.sys to your new name. Rename the Setup Information file usbio.inf. You can choose any name you want.

  • Page 238

    USBIO does not occur in the files you ship with your product. This is a requirement that is defined by the USBIO licensing conditions. See also the License Agreement you received with the USBIO package. Universal USB Device Driver (USBIO) Entries. USB08 Evaluation Board MOTOROLA...

  • Page 239: Registry Entries, E-3 Registry Parameters Supported By The Usbio Driver

    Value RequestTimeout ShortTransferOk UnconfigureOnClose ResetDeviceOnClose EnableRemoteWakeup MaxIsoPackets PowerStateOnOpen USB08 Evaluation Board MOTOROLA lists all registry parameters. Default Time-out interval for synchronous I/O requests, in 1000 milliseconds. Zero means infinite (no time-out). If set to 1 short packets in read transfers are allowed.

  • Page 240

    USBIO driver is used. Baudrate selection for debug output to COM port. 57.600 115.200 This parameter is available only if the debug (checked) build of the USBIO driver is used. Universal USB Device Driver (USBIO) Description USB08 Evaluation Board MOTOROLA...

  • Page 241: E.10 Related Documents, E.11 Light Version Limitations

    2. Only one Interrupt IN endpoint and one Interrupt OUT endpoint is 3. The maximum FIFO size of an endpoint is limited to eight bytes. 4. The maximum size of the data stage for a Class or Vendor USB08 Evaluation Board MOTOROLA Universal Serial Bus Specification 1.0, 1.1 USB device class specifications (Audio, HID, Printer, etc.)

  • Page 242

    Universal USB Device Driver (USBIO) Designer Reference Manual USB08 Evaluation Board Universal USB Device Driver (USBIO) MOTOROLA...

  • Page 243

    blank...

  • Page 244

    JAPAN: Motorola Japan Ltd. SPS, Technical Information Center 3-20-1, Minami-Azabu, Minato-ku Tokyo 106-8573 Japan 81-3-3440-3569 ASIA/PACIFIC: Motorola Semiconductors H.K. Ltd. Silicon Harbour Centre 2 Dai King Street Tai Po Industrial Estate Tai Po, N.T., Hong Kong 852-26668334 HOME PAGE: http://www.motorola.com/semiconductors/...

This manual also for:

Mc68hc908jb8

Comments to this Manuals

Symbols: 0
Latest comments: