blob: ed2482c6881843e77781a0eda90ef2c1d002822a [file] [log] [blame]
Christina Quastb123d742014-12-23 13:03:36 +01001/* ----------------------------------------------------------------------------
2 * ATMEL Microcontroller Software Support
3 * ----------------------------------------------------------------------------
4 * Copyright (c) 2008, Atmel Corporation
5 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * - Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the disclaimer below.
13 *
14 * Atmel's name may not be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
20 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * ----------------------------------------------------------------------------
28 */
29/** \file */
30#ifndef AUDDFUNCTION_H
31#define AUDDFUNCTION_H
32/** \addtogroup usbd_aud_fun
33 *@{
34 */
35
36/*-----------------------------------------------------------------------------
37 * Headers
38 *---------------------------------------------------------------------------*/
39
40#include <USBRequests.h>
41#include <AUDDSpeakerPhone.h>
42#include <USBD.h>
43#include <USBDDriver.h>
44
45/*-----------------------------------------------------------------------------
46 * Definitions
47 *---------------------------------------------------------------------------*/
48
49/** \addtogroup audd_fun_desc USBD Audio Function definitions
50 * @{
51 */
52/** ID for Speaker */
53#define AUDDFunction_Speaker 0
54/** ID for Microphone */
55#define AUDDFunction_Microhpone 1
56/** Max number of interfaces that supported by the function (AC + 2*AS) */
57#define AUDDFunction_MaxNumInterfaces 3
58/** Max number of channels supported by speaker stream (including master) */
59#define AUDDFunction_MaxNumSpeakerChannels 3
60/** Max number of channels supported by microphone stream (including master) */
61#define AUDDFunction_MaxNumMicrophoneChannels 3
62
63/** Endpoint polling interval 2^(x-1) * 125us */
64#define AUDDFunction_HS_INTERVAL 0x04
65/** Endpoint polling interval 2^(x-1) * ms */
66#define AUDDFunction_FS_INTERVAL 0x01
67
68/** Playback input terminal ID */
69#define AUDDFunction_INPUTTERMINAL AUDD_ID_SpeakerIT
70/** Playback output terminal ID */
71#define AUDDFunction_OUTPUTTERMINAL AUDD_ID_SpeakerOT
72/** Playback feature unit ID */
73#define AUDDFunction_FEATUREUNIT AUDD_ID_SpeakerFU
74/** Record input terminal ID */
75#define AUDDFunction_INPUTTERMINAL_REC AUDD_ID_MicrophoneIT
76/** Record output terminal ID */
77#define AUDDFunction_OUTPUTTERMINAL_REC AUDD_ID_MicrophoneOT
78/** Record feature unit ID */
79#define AUDDFunction_FEATUREUNIT_REC AUDD_ID_MicrophoneFU
80
81/** @}*/
82
83/*-----------------------------------------------------------------------------
84 * Exported functions
85 *---------------------------------------------------------------------------*/
86
87extern void AUDDFunction_Initialize(
88 USBDDriver *pUsbd, uint8_t bInterface);
89extern void AUDDFunction_Configure(
90 USBGenericDescriptor * pDescriptors, uint16_t wLength);
91extern void AUDDFunction_InterfaceSettingChangedHandler(
92 uint8_t interface,uint8_t setting);
93extern uint32_t AUDDFunction_RequestHandler(const USBGenericRequest * request);
94extern uint8_t AUDDFunction_Read(
95 void * buffer, uint32_t length,
96 TransferCallback callback, void * argument);
97extern uint8_t AUDDFunction_SetupWrite(
98 void * pListInit, void * pDmaInit, uint16_t listSize, uint16_t delaySize,
99 TransferCallback callback,void * argument);
100extern uint8_t AUDDFunction_Write(void * buffer, uint16_t length);
101
102extern void AUDDFunction_MuteChanged(
103 uint8_t idMic, uint8_t ch, uint8_t mute);
104extern void AUDDFunction_StreamSettingChanged(
105 uint8_t idMic, uint8_t setting);
106
107/**@}*/
108#endif // #define AUDDFUNCTIONDRIVER_H
109