The USB Host management task now saves and restores the currently selected pipe before and after the task completes.
18 files changed:
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
wLength: ReportLength,\r
};\r
\r
wLength: ReportLength,\r
};\r
\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
/* Send the request to the device */\r
USB_Host_SendControlRequest(ReportOUTData);\r
}\r
/* Send the request to the device */\r
USB_Host_SendControlRequest(ReportOUTData);\r
}\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
wLength: HIDReportSize,\r
};\r
\r
wLength: HIDReportSize,\r
};\r
\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
/* Send control request to retrieve the HID report from the attached device */\r
if (USB_Host_SendControlRequest(HIDReportData) != HOST_SENDCONTROL_Successful)\r
return ParseControlError;\r
/* Send control request to retrieve the HID report from the attached device */\r
if (USB_Host_SendControlRequest(HIDReportData) != HOST_SENDCONTROL_Successful)\r
return ParseControlError;\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
return USB_Host_SendControlRequest(NULL);\r
}\r
\r
return USB_Host_SendControlRequest(NULL);\r
}\r
\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
return USB_Host_SendControlRequest(NULL);\r
}\r
\r
return USB_Host_SendControlRequest(NULL);\r
}\r
\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
if ((ErrorCode = USB_Host_SendControlRequest(MaxLUNIndex)) == HOST_SENDCONTROL_SetupStalled)\r
{\r
/* Clear the pipe stall */\r
if ((ErrorCode = USB_Host_SendControlRequest(MaxLUNIndex)) == HOST_SENDCONTROL_SetupStalled)\r
{\r
/* Clear the pipe stall */\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
wLength: HIDReportSize,\r
};\r
\r
wLength: HIDReportSize,\r
};\r
\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
/* Send control request to retrieve the HID report from the attached device */\r
if (USB_Host_SendControlRequest(HIDReportData) != HOST_SENDCONTROL_Successful)\r
return ParseControlError;\r
/* Send control request to retrieve the HID report from the attached device */\r
if (USB_Host_SendControlRequest(HIDReportData) != HOST_SENDCONTROL_Successful)\r
return ParseControlError;\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
/* Send the request, display error and wait for device detach if request fails */\r
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
{\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
return USB_Host_SendControlRequest(NULL);\r
}\r
return USB_Host_SendControlRequest(NULL);\r
}\r
+ /* Select the control pipe for the request transfer */\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
/* Send the request, display error and wait for device detach if request fails */\r
if (USB_Host_SendControlRequest(NULL) != HOST_SENDCONTROL_Successful)\r
{\r
/* Send the request, display error and wait for device detach if request fails */\r
if (USB_Host_SendControlRequest(NULL) != HOST_SENDCONTROL_Successful)\r
{\r
* - Fixed WriteNextReport code in the GenericHIDHost demo using incorrect parameter types and not selecting the correct endpoint\r
* - Adjusted sample CTC timer calculations in the AudioOutput and AudioInput demos to account for situations where the division results\r
* in a value with no remainder, requiring one to be subtracted from the result (thanks to Robin Theunis)\r
* - Fixed WriteNextReport code in the GenericHIDHost demo using incorrect parameter types and not selecting the correct endpoint\r
* - Adjusted sample CTC timer calculations in the AudioOutput and AudioInput demos to account for situations where the division results\r
* in a value with no remainder, requiring one to be subtracted from the result (thanks to Robin Theunis)\r
+ * - The USB_Host_SendControlRequest() function no longer automatically selects the Control pipe (pipe 0), so that other control type\r
+ * pipes can be used with the function\r
+ * - The USB Host management task now saves and restores the currently selected pipe before and after the task completes\r
*\r
* \section Sec_ChangeLog090401 Version 090401\r
*\r
*\r
* \section Sec_ChangeLog090401 Version 090401\r
*\r
wLength: sizeof(USB_Descriptor_Configuration_Header_t),\r
};\r
\r
wLength: sizeof(USB_Descriptor_Configuration_Header_t),\r
};\r
\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
if (BufferPtr == NULL)\r
{\r
uint8_t ConfigHeader[sizeof(USB_Descriptor_Configuration_Header_t)];\r
if (BufferPtr == NULL)\r
{\r
uint8_t ConfigHeader[sizeof(USB_Descriptor_Configuration_Header_t)];\r
static uint16_t WaitMSRemaining;\r
static uint8_t PostWaitState;\r
\r
static uint16_t WaitMSRemaining;\r
static uint8_t PostWaitState;\r
\r
+ uint8_t PrevPipe = Pipe_GetCurrentPipe();\r
+\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+\r
switch (USB_HostState)\r
{\r
case HOST_STATE_WaitForDevice:\r
switch (USB_HostState)\r
{\r
case HOST_STATE_WaitForDevice:\r
\r
USB_ResetInterface();\r
}\r
\r
USB_ResetInterface();\r
}\r
+ \r
+ Pipe_SelectPipe(PrevPipe);\r
if ((ReturnStatus = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful)\r
return ReturnStatus;\r
\r
if ((ReturnStatus = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful)\r
return ReturnStatus;\r
\r
- Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
Pipe_SetToken(PIPE_TOKEN_SETUP);\r
Pipe_ClearErrorFlags();\r
Pipe_ClearSetupSent();\r
Pipe_SetToken(PIPE_TOKEN_SETUP);\r
Pipe_ClearErrorFlags();\r
Pipe_ClearSetupSent();\r
/* Function Prototypes: */\r
/** Sends the request stored in the USB_HostRequest global structure to the attached device,\r
* and transfers the data stored in the buffer to the device, or from the device to the buffer\r
/* Function Prototypes: */\r
/** Sends the request stored in the USB_HostRequest global structure to the attached device,\r
* and transfers the data stored in the buffer to the device, or from the device to the buffer\r
+ * as requested. The transfer is made on the currently selected pipe.\r
*\r
* \param BufferPtr Pointer to the start of the data buffer if the request has a data stage, or\r
* NULL if the request transfers no data to or from the device.\r
*\r
* \param BufferPtr Pointer to the start of the data buffer if the request has a data stage, or\r
* NULL if the request transfers no data to or from the device.\r
*\r
* \section Sec_MigrationXXXXXX Migrating from 090401 to XXXXXX\r
*\r
*\r
* \section Sec_MigrationXXXXXX Migrating from 090401 to XXXXXX\r
*\r
+ * <b>Host Mode</b>\r
+ * - The USB_Host_SendControlRequest() function no longer automatically selects the Control pipe (pipe 0) to allow it to be used on\r
+ * other control type pipes. Care should be taken to ensure that the Control pipe is always selected before the function is called\r
+ * in existing projects where the Control pipe is to be operated on.\r
+ * - The USB Host management task now saves and restores the currently selected pipe before and after the task runs. Projects no longer\r
+ * need to manage this manually when calling the USB management task.\r
*\r
* \section Sec_Migration090401 Migrating from 090209 to 090401\r
*\r
*\r
* \section Sec_Migration090401 Migrating from 090209 to 090401\r
*\r