QNX Momentics DDK Universal Serial Bus (USB) Devices For QNX Neutrino 6.3.0 or QNX 4 2006, QNX Software Systems GmbH & Co. KG.
2000–2006, QNX Software Systems. All rights reserved. Published under license by: QNX Software Systems International Corporation 175 Terence Matthews Crescent Kanata, Ontario K2M 1W8 Canada Voice: +1 613 591-0931 Fax: +1 613 591-3579 Email: info@qnx.com Web: http://www.qnx.com/ Publishing history Electronic edition published 2006. Technical support options To obtain technical support for any QNX product, visit the Technical Support section in the Services area on our website (www.qnx.com).
Contents About the USB DDK vii Assumptions ix Building DDKs x 1 Before You Begin 1 System requirements 3 For QNX Neutrino 6.
2006, QNX Software Systems GmbH & Co. KG.
2006, QNX Software Systems GmbH & Co. KG.
About the USB DDK November 2, 2006 About the USB DDK vii
Assumptions 2006, QNX Software Systems GmbH & Co. KG. ☞ Our USB API is designed to work with either QNX Neutrino or QNX 4. Exceptions will be noted where appropriate.
Building DDKs ☞ 2006, QNX Software Systems GmbH & Co. KG. For up-to-date information on USB developments, visit www.usb.org. Building DDKs You can compile the DDK from the IDE or the command line. ¯ To compile the DDK from the IDE: Please refer to the Managing Source Code chapter, and “QNX Source Package” in the Common Wizards Reference chapter of the IDE User’s Guide.
Building DDKs 2006, QNX Software Systems GmbH & Co. KG. ddk_install_dir prebuilt install src hardware devu class include mouse printer keyboard platforms Directory structure for this DDK.
Building DDKs ☞ 2006, QNX Software Systems GmbH & Co. KG. You must run: . ./setenv.sh before running make, or make install. Additionally, on Windows hosts you’ll need to run the Bash shell (bash.exe) before you run the . ./setenv.sh command. If you fail to run the . ./setenv.sh shell script prior to building the DDK, you can overwrite existing binaries or libs that are installed in $QNX TARGET. Each time you start a new shell, run the . ./setenv.sh command.
Chapter 1 Before You Begin In this chapter. . .
System requirements 2006, QNX Software Systems GmbH & Co. KG. System requirements This USB SDK is designed to work with both QNX Neutrino 6 and with QNX 4. For QNX Neutrino 6.3 You’ll need the following: ¯ QNX Neutrino 6.3 ¯ GNU GCC 2.952 ¯ USB EHCI, OHCI or UHCI controller, version 1.1 and 2.0 compliant For QNX 4 You’ll need the following: ¯ QNX 4.25, patch D or later ¯ Watcom 10.6, patch B or later ¯ USB EHCI, OHCI or UHCI controller, version 1.1 and 2.
Known limitations 2006, QNX Software Systems GmbH & Co. KG. Type of device Manufacturer Model ″ Microsoft IntelliMouse Hub ADS Technologies 4-port ″ Belkin 4-port Printer Canon BJC-85 ″ Epson Stylus Color 740 ″ HP DeskJet 895Cse Known limitations EHCI Isochronous and split isochronous transfers are unsupported at this time. Retrieving ’Other Speed Descriptor’ has not been implemented.
Known limitations 2006, QNX Software Systems GmbH & Co. KG. ! CAUTION: Make sure that the command line for devi-hirun (or Input) includes the option to not reset the keyboard controller. For example: devi-hirun kbd -R fd -d/dev/usbkbd0 & Or with QNX 4: Input kbd -R fd -d/dev/usbkbd0 & If you don’t use the -R option, then the keyboard controller will be reset whenever you switch between Photon and text mode, and the machine may hang.
Chapter 2 Overview In this chapter. . .
2006, QNX Software Systems GmbH & Co. KG. The USB stack and library The USB stack and library USB (Universal Serial Bus) is a hardware and protocol specification for interconnecting various devices to a host controller. We supply a USB stack that implements the USB protocol and allows user-written class drivers to communicate with USB devices. We also supply a USB driver library (usbd *()) for class drivers to use in order to communicate with the USB stack.
How a class driver works 2006, QNX Software Systems GmbH & Co. KG. USB enumerator With the QNX Neutrino OS, the USB enumerator attaches to the USB stack and waits for device insertions. When a device insertion is detected, the enumerator looks in the configuration manager’s database to see which class driver it should start. It then starts the appropriate driver, which provides for that class of device. For example, a USB Ethernet class driver would register with io-net and bring the interface up.
2006, QNX Software Systems GmbH & Co. KG. 5 ☞ How a class driver works Initiate data transfer using the usbd io() function (with completion callbacks if required). In this context, the term “pipe” is a USB-specific term that has nothing to do with standard POSIX “pipes” (as used, for example, in the command line ls | more). In USB terminology, a “pipe” is simply a handle; something that identifies a connection to an endpoint.
Chapter 3 USB Utilities November 2, 2006 Chapter 3 ¯ USB Utilities 13
2006, QNX Software Systems GmbH & Co. KG. The USB Software Development Kit contains the following command-line utilities: ☞ The utilities used in this DDK are the same ones that exist in the QNX Neutrino Utilities Reference. devu-ehci.so USB manager for Enhanced Host Controller Interface standard controllers. (USB 2.0) devu-ohci.so USB manager for Open Host Controller Interface standard controllers. (USB 2.0) devu-prn Class Driver for USB printers. devu-uhci.
Chapter 4 USB Library Reference In this chapter. . .
2006, QNX Software Systems GmbH & Co. KG.
2006, QNX Software Systems GmbH & Co. KG. Functions arranged by category Functions arranged by category The USB functions may be grouped into these categories: ¯ Connection functions ¯ Memory-management functions ¯ I/O functions ¯ Pipe-management functions ¯ Configuration/interface functions ¯ Miscellaneous functions Connection functions usbd connect() Connect a client driver to the USB stack. usbd disconnect() Disconnect a client driver from the USB stack. usbd attach() Attach to a USB device.
Functions arranged by category 2006, QNX Software Systems GmbH & Co. KG. I/O functions usbd setup bulk() Set up a URB for a bulk data transfer. usbd setup interrupt() Set up a URB for an interrupt transfer. usbd setup isochronous() Set up a URB for an isochronous transfer. usbd setup vendor() Set up a URB for a vendor-specific transfer. usbd setup control() Set up a URB for a control transfer. usbd io() Submit a previously set up URB to the USB stack.
Functions arranged by category 2006, QNX Software Systems GmbH & Co. KG. usbd abort pipe() Abort all requests on a pipe. usbd pipe device() Retrieve the device associated with the pipe. usbd pipe endpoint() Retrieve the endpoint number associated with the pipe. Configuration/ interface functions usbd select config() Select the configuration for a USB device. usbd select interface() Select the interface for a USB device.
Functions arranged by category 2006, QNX Software Systems GmbH & Co. KG. usbd endpoint descriptor() Get the endpoint descriptor for a specific endpoint setting. usbd get frame() Get the current frame number and frame length for a device. usbd hcd info() Get information on the USB host controller and SDK library. usbd hub descriptor() Get the hub descriptor for a specific (hub) device. usbd interface descriptor() Get the interface descriptor for a specific interface setting.
usbd abort pipe() 2006, QNX Software Systems GmbH & Co. KG. Abort all requests on a pipe Synopsis: #include int usbd abort pipe( struct usbd pipe *pipe ); Description: The usbd abort pipe() function aborts all requests on a pipe. This function can be used during an error condition (e.g. to abort a pending operation) or during normal operation (e.g. to halt an isochronous transfer). pipe An opaque handle returned by usbd open pipe(). EOK Success.
usbd alloc() 2006, QNX Software Systems GmbH & Co. KG. Allocate memory area to use for data transfers Synopsis: #include void *usbd alloc( size t size ); Description: The usbd alloc() function allocates a memory area that can then be used for data transfers. You should use the memory area allocated by this function, because it’s allocated efficiently and because its physical address is quickly obtained via usbd mphys().
usbd alloc() 2006, QNX Software Systems GmbH & Co. KG.
usbd alloc urb() 2006, QNX Software Systems GmbH & Co. KG. Allocate a USB Request Block for subsequent URB-based operations Synopsis: #include struct usbd urb *usbd alloc urb( struct usbd urb *link ); Description: The usbd alloc urb() function allocates a USB Request Block (URB) to be used for subsequent URB-based I/O transfers. link Specifies multiple URBs linked together. (Not yet implemented.) To free the block, use usbd free urb().
2006, QNX Software Systems GmbH & Co. KG.
usbd args lookup() 2006, QNX Software Systems GmbH & Co. KG. Look up a driver’s command-line arguments Synopsis: #include void usbd args lookup(struct usbd connection *connection, int *argc, char ***argv ); Description: The usbd args lookup() function lets you look up a device driver’s command-line arguments at insertion/attach time. The command-line arguments are held in argc and argv within the usbd connect parm data structure. See usbd connect() for details.
2006, QNX Software Systems GmbH & Co. KG. usbd attach() Attach to a USB device Synopsis: #include int usbd attach( struct usbd connection *connection, usbd device instance t *instance, size t extra, struct usbd device **device ); Description: You use the usbd attach() function to attach to a USB device. Typically, you do this out of the insertion callback (made when the device matched your filter), which will give you the connection and instance parameters involved.
usbd attach() 2006, QNX Software Systems GmbH & Co. KG. typedef struct usbd device instance { uint8 path; uint8 devno; uint16 generation; ident; usbd device ident t uint32 config; uint32 iface; uint32 alternate; } usbd device instance t; Looping Another way to attach is to loop and attach to all devices (in which case you build the instance yourself). For example: for (devno = 0; devno < 64; ++devno) { memset(&instance, USBD CONNECT WILDCARD, sizeof(usbd device instance t)); instance.
usbd attach() 2006, QNX Software Systems GmbH & Co. KG.
usbd close pipe() 2006, QNX Software Systems GmbH & Co. KG. Close a pipe previously opened by usbd open pipe() Synopsis: #include int usbd close pipe( struct usbd pipe *pipe ); Description: You use the usbd close pipe() function to close a pipe that was previously opened via usbd open pipe(). pipe An opaque handle returned by usbd open pipe(). Returns: EOK Success. EBUSY Active or pending I/O.
2006, QNX Software Systems GmbH & Co. KG. usbd configuration descriptor() Get the configuration descriptor for a specific configuration setting Synopsis: #include usbd configuration descriptor t *usbd configuration descriptor( struct usbd device *device, uint8 cfg, struct usbd desc node **node ); Description: The usbd configuration descriptor() function lets you obtain the configuration descriptor for a specific configuration setting.
usbd configuration descriptor() 2006, QNX Software Systems GmbH & Co. KG. Returns: A pointer to usbd configuration descriptor t on success, or NULL on error.
usbd connect() 2006, QNX Software Systems GmbH & Co. KG. Connect a client driver to the USB stack Synopsis: #include int usbd connect( usbd connect parm t *parm, struct usbd connection **connection ); Description: You use the usbd connect() function to connect to a USB device and to provide insertion/removal callbacks (in the usbd connect parm t data structure). parm Connection parameters describing how to connect to the USB stack and how you intend to operate with it.
usbd connect() 2006, QNX Software Systems GmbH & Co. KG. flags Currently none defined. Pass 0. argc and argv Command-line arguments to the device driver that can be made available via usbd args lookup() at insertion/attach time. evtbufsz Size of the event buffer used by the handler thread to buffer events from the USB stack. For the default size, pass 0.
usbd connect() 2006, QNX Software Systems GmbH & Co. KG. event A future extension for various other event notifications (e.g. bandwidth problems). USBDI NFUNCS A constant that goes into nentries. ☞ By passing NULL as the usbd funcs, you’re saying that you’re not interested in receiving dynamic insertion/removal notifications, which means that you won’t be a fully operational class driver. No asynchronous I/O will be allowed, no event thread, etc.
usbd connect() 2006, QNX Software Systems GmbH & Co. KG.
2006, QNX Software Systems GmbH & Co. KG. usbd connect() resources used between that thread and any other thread(s) in your class driver are properly protected (e.g. via a mutex).
usbd descriptor() 2006, QNX Software Systems GmbH & Co. KG. Get USB descriptors. Synopsis: #include int usbd descriptor( struct usbd device *device, int set, uint8 type, uint16 rtype, uint8 index, uint16 langid, uint8 *desc, size t len ); Description: The usbd descriptor() function lets you obtain the USB descriptors. 40 device An opaque handle used to identify the USB device. set A flag that says to either get or set a descriptor. type Type of descriptor (e.g.
usbd descriptor() 2006, QNX Software Systems GmbH & Co. KG. Returns: EMSGSIZE Buffer too small for descriptor. ENOMEM No memory for URB. ENODEV Device was removed. EIO I/O error on USB device.
usbd detach() 2006, QNX Software Systems GmbH & Co. KG. Detach from the USB device Synopsis: #include int usbd detach( struct usbd device *device ); Description: You use the usbd detach() function to disconnect from a USB device that you previously had attached to via usbd attach(). The usbd detach() function automatically closes any pipes previously opened via usbd open pipe(). device An opaque handle from usbd attach(). Returns: EOK Success. EBUSY I/O pending on the device.
2006, QNX Software Systems GmbH & Co. KG. usbd detach() Caveats: Don’t try to detach if there’s I/O pending on the device. If there is, usbd detach() will fail.
usbd device descriptor() 2006, QNX Software Systems GmbH & Co. KG. Get the device descriptor for a specific device Synopsis: #include usbd device descriptor t *usbd device descriptor( struct usbd device *device, struct usbd desc node **node ); Description: The usbd device descriptor() function lets you obtain the device descriptor for a specific device (a handle from usbd attach()). The node parameter tells you where a descriptor was found to root future requests from (e.g.
usbd device descriptor() 2006, QNX Software Systems GmbH & Co. KG.
usbd device extra() 2006, QNX Software Systems GmbH & Co. KG. Get a pointer to the memory allocated by the extra parameter Synopsis: #include void *usbd device extra( struct usbd device *device ); Description: You use the usbd device extra() function to get a pointer to the additional memory allocated via the extra parameter in usbd attach(). Returns: NULL if no device-specific memory was allocated by usbd attach().
usbd device lookup() 2006, QNX Software Systems GmbH & Co. KG. Map the device instance identifier to an opaque device handle (from usbd attach()) Synopsis: #include struct usbd device *usbd device lookup( struct usbd connection *connection, usbd device instance t *instance ); Description: You use the usbd device lookup() function to map the device instance identifier to an opaque device handle from usbd attach(). This would typically be required in the removal callback.
usbd disconnect() 2006, QNX Software Systems GmbH & Co. KG. Disconnect a client driver from the USB stack Synopsis: #include int usbd disconnect( struct usbd connection *connection ); Description: You use the usbd disconnect() to disconnect a client driver that had been previously connected to the USB stack via the usbd connect() function. The usbd disconnect() function automatically closes any pipes previously opened via usbd attach().
2006, QNX Software Systems GmbH & Co. KG.
usbd endpoint descriptor() 2006, QNX Software Systems GmbH & Co. KG. Get the endpoint descriptor for a specific endpoint setting Synopsis: #include usbd endpoint descriptor t *usbd endpoint descriptor( struct usbd device *device, uint8 config, uint8 iface, uint8 alt, uint8 endpoint, struct usbd desc node **node ); Description: The usbd endpoint descriptor() function lets you obtain the endpoint descriptor for a specific endpoint on a configuration/interface.
2006, QNX Software Systems GmbH & Co. KG. usbd endpoint descriptor() Returns: A pointer to usbd endpoint descriptor t on success, or NULL on error.
usbd feature() 2006, QNX Software Systems GmbH & Co. KG. Control a feature for a USB device. Synopsis: #include int usbd feature( struct usbd device *device, int set, uint16 feature, uint16 rtype, uint16 index ); Description: The usbd feature() function lets you control a specific feature on a USB device. device An opaque handle used to identify the USB device. set Set or clear a feature on the USB device. feature A specific feature on the device. rtype Type of request (e.g.
usbd feature() 2006, QNX Software Systems GmbH & Co. KG.
usbd free() 2006, QNX Software Systems GmbH & Co. KG. Free the memory area allocated by usbd alloc() Synopsis: #include void usbd free( void* ptr ); Description: The usbd free() function frees the memory allocated by usbd alloc(). The function deallocates the memory area specified by ptr, which was previously returned by a call to usbd mphys(). It’s safe to call usbd free() with a NULL ptr. Returns: EOK Success.
usbd free urb() 2006, QNX Software Systems GmbH & Co. KG. Free the USB Request Block allocated by usbd alloc urb() Synopsis: #include struct usbd urb *usbd free urb( struct usbd urb *urb ); Description: The usbd free urb() function frees the memory allocated by usbd alloc urb(). Returns: EOK Success.
usbd get frame() 2006, QNX Software Systems GmbH & Co. KG. Get the current frame number and frame length for a device Synopsis: int usbd get frame( struct usdb device *device, int32 *fnum, int32 *flen ); Description: This function gets the current frame number and frame length for a specific device (a handle from usbd attach()). fnum If non-NULL, this is set to the frame number. flen If non-NULL, this is set to the frame length. Returns: EOK Success. ENODEV The device has been removed.
2006, QNX Software Systems GmbH & Co. KG.
usbd hcd info() 2006, QNX Software Systems GmbH & Co. KG. Get information on the USB host controller and SDK library Synopsis: #include int usbd hcd info( struct usbd connection *connection, uint32 cindex, usbd hcd info t *info ); Description: You use the usbd hcd info() function to obtain information from the USB host controller and SDK library. connection Identifies the USB stack (from usbd connect()). cindex Gets information about a specific host controller.
usbd hcd info() 2006, QNX Software Systems GmbH & Co. KG. Returns: Success.
usbd hub descriptor() 2006, QNX Software Systems GmbH & Co. KG. Get the hub descriptor for a specific (hub) device Synopsis: #include usbd hub descriptor t *usbd hub descriptor( struct usbd device *device, struct usbd desc node **node ); Description: The usbd hub descriptor() function lets you obtain a hub descriptor. device An opaque handle used to identify the USB device. node Indicates the descriptor’s location for rooting future requests.
usbd hub descriptor() 2006, QNX Software Systems GmbH & Co. KG.
usbd interface descriptor() 2006, QNX Software Systems GmbH & Co. KG. Get the interface descriptor for a specific interface setting Synopsis: #include usbd interface descriptor t *usbd interface descriptor( struct usbd device *device, uint8 cfg, uint8 ifc, uint8 alt, struct usbd desc node **node ); Description: The usbd interface descriptor() function lets you obtain the interface descriptor for a specific interface setting. device An opaque handle used to identify the USB device.
2006, QNX Software Systems GmbH & Co. KG. usbd interface descriptor() Returns: A pointer to usbd interface descriptor t on success, or NULL on error.
usbd io() 2006, QNX Software Systems GmbH & Co. KG. Submit a previously set up URB to the USB stack Synopsis: #include int usbd io( struct usbd urb *urb, struct usbd pipe *pipe, void (*func)(struct usbd urb *, struct usbd pipe *, void *), void *handle, uint32 timeout ); Description: This routine submits a previously set up URB to the USB stack.
usbd io() 2006, QNX Software Systems GmbH & Co. KG. Returns: EBADF Improper usbd connect() call. EINVAL Improper usbd connect() call. ENODEV Device was removed.
usbd languages descriptor() 2006, QNX Software Systems GmbH & Co. KG. Get the table of supported LANGIDs for the given device Synopsis: #include usbd string descriptor t *usbd languages descriptor( struct usbd device *device, struct usbd desc node **node ); Description: The usbd languages descriptor() function lets you obtain the table of supported language IDs for the device. device An opaque handle used to identify the USB device.
2006, QNX Software Systems GmbH & Co. KG.
usbd mphys() 2006, QNX Software Systems GmbH & Co. KG. Get the physical address of memory allocated by usbd alloc() Synopsis: #include paddr t usbd mphys( const void *ptr ); Description: The usbd mphys() function obtains the physical address used by usbd alloc() to allocate memory for a data transfer. Returns: Physical address.
usbd open pipe() 2006, QNX Software Systems GmbH & Co. KG. Initialize the pipe described by the device or endpoint descriptor Synopsis: #include int usbd open pipe( struct usbd device *device, usbd descriptors t *desc, struct usbd pipe **pipe ); Description: You use the usbd open pipe() function to initialize the pipe described by the endpoint descriptor. device An opaque handle used to identify the USB device.
usbd open pipe() 2006, QNX Software Systems GmbH & Co. KG.
2006, QNX Software Systems GmbH & Co. KG. usbd parse descriptors() Parse device descriptors looking for a specific entry Synopsis: #include
usbd parse descriptors() | (INTERFACE) - ..... | (ENDPOINT) - ..... 2006, QNX Software Systems GmbH & Co. KG. (INTERFACE) (ENDPOINT) Any vendor-specific or class-specific descriptors that are embedded into the standard descriptor output are also inserted into this tree at the appropriate point. Although a descriptor for endpoint 0 (control) isn’t present on the wire, one is constructed and placed in the tree (to simplify enumeration within the class driver).
usbd parse descriptors() 2006, QNX Software Systems GmbH & Co. KG.
usbd pipe device() 2006, QNX Software Systems GmbH & Co. KG. Retrieve the device associated with the pipe Synopsis: #include struct usbd device* usbd pipe device( struct usbd pipe *pipe ); Description: You use the usbd pipe device() to retrieve the device associated with pipe (an opaque handle returned by usbd open pipe()). Returns: A pointer to a usbd device that describes the device.
usbd pipe endpoint() 2006, QNX Software Systems GmbH & Co. KG. Retrieve the endpoint number associated with the pipe Synopsis: #include uint32 usbd pipe endpoint( struct usbd pipe *pipe ); Description: You use the usbd pipe endpoint() to retrieve the endpoint number associated with pipe (an opaque handle returned by usbd open pipe()). Returns: A pipe/endpoint number.
usbd reset device() 2006, QNX Software Systems GmbH & Co. KG. Reset a USB device Synopsis: #include int usbd reset device( struct usbd device *device ); Description: You use the usbd reset device() function to reset the specified device. Returns: EOK Success. ENODEV Device was removed.
usbd reset pipe() 2006, QNX Software Systems GmbH & Co. KG. Clear a stall condition on an endpoint identified by the pipe handle Synopsis: #include int usbd reset pipe( struct usbd pipe *pipe ); Description: You use the usbd reset pipe() function to clear a stall condition on an endpoint identified by the pipe handle. Returns: EOK Success. ENOMEM No memory for URB. ENODEV Device was removed.
usbd select config() 2006, QNX Software Systems GmbH & Co. KG. Select the configuration for a USB device Synopsis: #include int usbd select config( struct usbd device *device, uint8 cfg ); Description: You use the usbd select config() function to select the configuration for a USB device. device An opaque handle used to identify the USB device. cfg The device’s configuration identifier (bConfigurationValue). Returns: EOK Success. ENOMEM No memory for URB.
2006, QNX Software Systems GmbH & Co. KG.
usbd select interface() 2006, QNX Software Systems GmbH & Co. KG. Select the interface for a USB device Synopsis: #include int usbd select interface( struct usbd device *device, uint8 ifc, uint8 alt ); Description: You use the usbd select interface() function to select the interface for a USB device. device An opaque handle used to identify the USB device. ifc Interface identifier (bInterfaceNumber). alt Alternate identifier (bAlternateSetting). Returns: EOK Success.
2006, QNX Software Systems GmbH & Co. KG.
usbd setup bulk() 2006, QNX Software Systems GmbH & Co. KG. Set up a URB for a bulk data transfer Synopsis: #include int usbd setup bulk( struct usbd urb *urb, uint32 flags, void *addr, uint32 len ); Description: This routine sets up a URB for a bulk data transfer. urb An opaque handle (from usbd alloc urb()). flags One of the following: ¯ URB DIR IN—Specify incoming (device-to-PC) transfer. ¯ URB DIR OUT—Specify outgoing (PC-to-device) transfer.
usbd setup bulk() 2006, QNX Software Systems GmbH & Co. KG. Safety Cancellation point No Interrupt handler No Signal handler No Thread Yes Caveats: To ensure that the correct physical address will be used, you must use the buffer allocated by usbd alloc() for the addr parameter.
usbd setup control() 2006, QNX Software Systems GmbH & Co. KG. Set up a URB for a control transfer Synopsis: ! CAUTION: This function is still under development and other details shown here may change significantly! its synopsis #include usbd setup control( struct usbd urb *urb, uint32 flags, uint16 request, uint16 rtype, uint16 value, uint16 index, void *addr, uint32 len ); Description: This routine sets up a URB for a control transfer. urb An opaque handle (from usbd alloc urb()).
usbd setup control() 2006, QNX Software Systems GmbH & Co. KG. addr Address for start of transfer — you must use the buffer allocated by usbd alloc(). len The length (in bytes) of the data transfer. Returns: EOK Success. Classification: QNX Neutrino, QNX 4 Safety Cancellation point No Interrupt handler No Signal handler No Thread Yes Caveats: To ensure that the correct physical address will be used, you must use the buffer allocated by usbd alloc() for the addr parameter.
usbd setup interrupt() 2006, QNX Software Systems GmbH & Co. KG. Set up a URB for an interrupt transfer Synopsis: #include int usbd setup interrupt( struct usbd urb *urb, uint32 flags, void *addr, uint32 len ); Description: This routine sets up a URB for an interrupt transfer. urb An opaque handle (from usbd alloc urb()). flags One of the following: ¯ URB DIR IN—Specify incoming (device-to-PC) transfer. ¯ URB DIR OUT—Specify outgoing (PC-to-device) transfer.
usbd setup interrupt() 2006, QNX Software Systems GmbH & Co. KG.
usbd setup isochronous() 2006, QNX Software Systems GmbH & Co. KG. Set up a URB for an isochronous transfer Synopsis: ! CAUTION: This function is still under development - its synopsis and other details shown here may change significantly! #include int usbd setup isochronous( struct usbd urb *urb, uint32 flags, int32 frame, void *addr, uint32 len ); Description: This routine sets up a URB for an isochronous transfer. urb An opaque handle (from usbd alloc urb()).
usbd setup isochronous() 2006, QNX Software Systems GmbH & Co. KG. Returns: EOK Success.
usbd setup vendor() 2006, QNX Software Systems GmbH & Co. KG. Set up a URB for a vendor-specific transfer Synopsis: #include int usbd setup vendor( struct usbd urb *urb, uint32 flags, uint16 request, uint16 rtype, uint16 value, uint16 index, void *addr, uint32 len ); Description: This routine sets up a URB for a vendor-specific transfer. ☞ For this release of the USB SDK, vendor requests are synchronous only. Therefore, the func parameter in usbd io() must be NULL.
usbd setup vendor() 2006, QNX Software Systems GmbH & Co. KG. index This varies, depending on the request. It’s used for passing a parameter to the device. addr Address for start of transfer — you must use the buffer allocated by usbd alloc(). len The length (in bytes) of the data transfer. Returns: EOK Success.
usbd status() 2006, QNX Software Systems GmbH & Co. KG. Get specific device status Synopsis: #include int usbd status( struct usbd device *device, uint16 rtype, uint16 index, void *addr, uint32 len ) Description: You use the usbd status() function to get specific device status. device An opaque handle used to identify the USB device. rtype Type of request (e.g.
usbd status() 2006, QNX Software Systems GmbH & Co. KG.
usbd string() 2006, QNX Software Systems GmbH & Co. KG. Get a string descriptor Synopsis: #include char *usbd string( struct usbd device *device, uint8 index, int langid ); Description: The usbd string() function lets you obtain a string from the USB device’s table of strings. Typically, the string table may contain the names of the vendor, the product, etc. The string table is optional. device An opaque handle used to identify the USB device.
usbd string() 2006, QNX Software Systems GmbH & Co. KG.
usbd topology() 2006, QNX Software Systems GmbH & Co. KG. Get the USB bus physical topology Synopsis: #include int usbd topology( struct usbd connection *connection, usbd bus topology t *tp ) Description: You use the usbd topology() function to get the USB bus physical topology. ☞ For more information on USB bus topology, see sections 4.1.1 and 5.2.3 in the USB Specification v1.1. Here are the parameters: connection An opaque handle that identifies the USB stack (from usbd connect()).
usbd topology() 2006, QNX Software Systems GmbH & Co. KG. Returns: EOK Success. ENODEV Device was removed.
usbd urb status() 2006, QNX Software Systems GmbH & Co. KG. Return status information on a URB Synopsis: #include int usbd urb status( struct usbd urb *urb, uint32 *status, uint32 *len ) Description: You use the usbd urb status() function to extract completion status and data-transfer length from a URB. urb An opaque handle (from usbd alloc urb()). status Completion status (see below). len The actual length (in bytes) of the data transfer.
usbd urb status() 2006, QNX Software Systems GmbH & Co. KG. USBD STATUS CRC ERR The last packet from the endpoint contained a CRC error. USBD STATUS BITSTUFFING The last packet from the endpoint contained a bit-stuffing violation. USBD STATUS TOGGLE MISMATCH The last packet from the endpoint had the wrong data-toggle PID. USBD STATUS STALL The endpoint returned a STALL PID. USBD STATUS DEV NOANSWER Device didn’t respond to token (IN) or didn’t provide a handshake (OUT).
usbd urb status() 2006, QNX Software Systems GmbH & Co. KG. USBD STATUS NOT ACCESSED Controller didn’t execute request. Returns: EOK Success. EBUSY URB I/O still active. ETIMEDOUT Timeout occurred. EINTR Operation aborted/interrupted. ENODEV Device removed. EIO I/O error.
Index A L assumptions ix looping, as alternate method of attaching 30 C P callbacks 10, 30, 36 class driver typical operations 10 pipe D S data buffers 9 shared memory I U insertion/removal 10, 30, 36, 37 USB link to www.usb.org x Specification revision 2.
Index 2006, QNX Software Systems GmbH & Co. KG.