LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 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 (LPC)
 Pipe control request management definitions for the NXP LPC 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_SendControlRequest (const uint8_t corenum, 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.
 
uint8_t USB_Host_SetDeviceConfiguration (const uint8_t corenum, const uint8_t ConfigNumber)
 Sends a SET CONFIGURATION standard request to the attached device, with the given configuration index.
 
uint8_t USB_Host_GetDeviceDescriptor (const uint8_t corenum, void *const DeviceDescriptorPtr) ATTR_NON_NULL_PTR_ARG(2)
 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.
 
uint8_t USB_Host_GetDeviceStringDescriptor (const uint8_t corenum, const uint8_t Index, void *const Buffer, const uint8_t BufferLength) ATTR_NON_NULL_PTR_ARG(3)
 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.
 
uint8_t USB_Host_GetDeviceStatus (const uint8_t corenum, uint8_t *const FeatureStatus) ATTR_NON_NULL_PTR_ARG(2)
 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.
 
uint8_t USB_Host_ClearEndpointStall (const uint8_t corenum, const uint8_t EndpointAddress)
 Clears a stall condition on the given pipe, via a CLEAR FEATURE standard request to the attached device.
 
uint8_t USB_Host_SetInterfaceAltSetting (const uint8_t corenum, 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.
 

Detailed Description

Pipe control request definitions.

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.

Definition at line 71 of file HostStandardReq.h.

Function Documentation

uint8_t USB_Host_ClearEndpointStall ( const uint8_t  corenum,
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
corenum: USB port number
EndpointAddress: Address of the endpoint to clear, including the endpoint's direction.
Returns
A value from the USB_Host_SendControlErrorCodes_t enum to indicate the result.

Definition at line 299 of file HostStandardReq.c.

uint8_t USB_Host_GetDeviceDescriptor ( const uint8_t  corenum,
void *const  DeviceDescriptorPtr 
)

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.

Note
After this routine returns, the control pipe will be selected.
Parameters
corenum: USB port number
DeviceDescriptorPtr: Pointer 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.

Definition at line 248 of file HostStandardReq.c.

uint8_t USB_Host_GetDeviceStatus ( const uint8_t  corenum,
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
corenum: USB port number
FeatureStatus: Location where the retrieved feature status should be stored.
Returns
A value from the USB_Host_SendControlErrorCodes_t enum to indicate the result.

Definition at line 283 of file HostStandardReq.c.

uint8_t USB_Host_GetDeviceStringDescriptor ( const uint8_t  corenum,
const uint8_t  Index,
void *const  Buffer,
const uint8_t  BufferLength 
)

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.

Note
After this routine returns, the control pipe will be selected.
Parameters
corenum: USB port number
Index: Index of the string index to retrieve.
Buffer: Pointer to the destination buffer where the retrieved string descriptor is to be stored.
BufferLength: Maximum 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.

Definition at line 264 of file HostStandardReq.c.

uint8_t USB_Host_SendControlRequest ( const uint8_t  corenum,
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
corenum: USB port number
BufferPtr: Pointer 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.

Definition at line 45 of file HostStandardReq.c.

uint8_t USB_Host_SetDeviceConfiguration ( const uint8_t  corenum,
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
corenum: USB port number
ConfigNumber: Configuration index to send to the device.
Returns
A value from the USB_Host_SendControlErrorCodes_t enum to indicate the result.

Definition at line 224 of file HostStandardReq.c.

uint8_t USB_Host_SetInterfaceAltSetting ( const uint8_t  corenum,
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
corenum: USB port number
InterfaceIndex: Index of the interface whose alternative setting is to be altered.
AltSetting: Index 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.

Definition at line 315 of file HostStandardReq.c.