LUFA Library  130303
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Pipe Control Request Management

Pipe control request definitions. More...

Modules

 Pipe Control Request Management (AVR8)
 Pipe control request management definitions for the Atmel AVR8 architecture.
 
 Pipe Control Request Management (UC3)
 Pipe control request management definitions for the Atmel AVR32 UC3 architecture.
 

Enumerations

enum  USB_Host_SendControlErrorCodes_t {
  HOST_SENDCONTROL_Successful = 0,
  HOST_SENDCONTROL_DeviceDisconnected = 1,
  HOST_SENDCONTROL_PipeError = 2,
  HOST_SENDCONTROL_SetupStalled = 3,
  HOST_SENDCONTROL_SoftwareTimeOut = 4
}
 

Functions

uint8_t USB_Host_ClearEndpointStall (const uint8_t EndpointAddress)
 
uint8_t USB_Host_GetDescriptor (const uint8_t Type, const uint8_t Index, void *const Buffer, const uint8_t BufferLength) ATTR_NON_NULL_PTR_ARG(3)
 
uint8_t USB_Host_GetDeviceConfiguration (uint8_t *const ConfigNumber) ATTR_NON_NULL_PTR_ARG(1)
 
static uint8_t USB_Host_GetDeviceDescriptor (USB_Descriptor_Device_t *const DeviceDescriptorPtr) ATTR_NON_NULL_PTR_ARG(1)
 
uint8_t USB_Host_GetDeviceStatus (uint8_t *const FeatureStatus) ATTR_NON_NULL_PTR_ARG(1)
 
static uint8_t USB_Host_GetDeviceStringDescriptor (const uint8_t Index, void *const Buffer, const uint8_t BufferLength) ATTR_NON_NULL_PTR_ARG(2)
 
uint8_t USB_Host_GetInterfaceAltSetting (const uint8_t InterfaceIndex, uint8_t *const AltSetting) ATTR_NON_NULL_PTR_ARG(2)
 
uint8_t USB_Host_SendControlRequest (void *const BufferPtr)
 
uint8_t USB_Host_SetDeviceConfiguration (const uint8_t ConfigNumber)
 
uint8_t USB_Host_SetInterfaceAltSetting (const uint8_t InterfaceIndex, const uint8_t AltSetting)
 

Detailed Description

Module for host mode request processing. This module allows for the transmission of standard, class and vendor control requests to the default control endpoint of an attached device while in host mode.

See Also
Chapter 9 of the USB 2.0 specification.

Enumeration Type Documentation

Enum for the USB_Host_SendControlRequest() return code, indicating the reason for the error if the transfer of the request is unsuccessful.

Enumerator
HOST_SENDCONTROL_Successful 

No error occurred in the request transfer.

HOST_SENDCONTROL_DeviceDisconnected 

The attached device was disconnected during the request transfer.

HOST_SENDCONTROL_PipeError 

An error occurred in the pipe while sending the request.

HOST_SENDCONTROL_SetupStalled 

The attached device stalled the request, usually indicating that the request is unsupported on the device.

HOST_SENDCONTROL_SoftwareTimeOut 

The request or data transfer timed out.

Function Documentation

uint8_t USB_Host_ClearEndpointStall ( const uint8_t  EndpointAddress)

Clears a stall condition on the given pipe, via a CLEAR FEATURE standard request to the attached device.

Note
After this routine returns, the control pipe will be selected.
Parameters
[in]EndpointAddressAddress of the endpoint to clear, including the endpoint's direction.
Returns
A value from the USB_Host_SendControlErrorCodes_t enum to indicate the result.
uint8_t USB_Host_GetDescriptor ( const uint8_t  Type,
const uint8_t  Index,
void *const  Buffer,
const uint8_t  BufferLength 
)

Sends a GET DESCRIPTOR standard request to the attached device, requesting the descriptor of the specified type and index.

Note
After this routine returns, the control pipe will be selected.
Parameters
[in]TypeType of descriptor to retrieve, a value from the USB_DescriptorTypes_t enum.
[in]IndexIndex of the descriptor to retrieve.
[out]BufferPointer to the destination buffer where the retrieved string descriptor is to be stored.
[in]BufferLengthMaximum size of the string descriptor which can be stored into the buffer.
Returns
A value from the USB_Host_SendControlErrorCodes_t enum to indicate the result.
uint8_t USB_Host_GetDeviceConfiguration ( uint8_t *const  ConfigNumber)

