|
Implement speaker phone function that combine 1 AC interface, 1 AS interface for speaker and 1 AS interface for microphone.
Implement speakerphone function that combine 1 AC interface, 1 AS interface for speaker and 1 AS interface for microphone.
| #define AUDD_EC_MuteChanged 1 |
usbd_audio_ec Audio Device Event codes Mute status changed
Definition at line 61 of file AUDDStream.h.
| #define AUDD_EC_VolumeChanged 2 |
Volume status changed
Definition at line 63 of file AUDDStream.h.
| typedef void(* AUDDStreamEventCallback)(uint32_t ec, uint8_t channel, void *pArg) |
Callback function for Audio Stream Event
Definition at line 71 of file AUDDStream.h.
| uint32_t AUDDSpeakerPhone_CloseStream | ( | AUDDSpeakerPhone * | pAudf, | |
| uint32_t | bInterface | |||
| ) |
Close the stream. All pending transfers are canceled.
| pAudf | Pointer to AUDDSpeakerPhone instance. | |
| bInterface | Stream interface number |
| void AUDDSpeakerPhone_Initialize | ( | AUDDSpeakerPhone * | pAudf, | |
| USBDDriver * | pUsbd, | |||
| AUDDStream * | pSpeaker, | |||
| AUDDStream * | pMicrophone | |||
| ) |
Initialize AUDDSpeakerPhone instance.
| pAudf | Pointer to AUDDSpeakerPhone instance. | |
| pUsbd | Pointer to USBDDriver instance. | |
| pSpeaker | Pointer to speaker streaming interface. | |
| pMicrophone | Pointer to microphone streaming interface. |
| void AUDDSpeakerPhone_InitializeStream | ( | AUDDStream * | pAuds, | |
| uint8_t | numChannels, | |||
| uint16_t | wChannelVolumes[], | |||
| AUDDStreamEventCallback | fCallback, | |||
| void * | pArg | |||
| ) |
Initialize AUDDStream instance. Note the number of channels excludes the master control, so actual volume array size should be (1 + numChannels).
| pAuds | Pointer to AUDDStream instance. | |
| numChannels | Number of channels in the stream (excluding master,<31). | |
| wChannelVolumes | Data array for channel volume values, must include master (1 + numChannels). | |
| fCallback | Callback function for stream control events. | |
| pArg | Pointer to event handler arguments. |
| USBGenericDescriptor * AUDDSpeakerPhone_ParseInterfaces | ( | AUDDSpeakerPhone * | pAudf, | |
| USBGenericDescriptor * | pDescriptors, | |||
| uint32_t | dwLength | |||
| ) |
Parse USB Audio streaming information for AUDDStream instance.
| pAudf | Pointer to AUDDSpeakerPhone instance. | |
| pDescriptors | Pointer to descriptor list. | |
| dwLength | Descriptor list size in bytes. |
| uint32_t AUDDSpeakerPhone_Read | ( | AUDDSpeakerPhone * | pAudf, | |
| void * | pData, | |||
| uint32_t | dwSize, | |||
| TransferCallback | fCallback, | |||
| void * | pArg | |||
| ) |
Receives data from the host through the audio function (as speaker). This function behaves like USBD_Read.
| pAudf | Pointer to AUDDSpeakerPhone instance. | |
| pData | Pointer to the data buffer to put received data. | |
| dwSize | Size of the data buffer in bytes. | |
| fCallback | Optional callback function to invoke when the transfer finishes. | |
| pArg | Optional argument to the callback function. |
| uint32_t AUDDSpeakerPhone_RequestHandler | ( | AUDDSpeakerPhone * | pAudf, | |
| const USBGenericRequest * | pRequest | |||
| ) |
Handles audio-specific USB requests sent by the host
| pAudf | Pointer to AUDDSpeakerPhone instance. | |
| pRequest | Pointer to a USBGenericRequest instance. |
| uint32_t AUDDSpeakerPhone_SetupWrite | ( | AUDDSpeakerPhone * | pAudf, | |
| void * | pListInit, | |||
| void * | pDmaInit, | |||
| uint16_t | listSize, | |||
| uint16_t | delaySize, | |||
| TransferCallback | callback, | |||
| void * | argument | |||
| ) |
Initialize Frame List for sending audio data.
| pAudf | Pointer to AUDDSpeakerPhone instance. | |
| pListInit | Pointer to the allocated list for audio write. | |
| pDmaInit | Pointer to the allocated DMA descriptors for autio write (if DMA supported). | |
| listSize | Circular list size. | |
| delaySize | Start transfer after delaySize frames filled in. | |
| callback | Optional callback function for transfer. | |
| argument | Optional callback argument. |
| uint32_t AUDDSpeakerPhone_Write | ( | AUDDSpeakerPhone * | pAudf, | |
| void * | pBuffer, | |||
| uint16_t | wLength | |||
| ) |
Add frame buffer to audio sending list.
| pAudf | Pointer to AUDDSpeakerPhone instance. | |
| pBuffer | Pointer to data frame to send. | |
| wLength | Frame size in bytes. |
| void AUDDSpeakerPhoneDriver_ConfigurationChangeHandler | ( | uint8_t | cfgnum | ) |
Invoked whenever the active configuration of device is changed by the host.
| cfgnum | Configuration number. |
| void AUDDSpeakerPhoneDriver_Initialize | ( | const USBDDriverDescriptors * | pDescriptors | ) |
Initializes an USB audio SpeakerPhone device driver, as well as the underlying USB controller.
| void AUDDSpeakerPhoneDriver_InterfaceSettingChangedHandler | ( | uint8_t | interface, | |
| uint8_t | setting | |||
| ) |
Invoked whenever the active setting of an interface is changed by the host. Changes the status of the third LED accordingly.
| interface | Interface number. | |
| setting | Newly active setting. |
| WEAK void AUDDSpeakerPhoneDriver_MuteChanged | ( | uint8_t | mic, | |
| uint8_t | channel, | |||
| uint8_t | muted | |||
| ) |
Invoked when an audio channel get muted or unmuted. Mutes/unmutes the channel at the DAC level.
| mic | Microphone/Speaker stream changed. | |
| channel | Channel number that changed. | |
| muted | Indicates the new mute status of the channel. |
| uint8_t AUDDSpeakerPhoneDriver_Read | ( | void * | buffer, | |
| uint32_t | length, | |||
| TransferCallback | callback, | |||
| void * | argument | |||
| ) |
Reads incoming audio data sent by the USB host into the provided buffer. When the transfer is complete, an optional callback function is invoked.
| buffer | Pointer to the data storage buffer. | |
| length | Size of the buffer in bytes. | |
| callback | Optional callback function. | |
| argument | Optional argument to the callback function. |
| void AUDDSpeakerPhoneDriver_RequestHandler | ( | const USBGenericRequest * | request | ) |
Handles audio-specific USB requests sent by the host, and forwards standard ones to the USB device driver.
| request | Pointer to a USBGenericRequest instance. |
| uint8_t AUDDSpeakerPhoneDriver_SetupWrite | ( | void * | pListInit, | |
| void * | pDmaInit, | |||
| uint16_t | listSize, | |||
| uint16_t | delaySize, | |||
| TransferCallback | callback, | |||
| void * | argument | |||
| ) |
Initialize Frame List for sending audio data.
| pListInit | Pointer to the allocated list for audio write. | |
| pDmaInit | Pointer to the allocated DMA descriptors for autio write (if DMA supported). | |
| listSize | Circular list size. | |
| delaySize | Start transfer after delaySize frames filled in. | |
| callback | Optional callback function for transfer. | |
| argument | Optional callback argument. |
| WEAK void AUDDSpeakerPhoneDriver_StreamSettingChanged | ( | uint8_t | mic, | |
| uint8_t | newSetting | |||
| ) |
Invoked when an audio streaming interface setting changed. Actually control streaming rate.
| mic | Microphone/Speaker stream changed. | |
| newSetting | New stream (interface) setting. |
| uint8_t AUDDSpeakerPhoneDriver_Write | ( | void * | buffer, | |
| uint16_t | length | |||
| ) |
Add frame buffer to audio sending list. Pointer to data frame to send. Frame size in bytes.
| uint32_t AUDDStream_ChangeMute | ( | AUDDStream * | pAuds, | |
| uint8_t | bChannel, | |||
| uint8_t | bMute | |||
| ) |
Change Stream Mute status.
| pAuds | Pointer to AUDDStream instance. | |
| bChannel | Channel number. | |
| bmMute | 1 to mute, 0 to unmute. |
| uint32_t AUDDStream_Close | ( | AUDDStream * | pStream | ) |
Close the stream. All pending transfers are canceled.
| pStream | Pointer to AUDDStream instance. |
| void AUDDStream_Initialize | ( | AUDDStream * | pAuds, | |
| uint8_t | numChannels, | |||
| uint16_t | wChannelVolumes[], | |||
| AUDDStreamEventCallback | fCallback, | |||
| void * | pArg | |||
| ) |
Initialize AUDDStream instance. Note the number of channels excludes the master control, so actual volume array size should be (1 + numChannels).
| pAuds | Pointer to AUDDStream instance. | |
| numChannels | Number of channels in the stream (<31). | |
| wChannelVolumes | Data array for channel volume values. | |
| fCallback | Callback function for stream events. | |
| pArg | Pointer to event handler arguments. |
| uint32_t AUDDStream_IsRequestAccepted | ( | AUDDStream * | pAuds, | |
| const USBGenericRequest * | pReq | |||
| ) |
Check if the request is accepted.
| pAuds | Pointer to AUDDStream instance. | |
| pReq | Pointer to a USBGenericRequest instance. |
| uint32_t AUDDStream_Read | ( | AUDDStream * | pAuds, | |
| void * | pData, | |||
| uint32_t | dwSize, | |||
| TransferCallback | fCallback, | |||
| void * | pArg | |||
| ) |
Receives data from the host through the audio function (as speaker). This function behaves like USBD_Read.
| pAuds | Pointer to AUDDStream instance. | |
| pData | Pointer to the data buffer to put received data. | |
| dwSize | Size of the data buffer in bytes. | |
| fCallback | Optional callback function to invoke when the transfer finishes. | |
| pArg | Optional argument to the callback function. |
| uint32_t AUDDStream_SetupWrite | ( | AUDDStream * | pAuds, | |
| void * | pListInit, | |||
| void * | pDmaInit, | |||
| uint16_t | listSize, | |||
| uint16_t | delaySize, | |||
| TransferCallback | callback, | |||
| void * | argument | |||
| ) |
Initialize Frame List for sending audio data.
| pAuds | Pointer to AUDDStream instance. | |
| pListInit | Pointer to the allocated list for audio write. | |
| pDmaInit | Pointer to the allocated DMA descriptors for autio write (if DMA supported). | |
| listSize | Circular list size. | |
| delaySize | Start transfer after delaySize frames filled in. | |
| callback | Optional callback function for transfer. | |
| argument | Optional callback argument. |
| uint32_t AUDDStream_SetVolume | ( | AUDDStream * | pAuds, | |
| uint8_t | bChannel, | |||
| uint16_t | wVolume | |||
| ) |
Set Stream Volume status.
| pAuds | Pointer to AUDDStream instance. | |
| bChannel | Channel number. | |
| wVolume | New volume value. |
| uint32_t AUDDStream_Write | ( | AUDDStream * | pAuds, | |
| void * | pBuffer, | |||
| uint16_t | wLength | |||
| ) |
Add frame buffer to audio sending list.
| pAuds | Pointer to AUDDStream instance. | |
| pBuffer | Pointer to data frame to send. | |
| wLength | Frame size in bytes. |
{
&deviceDescriptor,
(const USBConfigurationDescriptor *) &fsConfigurationDescriptors,
&qualifierDescriptor,
0,
0,
(const USBConfigurationDescriptor *) &hsConfigurationDescriptors,
&qualifierDescriptor,
0,
stringDescriptors, 4
}
List of descriptors required by an USB Audio Speakerphoneer device driver.
Definition at line 755 of file USBDDriverDescriptors.c.
uint8_t AUDDStream::bAsInterface [inherited] |
Audio Streaming Interface Number
AudioStreaming Interface number
Definition at line 58 of file AUDDSpeakerPhoneDriver.c.
uint8_t AUDDStream::bEndpointIn [inherited] |
Streaming IN endpoint address
Definition at line 92 of file AUDDStream.h.
uint8_t AUDDStream::bEndpointOut [inherited] |
Streaming OUT endpoint address
Definition at line 90 of file AUDDStream.h.
uint8_t AUDDStream::bFeatureUnitIn [inherited] |
AudioControl Feature Unit ID for OUT
Definition at line 86 of file AUDDStream.h.
uint8_t AUDDStream::bFeatureUnitOut [inherited] |
AudioControl Feature Unit ID for IN
Definition at line 84 of file AUDDStream.h.
uint8_t AUDDStream::bmMute [inherited] |
Mute control bits (8b)
Definition at line 96 of file AUDDStream.h.
uint8_t AUDDStream::bNumChannels [inherited] |
Number of channels (<=8)
Definition at line 94 of file AUDDStream.h.
| const USBDeviceDescriptor deviceDescriptor |
{
sizeof(USBDeviceDescriptor),
USBGenericDescriptor_DEVICE,
USBDeviceDescriptor_USB2_00,
AUDDeviceDescriptor_CLASS,
AUDDeviceDescriptor_SUBCLASS,
AUDDeviceDescriptor_PROTOCOL,
CHIP_USB_ENDPOINTS_MAXPACKETSIZE(0),
AUDDSpeakerPhoneDriverDescriptors_VENDORID,
AUDDSpeakerPhoneDriverDescriptors_PRODUCTID,
AUDDSpeakerPhoneDriverDescriptors_RELEASE,
1,
2,
3,
1
}
Device descriptor for a USB Audio Speakerphone driver.
Definition at line 102 of file USBDDriverDescriptors.c.
AUDDStreamEventCallback AUDDStream::fCallback [inherited] |
Audio Streaming Events Callback
Definition at line 101 of file AUDDStream.h.
| const AUDDSpeakerPhoneDriverConfigurationDescriptors fsConfigurationDescriptors |
FS Configuration descriptors for a USB Audio Speakerphone driver.
Definition at line 136 of file USBDDriverDescriptors.c.
| const AUDDSpeakerPhoneDriverConfigurationDescriptors hsConfigurationDescriptors |
HS Configuration descriptors for a USB Audio Speakerphone driver.
Definition at line 413 of file USBDDriverDescriptors.c.
| const unsigned char languageIdDescriptor[] |
{
USBStringDescriptor_LENGTH(1),
USBGenericDescriptor_STRING,
USBStringDescriptor_ENGLISH_US
}
String descriptor with the supported languages.
Definition at line 689 of file USBDDriverDescriptors.c.
| const unsigned char manufacturerDescriptor[] |
{
USBStringDescriptor_LENGTH(5),
USBGenericDescriptor_STRING,
USBStringDescriptor_UNICODE('A'),
USBStringDescriptor_UNICODE('t'),
USBStringDescriptor_UNICODE('m'),
USBStringDescriptor_UNICODE('e'),
USBStringDescriptor_UNICODE('l')
}
Manufacturer name.
Definition at line 697 of file USBDDriverDescriptors.c.
void* AUDDStream::pArg [inherited] |
Callback arguments
Definition at line 103 of file AUDDStream.h.
| const unsigned char productDescriptor[] |
{
USBStringDescriptor_LENGTH(15),
USBGenericDescriptor_STRING,
USBStringDescriptor_UNICODE('D'),
USBStringDescriptor_UNICODE('e'),
USBStringDescriptor_UNICODE('s'),
USBStringDescriptor_UNICODE('k'),
USBStringDescriptor_UNICODE('t'),
USBStringDescriptor_UNICODE('o'),
USBStringDescriptor_UNICODE('p'),
USBStringDescriptor_UNICODE(' '),
USBStringDescriptor_UNICODE('s'),
USBStringDescriptor_UNICODE('p'),
USBStringDescriptor_UNICODE('e'),
USBStringDescriptor_UNICODE('a'),
USBStringDescriptor_UNICODE('k'),
USBStringDescriptor_UNICODE('e'),
USBStringDescriptor_UNICODE('r')
}
Product name.
Definition at line 709 of file USBDDriverDescriptors.c.
uint16_t* AUDDStream::pwVolumes [inherited] |
Volume control data
Definition at line 98 of file AUDDStream.h.
| const unsigned char serialNumberDescriptor[] |
{
USBStringDescriptor_LENGTH(4),
USBGenericDescriptor_STRING,
USBStringDescriptor_UNICODE('0'),
USBStringDescriptor_UNICODE('1'),
USBStringDescriptor_UNICODE('2'),
USBStringDescriptor_UNICODE('3')
}
Product serial number.
Definition at line 731 of file USBDDriverDescriptors.c.
| const unsigned char* stringDescriptors[] |
Array of pointers to the four string descriptors.
Definition at line 742 of file USBDDriverDescriptors.c.
1.7.1