SAMV71 Xplained Ultra Software Package 1.5

AUDDSpeakerPhone.h

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------- */
00002 /*                  Atmel Microcontroller Software Support                      */
00003 /*                       SAM Software Package License                           */
00004 /* ---------------------------------------------------------------------------- */
00005 /* Copyright (c) 2015, Atmel Corporation                                        */
00006 /*                                                                              */
00007 /* All rights reserved.                                                         */
00008 /*                                                                              */
00009 /* Redistribution and use in source and binary forms, with or without           */
00010 /* modification, are permitted provided that the following condition is met:    */
00011 /*                                                                              */
00012 /* - Redistributions of source code must retain the above copyright notice,     */
00013 /* this list of conditions and the disclaimer below.                            */
00014 /*                                                                              */
00015 /* Atmel's name may not be used to endorse or promote products derived from     */
00016 /* this software without specific prior written permission.                     */
00017 /*                                                                              */
00018 /* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
00028 /* ---------------------------------------------------------------------------- */
00029 
00030 /** \file
00031  *  USB Audio Speaker & Microphone Function.
00032  */
00033 
00034 /** \addtogroup usbd_audio_speakerphone
00035  *@{
00036  *  Implement speaker phone function that combine 1 AC interface, 1 AS interface
00037  *  for speaker and 1 AS interface for microphone.
00038  */
00039 
00040 #ifndef _AUDD_SPEAKERPHONE_H_
00041 #define _AUDD_SPEAKERPHONE_H_
00042 
00043 /*------------------------------------------------------------------------------
00044  *         Headers
00045  *------------------------------------------------------------------------------*/
00046 
00047 #include <stdint.h>
00048 
00049 #include <AUDDStream.h>
00050 
00051 #include "USBD.h"
00052 #include <USBDDriver.h>
00053 
00054 /*------------------------------------------------------------------------------
00055  *         Defines
00056  *------------------------------------------------------------------------------*/
00057 
00058 /** \addtogroup usbd_audio_ids Audio Device IDs required by driver
00059  *      @{
00060  *  The driver uses following fixed entity IDs, use them to define your
00061  *  descriptor.
00062  *  \ref AUDD_ID_SpeakerIT
00063  *  \ref AUDD_ID_SpeakerOT
00064  *  \ref AUDD_ID_SpeakerFU
00065  *  \ref AUDD_ID_MicrophoneIT
00066  *  \ref AUDD_ID_MicrophoneOT
00067  *  \ref AUDD_ID_MicrophoneFU
00068  */
00069 /** Speaker input terminal ID */
00070 #define AUDD_ID_SpeakerIT           0x01
00071 /** Speaker output terminal ID */
00072 #define AUDD_ID_SpeakerOT           0x02
00073 /** Speaker feature unit ID */
00074 #define AUDD_ID_SpeakerFU           0x03
00075 /** Microphone input terminal ID */
00076 #define AUDD_ID_MicrophoneIT        0x04
00077 /** Microphone output terminal ID */
00078 #define AUDD_ID_MicrophoneOT        0x05
00079 /** Microphone feature unit ID */
00080 #define AUDD_ID_MicrophoneFU        0x06
00081 /**     @}*/
00082 
00083 /** \addtogroup usbd_audio_chs Audio Device Channels
00084  *      @{
00085  */
00086 /** Master channel ID */
00087 #define AUDD_CH_Master              0x0
00088 /** Left channel ID */
00089 #define AUDD_CH_L                   0x1
00090 /** Right channel ID */
00091 #define AUDD_CH_R                   0x2
00092 /**     @}*/
00093 
00094 /*------------------------------------------------------------------------------
00095  *         Types
00096  *------------------------------------------------------------------------------*/
00097 
00098 /**
00099  * Struct of USB Audio Speaker-phone Function, with
00100  * - 1 control interface for features,
00101  * - 1 input stream for microphone (Audio IN),
00102  * - 1 output stream for speaker (Audio OUT).
00103  */
00104 typedef struct _AUDDSpeakerPhone {
00105     /** Pointer to USBD Driver Interface */
00106     USBDDriver *pUsbd;
00107     /** Pointer to AUDDStream Instance */
00108     AUDDStream *pSpeaker;
00109     /** Pointer to AUDDStream Instance */
00110     AUDDStream *pMicrophone;
00111 } AUDDSpeakerPhone;
00112 
00113 /*------------------------------------------------------------------------------
00114  *         Functions
00115  *------------------------------------------------------------------------------*/
00116 
00117 extern void AUDDSpeakerPhone_InitializeStream(
00118     AUDDStream * pAuds,
00119     uint8_t numChannels,uint16_t wChannelVolumes [ ],
00120     AUDDStreamEventCallback fCallback,void * pArg);
00121 
00122 extern void AUDDSpeakerPhone_Initialize(
00123     AUDDSpeakerPhone * pAudf,
00124     USBDDriver * pUsbd,
00125     AUDDStream * pSpeaker,AUDDStream * pMicrophone);
00126 
00127 extern USBGenericDescriptor* AUDDSpeakerPhone_ParseInterfaces(
00128     AUDDSpeakerPhone * pAudf,
00129     USBGenericDescriptor * pDescriptors,
00130     uint32_t dwLength);
00131 
00132 extern uint32_t AUDDSpeakerPhone_RequestHandler(
00133     AUDDSpeakerPhone * pAudf,
00134     const USBGenericRequest * pRequest);
00135 
00136 extern uint32_t AUDDSpeakerPhone_CloseStream(
00137     AUDDSpeakerPhone * pAudf,
00138     uint32_t bInterface);
00139 
00140 extern uint32_t AUDDSpeakerPhone_SetupWrite(
00141     AUDDSpeakerPhone * pAudf,
00142     void * pListInit, void * pDmaInit, uint16_t listSize, uint16_t delaySize,
00143     TransferCallback callback,void * argument);
00144 
00145 extern uint32_t AUDDSpeakerPhone_Write(
00146     AUDDSpeakerPhone * pAudf,
00147     void * pBuffer,uint16_t wLength);
00148 
00149 extern uint32_t AUDDSpeakerPhone_Read(
00150     AUDDSpeakerPhone * pAudf,
00151     void * pData, uint32_t dwSize,
00152     TransferCallback fCallback,void * pArg);
00153 
00154 /**@}*/
00155 #endif /* _AUDD_SPEAKERPHONE_H_ */
00156 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines