www.beck-ipc.com

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


usbHostSetClearFeature

Sets or clears a feature of a given device by sending a SetFeature or ClearFeature Standard Device Request

int usbHostSetClearFeature( unsigned char driverId,

unsigned char address,
unsigned char receiver,
unsigned char index,
unsigned char feature,
UsbBool setFeature );

Parameters

driverId

ID of the user driver

address

Address of the resp. device

receiver

Receiver of the SetFeature or GetFeature request; this parameter decides whether a feature of the device, an interface, an endpoint or a user- defined structure is to be set/cleared; must be one of the following:
  • USB_SPEC_DEVICE_REQUEST_TYPE_RECEIVER_DEVICE
  • USB_SPEC_DEVICE_REQUEST_TYPE_RECEIVER_INTERFACE
  • USB_SPEC_DEVICE_REQUEST_TYPE_RECEIVER_ENDPOINT
  • USB_SPEC_DEVICE_REQUEST_TYPE_RECEIVER_OTHER
The symbolic names are defined in USB_SPEC.H.

index

Index of the resp. structure. The value of this parameter depends on the value of the receiver parameter.
If the receiver is USB_SPEC_DEVICE_REQUEST_TYPE_RECEIVER_DEVICE, the index must always be 0.
If the receiver is USB_SPEC_DEVICE_REQUEST_TYPE_RECEIVER_INTERFACE, the index must contain the ID of the resp. interface.
If the receiver is USB_SPEC_DEVICE_REQUEST_TYPE_RECEIVER_ENDPOINT, the index parameter must contain the number of the resp. endpoint. If it is an IN endpoint, bit 7 has to be set additionally. (e.g. IN endpoint 1 => 0x81).
If the receiver is USB_SPEC_DEVICE_REQUEST_TYPE_RECEIVER_OTHER, the value of the index parameter is device-specific.

feature

Identifies the feature that is to be set/cleared. Actually the feature USB_SPEC_FEATURE_REMOTE_WAKEUP is defined for devices and USB_SPEC_FEATURE_STALL for endpoints.
The symbolic names are defined in USB_SPEC.H.

setFeature

If this parameter is TRUE the feature will be set, otherwise it will be cleared.

Return Value

Error code

Comments

This function reserves endpoint 0 of the resp. device for the user driver that calls it before using the endpoint and it releases it again afterwards.
Note that this function may take up to 2000 ms to complete, because it waits that long for data to arrive from the device.
This function must not be called from within the callback-function.

RTOS API

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

Related Topics

C-library function usbWakeup()
C-library function usbDeviceStallEp()

Supported since or modified in @CHIP-RTOS version

    SC12SC13SC11SC1x3
    n/an/an/aV1.06

Supported by @CHIP-RTOS C Library since version

    CLIB
    V2.05

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


End of document