Sends a GET CONFIGURATION standard request to the attached device, to retrieve the currently selected device configuration index.

Note
After this routine returns, the control pipe will be selected.
Parameters
[out]ConfigNumberPointer to a location where the retrieved configuration index should be stored.
Returns
A value from the USB_Host_SendControlErrorCodes_t enum to indicate the result.
static uint8_t USB_Host_GetDeviceDescriptor ( USB_Descriptor_Device_t *const  DeviceDescriptorPtr)
inlinestatic

Sends a GET DESCRIPTOR standard request to the attached device, requesting the device descriptor. This can be used to easily retrieve information about the device such as its VID, PID and power requirements. This is a convenience wrapper for USB_Host_GetDescriptor().

Note
After this routine returns, the control pipe will be selected.
Parameters
[out]DeviceDescriptorPtrPointer to the destination device descriptor structure where the read data is to be stored.
Returns
A value from the USB_Host_SendControlErrorCodes_t enum to indicate the result.
uint8_t USB_Host_GetDeviceStatus ( uint8_t *const  FeatureStatus)

Retrieves the current feature status of the attached device, via a GET STATUS standard request. The retrieved feature status can then be examined by masking the retrieved value with the various FEATURE_* masks for bus/self power information and remote wakeup support.

Note
After this routine returns, the control pipe will be selected.
Parameters
[out]FeatureStatusLocation where the retrieved feature status should be stored.
Returns
A value from the USB_Host_SendControlErrorCodes_t enum to indicate the result.
static uint8_t USB_Host_GetDeviceStringDescriptor ( const uint8_t  Index,
void *const  Buffer,
const uint8_t  BufferLength 
)
inlinestatic

Sends a GET DESCRIPTOR standard request to the attached device, requesting the string descriptor of the specified index. This can be used to easily retrieve string descriptors from the device by index, after the index is obtained from the Device or Configuration descriptors. This is a convenience wrapper for USB_Host_GetDescriptor().

Note
After this routine returns, the control pipe will be selected.
Parameters
[in]IndexIndex of the string descriptor to retrieve.
[out]BufferPointer to the destination buffer where the retrieved string descriptor is to be stored.
[in]BufferLengthMaximum size of the string descriptor which can be stored into the buffer.
Returns
A value from the USB_Host_SendControlErrorCodes_t enum to indicate the result.
uint8_t USB_Host_GetInterfaceAltSetting ( const uint8_t  InterfaceIndex,
uint8_t *const  AltSetting 
)

Retrieves the current alternative setting for the specified interface, via a GET INTERFACE standard request to the attached device.

Note
After this routine returns, the control pipe will be selected.
Parameters
[in]InterfaceIndexIndex of the interface whose alternative setting is to be altered.
[out]AltSettingPointer to a location where the retrieved alternative setting value should be stored.
Returns
A value from the USB_Host_SendControlErrorCodes_t enum to indicate the result.
uint8_t USB_Host_SendControlRequest ( void *const  BufferPtr)

Sends the request stored in the USB_ControlRequest global structure to the attached device, and transfers the data stored in the buffer to the device, or from the device to the buffer as requested. The transfer is made on the currently selected pipe.

Parameters
[in]BufferPtrPointer to the start of the data buffer if the request has a data stage, or NULL if the request transfers no data to or from the device.
Returns
A value from the USB_Host_SendControlErrorCodes_t enum to indicate the result.
uint8_t USB_Host_SetDeviceConfiguration ( const uint8_t  ConfigNumber)

Sends a SET CONFIGURATION standard request to the attached device, with the given configuration index.

This routine will automatically update the USB_HostState and USB_Host_ConfigurationNumber state variables according to the given function parameters and the result of the request.

Note
After this routine returns, the control pipe will be selected.
Parameters
[in]ConfigNumberConfiguration index to send to the device.
Returns
A value from the USB_Host_SendControlErrorCodes_t enum to indicate the result.
uint8_t USB_Host_SetInterfaceAltSetting ( const uint8_t  InterfaceIndex,
const uint8_t  AltSetting 
)

Selects a given alternative setting for the specified interface, via a SET INTERFACE standard request to the attached device.

Note
After this routine returns, the control pipe will be selected.
Parameters
[in]InterfaceIndexIndex of the interface whose alternative setting is to be altered.
[in]AltSettingIndex of the interface's alternative setting which is to be selected.
Returns
A value from the USB_Host_SendControlErrorCodes_t enum to indicate the result.