Commit 065ed4da authored by Dean Camera's avatar Dean Camera
Browse files

Added new USB_Host_GetDeviceStatus() function for USB Host mode.

parent f152ff26
...@@ -183,7 +183,7 @@ ...@@ -183,7 +183,7 @@
/* Switch /SS to input mode after configuration to allow for forced mode changes */ /* Switch /SS to input mode after configuration to allow for forced mode changes */
DDRB &= ~(1 << 0); DDRB &= ~(1 << 0);
SPCR = ((1 << SPE) | SPIOptions); SPCR = ((1 << SPE) | SPIOptions);
} }
/** Turns off the SPI driver, disabling and returning used hardware to their default configuration. */ /** Turns off the SPI driver, disabling and returning used hardware to their default configuration. */
......
...@@ -238,6 +238,22 @@ uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index, ...@@ -238,6 +238,22 @@ uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index,
return USB_Host_SendControlRequest(Buffer); return USB_Host_SendControlRequest(Buffer);
} }
uint8_t USB_Host_GetDeviceStatus(uint8_t* const FeatureStatus)
{
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE),
.bRequest = REQ_GetFeature,
.wValue = 0,
.wIndex = 0,
.wLength = 0,
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
return USB_Host_SendControlRequest(FeatureStatus);
}
uint8_t USB_Host_ClearPipeStall(const uint8_t EndpointAddress) uint8_t USB_Host_ClearPipeStall(const uint8_t EndpointAddress)
{ {
USB_ControlRequest = (USB_Request_Header_t) USB_ControlRequest = (USB_Request_Header_t)
......
...@@ -104,9 +104,7 @@ ...@@ -104,9 +104,7 @@
*/ */
uint8_t USB_Host_SendControlRequest(void* const BufferPtr); uint8_t USB_Host_SendControlRequest(void* const BufferPtr);
/** Convenience function. This routine sends a SET CONFIGURATION standard request to the attached /** Sends a SET CONFIGURATION standard request to the attached device, with the given configuration index.
* device, with the given configuration index. This can be used to easily set the device
* configuration without creating and sending the request manually.
* *
* This routine will automatically update the \ref USB_HostState and \ref USB_Host_ConfigurationNumber * This routine will automatically update the \ref USB_HostState and \ref USB_Host_ConfigurationNumber
* state variables according to the given function parameters and the result of the request. * state variables according to the given function parameters and the result of the request.
...@@ -121,9 +119,9 @@ ...@@ -121,9 +119,9 @@
*/ */
uint8_t USB_Host_SetDeviceConfiguration(const uint8_t ConfigNumber); uint8_t USB_Host_SetDeviceConfiguration(const uint8_t ConfigNumber);
/** Convenience function. This routine sends a GET DESCRIPTOR standard request to the attached /** Sends a GET DESCRIPTOR standard request to the attached device, requesting the device descriptor.
* device, requesting the device descriptor. This can be used to easily retrieve information * This can be used to easily retrieve information about the device such as its VID, PID and power
* about the device such as its VID, PID and power requirements. * requirements.
* *
* \note After this routine returns, the control pipe will be selected. * \note After this routine returns, the control pipe will be selected.
* *
...@@ -136,10 +134,9 @@ ...@@ -136,10 +134,9 @@
*/ */
uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr); uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr);
/** Convenience function. This routine sends a GET DESCRIPTOR standard request to the attached /** Sends a GET DESCRIPTOR standard request to the attached device, requesting the string descriptor
* device, requesting the string descriptor of the specified index. This can be used to easily * of the specified index. This can be used to easily retrieve string descriptors from the device by
* retrieve string descriptors from the device by index, after the index is obtained from the * index, after the index is obtained from the Device or Configuration descriptors.
* Device or Configuration descriptors.
* *
* \note After this routine returns, the control pipe will be selected. * \note After this routine returns, the control pipe will be selected.
* *
...@@ -156,6 +153,20 @@ ...@@ -156,6 +153,20 @@
void* const Buffer, void* const Buffer,
const uint8_t BufferLength); const uint8_t BufferLength);
/** 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.
*
* \ingroup Group_PipeControlReq
*
* \param[out] FeatureStatus Location where the retrieved feature status should be stored.
*
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
*/
uint8_t USB_Host_GetDeviceStatus(uint8_t* const FeatureStatus);
/** Clears a stall condition on the given pipe, via a CLEAR FEATURE standard request to the attached device. /** 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. * \note After this routine returns, the control pipe will be selected.
......
...@@ -18,13 +18,14 @@ ...@@ -18,13 +18,14 @@
* - Added support for the Audio class GET STATUS request in the Audio Device Class driver so that it is correctly ACKed when sent by the host * - Added support for the Audio class GET STATUS request in the Audio Device Class driver so that it is correctly ACKed when sent by the host
* - Added new EVENT_Audio_Device_StreamStartStop() event to the Audio Device Class driver to detect stream start/stop events * - Added new EVENT_Audio_Device_StreamStartStop() event to the Audio Device Class driver to detect stream start/stop events
* - Added board driver support for the Busware TUL board * - Added board driver support for the Busware TUL board
* - Added new Host mode Audio Class driver
* - Added new SPI_GetCurrentMode() function to the SPI peripheral driver
* - Added board hardware driver support for the EVK1100 board * - Added board hardware driver support for the EVK1100 board
* - Added board hardware driver support for the EVK1104 board * - Added board hardware driver support for the EVK1104 board
* - Added new Host mode Audio Class driver
* - Added new SPI_GetCurrentMode() function to the SPI peripheral driver
* - Added RingBuffer_GetFreeCount() function to the Ring Buffer driver
* - Added new HID_Host_SetIdlePeriod() function to the HID Host Class driver * - Added new HID_Host_SetIdlePeriod() function to the HID Host Class driver
* - Added new USB_Host_ConfigurationNumber global variable to indicate the selected configuration in an attached device * - Added new USB_Host_ConfigurationNumber global variable to indicate the selected configuration in an attached device
* - Added RingBuffer_GetFreeCount() function to the Ring Buffer driver * - Added new USB_Host_GetDeviceStatus() function to the host standard request function set
* - Library Applications: * - Library Applications:
* - Added RNDIS device mode to the Webserver project * - Added RNDIS device mode to the Webserver project
* - Added new incomplete AndroidAccessoryHost Host LowLevel demo * - Added new incomplete AndroidAccessoryHost Host LowLevel demo
...@@ -46,7 +47,8 @@ ...@@ -46,7 +47,8 @@
* - Renamed global state variables that are specific to a certain USB mode to clearly indicate which mode the variable relates to, * - Renamed global state variables that are specific to a certain USB mode to clearly indicate which mode the variable relates to,
* by changing the USB_* prefix to USB_Device_* or USB_Host_* * by changing the USB_* prefix to USB_Device_* or USB_Host_*
* - Removed the HOST_STATE_WaitForDeviceRemoval and HOST_STATE_Suspended host state machine states, as these are no longer required * - Removed the HOST_STATE_WaitForDeviceRemoval and HOST_STATE_Suspended host state machine states, as these are no longer required
* - Altered the USB_Host_SetDeviceConfiguration() function to update the new USB_Host_ConfigurationNumber global as required * - Altered the USB_Host_SetDeviceConfiguration() function to update the global Host state machine state and the new
* USB_Host_ConfigurationNumber global as required
* - Library Applications: * - Library Applications:
* - Modified the Low Level and Class Driver AudioInput and AudioOutput demos to support multiple audio sample rates * - Modified the Low Level and Class Driver AudioInput and AudioOutput demos to support multiple audio sample rates
* - Updated all host mode demos and projects to use the EVENT_USB_Host_DeviceEnumerationComplete() event callback for device configuration * - Updated all host mode demos and projects to use the EVENT_USB_Host_DeviceEnumerationComplete() event callback for device configuration
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment