forked from mfulz_github/qmk_firmware
Fix bugs in the Host mode Audio class driver.
This commit is contained in:
parent
6e2a3174a5
commit
6e0a26083a
@ -102,7 +102,7 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa
|
|||||||
Size = DataINEndpoint->EndpointSize;
|
Size = DataINEndpoint->EndpointSize;
|
||||||
EndpointAddress = DataINEndpoint->EndpointAddress;
|
EndpointAddress = DataINEndpoint->EndpointAddress;
|
||||||
Token = PIPE_TOKEN_IN;
|
Token = PIPE_TOKEN_IN;
|
||||||
Type = EP_TYPE_BULK;
|
Type = EP_TYPE_ISOCHRONOUS;
|
||||||
DoubleBanked = true;
|
DoubleBanked = true;
|
||||||
|
|
||||||
AudioInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
|
AudioInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
|
||||||
@ -211,6 +211,9 @@ uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInte
|
|||||||
uint16_t const DataLength,
|
uint16_t const DataLength,
|
||||||
void* const Data)
|
void* const Data)
|
||||||
{
|
{
|
||||||
|
if (!(AudioInterfaceInfo->State.IsActive))
|
||||||
|
return HOST_SENDCONTROL_DeviceDisconnected;
|
||||||
|
|
||||||
uint8_t RequestType;
|
uint8_t RequestType;
|
||||||
uint8_t EndpointAddress;
|
uint8_t EndpointAddress;
|
||||||
|
|
||||||
|
@ -79,8 +79,14 @@
|
|||||||
{
|
{
|
||||||
const struct
|
const struct
|
||||||
{
|
{
|
||||||
uint8_t DataINPipeNumber; /**< Pipe number of the Audio interface's IN data pipe. */
|
uint8_t DataINPipeNumber; /**< Pipe number of the Audio interface's IN data pipe. If this interface should not
|
||||||
uint8_t DataOUTPipeNumber; /**< Pipe number of the Audio interface's OUT data pipe. */
|
* bind to an IN endpoint, this may be set to 0 to disable audio input streaming for
|
||||||
|
* this driver instance.
|
||||||
|
*/
|
||||||
|
uint8_t DataOUTPipeNumber; /**< Pipe number of the Audio interface's OUT data pipe. If this interface should not
|
||||||
|
* bind to an OUT endpoint, this may be set to 0 to disable audio output streaming for
|
||||||
|
* this driver instance.
|
||||||
|
*/
|
||||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||||
*/
|
*/
|
||||||
@ -325,10 +331,11 @@
|
|||||||
{
|
{
|
||||||
Pipe_Write_8(Sample);
|
Pipe_Write_8(Sample);
|
||||||
|
|
||||||
if (Pipe_BytesInPipe() == AudioInterfaceInfo->State.DataOUTPipeSize)
|
if (!(Pipe_IsReadWriteAllowed()))
|
||||||
{
|
{
|
||||||
Pipe_Unfreeze();
|
Pipe_Unfreeze();
|
||||||
Pipe_ClearOUT();
|
Pipe_ClearOUT();
|
||||||
|
Pipe_WaitUntilReady();
|
||||||
Pipe_Freeze();
|
Pipe_Freeze();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -348,10 +355,11 @@
|
|||||||
{
|
{
|
||||||
Pipe_Write_16_LE(Sample);
|
Pipe_Write_16_LE(Sample);
|
||||||
|
|
||||||
if (Pipe_BytesInPipe() == AudioInterfaceInfo->State.DataOUTPipeSize)
|
if (!(Pipe_IsReadWriteAllowed()))
|
||||||
{
|
{
|
||||||
Pipe_Unfreeze();
|
Pipe_Unfreeze();
|
||||||
Pipe_ClearOUT();
|
Pipe_ClearOUT();
|
||||||
|
Pipe_WaitUntilReady();
|
||||||
Pipe_Freeze();
|
Pipe_Freeze();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -372,10 +380,11 @@
|
|||||||
Pipe_Write_16_LE(Sample);
|
Pipe_Write_16_LE(Sample);
|
||||||
Pipe_Write_8(Sample >> 16);
|
Pipe_Write_8(Sample >> 16);
|
||||||
|
|
||||||
if (Pipe_BytesInPipe() == AudioInterfaceInfo->State.DataOUTPipeSize)
|
if (!(Pipe_IsReadWriteAllowed()))
|
||||||
{
|
{
|
||||||
Pipe_Unfreeze();
|
Pipe_Unfreeze();
|
||||||
Pipe_ClearOUT();
|
Pipe_ClearOUT();
|
||||||
|
Pipe_WaitUntilReady();
|
||||||
Pipe_Freeze();
|
Pipe_Freeze();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user