www.beck-ipc.com

@CHIP-RTOS C Library V2.06 - USB API


usbDeviceInit

Initialises the USB driver in Device mode and registers a callback-function that will be called to notify the user driver of events like completed transactions.
Also sets sundry strings that describe the device.
Only one user program can use the USB driver in Device mode.

int usbDeviceInit( UsbCallback callback,

unsigned char classCode,
unsigned char subClassCode,
unsigned char protocolCode,
unsigned vendorId,
unsigned productId,
unsigned versionBcd,
char far *manufacturerString,
char far *productString,
char far *serialNumberString,
char far *configString,
UsbBool selfPowered,
unsigned char maxPowerConsumption
unsigned char pioNumber );

Parameters

callback

Pointer to the callback-function that the USB-driver will call to notifiy the application of certain events.

classCode

Class code of the device

subClassCode

Subclass code of the device

protocolCode

Protocol code of the device

vendorId

Vendor ID of the device. The vendor ID identifies the vendor of a device. It is assigned by the USB Implementers Forum .

productId

Product code of the device. The several devices of a vendor are differed by their product ID. The vendor is free to assign any product ID.

versionBcd

Release version of the device in BCD-format. This is used to distinguish several releases of the same product.

manufacturerString

Pointer to manufacturer string (e.g. "Beck IPC GmbH")

productString

Pointer to product string (e.g. "IPC@CHIP SC123")

serialNumberString

Pointer to serial-number string (e.g. "123456-ABCDE")

configString

Pointer to configuration string

selfPowered

TRUE, if the device is self-powered

maxPowerConsumption

Maximum current that the device may draw from the bus. Given in steps of 2mA.

pioNumber

Number of PIO to be used to control attach- and speed-detection circuit; Refer to SC123/SC143hardware manual.

Return Value

Error code

Comments

The Host uses classCode, subClassCode and protocolCode to find an appropriate standard driver for the device. If classCode is 0xFF - which means that the device uses a vendor-specific protocol - the host uses vendor and product ID to find a driver.
classCode, subClassCode and protocolCode may also be set with interfaces. In this case the values here should be 0x00.

manufacturerString, productString, serialNumberString and configString are human readable strings describing the device. The host may show these to the user. The maximum length of a string is USB_SPEC_MAX_STRING_LENGTH characters. If the string is longer it will be cut. Note that they have to be static, since the driver will not copy their content but only hold a pointer. If a string shall not be used, set the pointer to NULL.

RTOS API

This library function uses a dynamic link to reach the function USB_SERVICE_DEVICE_INIT offered by RTOS USB Software Interrupt.

Related Topics

C-library function usbDeviceDeinit()

Supported since or modified in @CHIP-RTOS version

    SC12SC13SC11SC1x3
    n/an/an/aV0.90

Supported by @CHIP-RTOS C Library since version

    CLIB
    V2.01

This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document