00001 /* ---------------------------------------------------------------------------- 00002 * SAM Software Package License 00003 * ---------------------------------------------------------------------------- 00004 * Copyright (c) 2014, Atmel Corporation 00005 * 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions are met: 00010 * 00011 * - Redistributions of source code must retain the above copyright notice, 00012 * this list of conditions and the disclaimer below. 00013 * 00014 * Atmel's name may not be used to endorse or promote products derived from 00015 * this software without specific prior written permission. 00016 * 00017 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR 00018 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00019 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00020 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, 00021 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00022 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00023 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00024 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00025 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00026 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 * ---------------------------------------------------------------------------- 00028 */ 00029 /** \file */ 00030 #ifndef AUDDFUNCTION_H 00031 #define AUDDFUNCTION_H 00032 /** \addtogroup usbd_aud_fun 00033 *@{ 00034 */ 00035 00036 /*----------------------------------------------------------------------------- 00037 * Headers 00038 *---------------------------------------------------------------------------*/ 00039 00040 #include <USBRequests.h> 00041 #include <AUDDSpeakerPhone.h> 00042 #include "USBD.h" 00043 #include <USBDDriver.h> 00044 00045 /*----------------------------------------------------------------------------- 00046 * Definitions 00047 *---------------------------------------------------------------------------*/ 00048 00049 /** \addtogroup audd_fun_desc USBD Audio Function definitions 00050 * @{ 00051 */ 00052 /** ID for Speaker */ 00053 #define AUDDFunction_Speaker 0 00054 /** ID for Microphone */ 00055 #define AUDDFunction_Microhpone 1 00056 /** Max number of interfaces that supported by the function (AC + 2*AS) */ 00057 #define AUDDFunction_MaxNumInterfaces 3 00058 /** Max number of channels supported by speaker stream (including master) */ 00059 #define AUDDFunction_MaxNumSpeakerChannels 3 00060 /** Max number of channels supported by microphone stream (including master) */ 00061 #define AUDDFunction_MaxNumMicrophoneChannels 3 00062 00063 /** Endpoint polling interval 2^(x-1) * 125us */ 00064 #define AUDDFunction_HS_INTERVAL 0x04 00065 /** Endpoint polling interval 2^(x-1) * ms */ 00066 #define AUDDFunction_FS_INTERVAL 0x01 00067 00068 /** Playback input terminal ID */ 00069 #define AUDDFunction_INPUTTERMINAL AUDD_ID_SpeakerIT 00070 /** Playback output terminal ID */ 00071 #define AUDDFunction_OUTPUTTERMINAL AUDD_ID_SpeakerOT 00072 /** Playback feature unit ID */ 00073 #define AUDDFunction_FEATUREUNIT AUDD_ID_SpeakerFU 00074 /** Record input terminal ID */ 00075 #define AUDDFunction_INPUTTERMINAL_REC AUDD_ID_MicrophoneIT 00076 /** Record output terminal ID */ 00077 #define AUDDFunction_OUTPUTTERMINAL_REC AUDD_ID_MicrophoneOT 00078 /** Record feature unit ID */ 00079 #define AUDDFunction_FEATUREUNIT_REC AUDD_ID_MicrophoneFU 00080 00081 /** @}*/ 00082 00083 /*----------------------------------------------------------------------------- 00084 * Exported functions 00085 *---------------------------------------------------------------------------*/ 00086 00087 extern void AUDDFunction_Initialize( 00088 USBDDriver *pUsbd, uint8_t bInterface); 00089 extern void AUDDFunction_Configure( 00090 USBGenericDescriptor * pDescriptors, uint16_t wLength); 00091 extern void AUDDFunction_InterfaceSettingChangedHandler( 00092 uint8_t interface,uint8_t setting); 00093 extern uint32_t AUDDFunction_RequestHandler(const USBGenericRequest * request); 00094 extern uint8_t AUDDFunction_Read( 00095 void * buffer, uint32_t length, 00096 TransferCallback callback, void * argument); 00097 extern uint8_t AUDDFunction_SetupWrite( 00098 void * pListInit, void * pDmaInit, uint16_t listSize, uint16_t delaySize, 00099 TransferCallback callback,void * argument); 00100 extern uint8_t AUDDFunction_Write(void * buffer, uint16_t length); 00101 00102 extern void AUDDFunction_MuteChanged( 00103 uint8_t idMic, uint8_t ch, uint8_t mute); 00104 extern void AUDDFunction_StreamSettingChanged( 00105 uint8_t idMic, uint8_t setting); 00106 00107 /**@}*/ 00108 #endif // #define AUDDFUNCTIONDRIVER_H 00109