The USB_Host_SendControlRequest() function no longer automatically selects the Control pipe (pipe 0), so that other control type pipes can be used with the function.
The USB Host management task now saves and restores the currently selected pipe before and after the task completes.
This commit is contained in:
parent
fea5d08512
commit
6a5a37d7d1
18 changed files with 69 additions and 2 deletions
|
|
@ -43,6 +43,8 @@ uint8_t USB_Host_GetDeviceConfigDescriptor(uint16_t* const ConfigSizePtr, void*
|
|||
wLength: sizeof(USB_Descriptor_Configuration_Header_t),
|
||||
};
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
if (BufferPtr == NULL)
|
||||
{
|
||||
uint8_t ConfigHeader[sizeof(USB_Descriptor_Configuration_Header_t)];
|
||||
|
|
|
|||
|
|
@ -86,6 +86,10 @@ static void USB_HostTask(void)
|
|||
static uint16_t WaitMSRemaining;
|
||||
static uint8_t PostWaitState;
|
||||
|
||||
uint8_t PrevPipe = Pipe_GetCurrentPipe();
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
switch (USB_HostState)
|
||||
{
|
||||
case HOST_STATE_WaitForDevice:
|
||||
|
|
@ -249,5 +253,7 @@ static void USB_HostTask(void)
|
|||
|
||||
USB_ResetInterface();
|
||||
}
|
||||
|
||||
Pipe_SelectPipe(PrevPipe);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ uint8_t USB_Host_SendControlRequest(void* BufferPtr)
|
|||
if ((ReturnStatus = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful)
|
||||
return ReturnStatus;
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
Pipe_SetToken(PIPE_TOKEN_SETUP);
|
||||
Pipe_ClearErrorFlags();
|
||||
Pipe_ClearSetupSent();
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@
|
|||
/* Function Prototypes: */
|
||||
/** Sends the request stored in the USB_HostRequest 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.
|
||||
* as requested. The transfer is made on the currently selected pipe.
|
||||
*
|
||||
* \param 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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue