Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Erik Strand
lufa
Commits
6e0a2608
Commit
6e0a2608
authored
Jun 12, 2011
by
Dean Camera
Browse files
Fix bugs in the Host mode Audio class driver.
parent
6e2a3174
Changes
4
Hide whitespace changes
Inline
Side-by-side
Demos/Host/LowLevel/AudioInputHost/ConfigDescriptor.c
View file @
6e0a2608
...
...
@@ -92,7 +92,7 @@ uint8_t ProcessConfigurationDescriptor(void)
{
/* Find a new Audio Control interface if the current one doesn't contain a compatible streaming interface */
if
(
USB_GetNextDescriptorComp
(
&
CurrConfigBytesRem
,
&
CurrConfigLocation
,
DComp_NextAudioControlInterface
)
!=
DESCRIPTOR_SEARCH_COMP_Found
)
DComp_NextAudioControlInterface
)
!=
DESCRIPTOR_SEARCH_COMP_Found
)
{
/* Descriptor not found, error out */
return
NoCompatibleInterfaceFound
;
...
...
@@ -103,7 +103,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Find the next Audio Streaming interface within that Audio Control interface */
if
(
USB_GetNextDescriptorComp
(
&
CurrConfigBytesRem
,
&
CurrConfigLocation
,
DComp_NextAudioStreamInterface
)
!=
DESCRIPTOR_SEARCH_COMP_Found
)
DComp_NextAudioStreamInterface
)
!=
DESCRIPTOR_SEARCH_COMP_Found
)
{
/* Descriptor not found, error out */
return
NoCompatibleInterfaceFound
;
...
...
Demos/Host/LowLevel/AudioOutputHost/ConfigDescriptor.c
View file @
6e0a2608
...
...
@@ -88,11 +88,11 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Check if we haven't found an Audio Control interface yet, or if we have run out of related Audio Streaming interfaces */
if
(
!
(
AudioControlInterface
)
||
USB_GetNextDescriptorComp
(
&
CurrConfigBytesRem
,
&
CurrConfigLocation
,
DComp_NextAudioStreamInterface
)
!=
DESCRIPTOR_SEARCH_COMP_Found
)
DComp_NextAudioStreamInterface
)
!=
DESCRIPTOR_SEARCH_COMP_Found
)
{
/* Find a new Audio Control interface if the current one doesn't contain a compatible streaming interface */
if
(
USB_GetNextDescriptorComp
(
&
CurrConfigBytesRem
,
&
CurrConfigLocation
,
DComp_NextAudioControlInterface
)
!=
DESCRIPTOR_SEARCH_COMP_Found
)
DComp_NextAudioControlInterface
)
!=
DESCRIPTOR_SEARCH_COMP_Found
)
{
/* Descriptor not found, error out */
return
NoCompatibleInterfaceFound
;
...
...
@@ -103,7 +103,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Find the next Audio Streaming interface within that Audio Control interface */
if
(
USB_GetNextDescriptorComp
(
&
CurrConfigBytesRem
,
&
CurrConfigLocation
,
DComp_NextAudioStreamInterface
)
!=
DESCRIPTOR_SEARCH_COMP_Found
)
DComp_NextAudioStreamInterface
)
!=
DESCRIPTOR_SEARCH_COMP_Found
)
{
/* Descriptor not found, error out */
return
NoCompatibleInterfaceFound
;
...
...
LUFA/Drivers/USB/Class/Host/Audio.c
View file @
6e0a2608
...
...
@@ -62,7 +62,7 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa
DComp_NextAudioStreamInterface
)
!=
DESCRIPTOR_SEARCH_COMP_Found
)
{
if
(
USB_GetNextDescriptorComp
(
&
ConfigDescriptorSize
,
&
ConfigDescriptorData
,
DComp_NextAudioControlInterface
)
!=
DESCRIPTOR_SEARCH_COMP_Found
)
DComp_NextAudioControlInterface
)
!=
DESCRIPTOR_SEARCH_COMP_Found
)
{
return
AUDIO_ENUMERROR_NoCompatibleInterfaceFound
;
}
...
...
@@ -70,7 +70,7 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa
AudioControlInterface
=
DESCRIPTOR_PCAST
(
ConfigDescriptorData
,
USB_Descriptor_Interface_t
);
if
(
USB_GetNextDescriptorComp
(
&
ConfigDescriptorSize
,
&
ConfigDescriptorData
,
DComp_NextAudioStreamInterface
)
!=
DESCRIPTOR_SEARCH_COMP_Found
)
DComp_NextAudioStreamInterface
)
!=
DESCRIPTOR_SEARCH_COMP_Found
)
{
return
AUDIO_ENUMERROR_NoCompatibleInterfaceFound
;
}
...
...
@@ -102,7 +102,7 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa
Size
=
DataINEndpoint
->
EndpointSize
;
EndpointAddress
=
DataINEndpoint
->
EndpointAddress
;
Token
=
PIPE_TOKEN_IN
;
Type
=
EP_TYPE_
BULK
;
Type
=
EP_TYPE_
ISOCHRONOUS
;
DoubleBanked
=
true
;
AudioInterfaceInfo
->
State
.
DataINPipeSize
=
DataINEndpoint
->
EndpointSize
;
...
...
@@ -211,6 +211,9 @@ uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInte
uint16_t
const
DataLength
,
void
*
const
Data
)
{
if
(
!
(
AudioInterfaceInfo
->
State
.
IsActive
))
return
HOST_SENDCONTROL_DeviceDisconnected
;
uint8_t
RequestType
;
uint8_t
EndpointAddress
;
...
...
LUFA/Drivers/USB/Class/Host/Audio.h
View file @
6e0a2608
...
...
@@ -79,8 +79,14 @@
{
const
struct
{
uint8_t
DataINPipeNumber
;
/**< Pipe number of the Audio interface's IN data pipe. */
uint8_t
DataOUTPipeNumber
;
/**< Pipe number of the Audio interface's OUT data pipe. */
uint8_t
DataINPipeNumber
;
/**< Pipe number of the Audio interface's IN data pipe. If this interface should not
* 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
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/
...
...
@@ -325,10 +331,11 @@
{
Pipe_Write_8
(
Sample
);
if
(
Pipe_
BytesInPipe
()
==
AudioInterfaceInfo
->
State
.
DataOUTPipeSize
)
if
(
!
(
Pipe_
IsReadWriteAllowed
())
)
{
Pipe_Unfreeze
();
Pipe_ClearOUT
();
Pipe_WaitUntilReady
();
Pipe_Freeze
();
}
}
...
...
@@ -348,10 +355,11 @@
{
Pipe_Write_16_LE
(
Sample
);
if
(
Pipe_
BytesInPipe
()
==
AudioInterfaceInfo
->
State
.
DataOUTPipeSize
)
if
(
!
(
Pipe_
IsReadWriteAllowed
())
)
{
Pipe_Unfreeze
();
Pipe_ClearOUT
();
Pipe_WaitUntilReady
();
Pipe_Freeze
();
}
}
...
...
@@ -372,10 +380,11 @@
Pipe_Write_16_LE
(
Sample
);
Pipe_Write_8
(
Sample
>>
16
);
if
(
Pipe_
BytesInPipe
()
==
AudioInterfaceInfo
->
State
.
DataOUTPipeSize
)
if
(
!
(
Pipe_
IsReadWriteAllowed
())
)
{
Pipe_Unfreeze
();
Pipe_ClearOUT
();
Pipe_WaitUntilReady
();
Pipe_Freeze
();
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment