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 00030 /** \file 00031 * 00032 * Definitions and classes for USB Audio class requests. 00033 * 00034 * - For a USB %device: 00035 * -# After receiving an Audio request from the host, use 00036 * AUDGenericRequest_GetEntity to determine the target Unit or Terminal. 00037 * -# After receiving an Audio request from the host, use 00038 * AUDGenericRequest_GetInterface to know which interface is referenced. 00039 * -# Use AUDFeatureUnitRequest_GetControl to determine which control 00040 * shall be tweaked following a host request. 00041 * -# Use AUDFeatureUnitRequest_GetChannel to identify the channel which 00042 * will have its control altered. 00043 */ 00044 00045 #ifndef _AUDREQUESTS_H_ 00046 #define _AUDREQUESTS_H_ 00047 /** \addtogroup usb_audio 00048 *@{ 00049 */ 00050 00051 /*---------------------------------------------------------------------------- 00052 * Includes 00053 *----------------------------------------------------------------------------*/ 00054 00055 #include <USBRequests.h> 00056 00057 /*---------------------------------------------------------------------------- 00058 * Definitions 00059 *----------------------------------------------------------------------------*/ 00060 00061 /** \addtogroup usb_audio_request USB Audio request codes 00062 * @{ 00063 * This section lists the codes of the existing Audio requests. 00064 * - \ref AUDGenericRequest_SETCUR 00065 * - \ref AUDGenericRequest_GETCUR 00066 */ 00067 /** SET_CUR request code.*/ 00068 #define AUDGenericRequest_SETCUR 0x01 00069 /** GET_CUR request code.*/ 00070 #define AUDGenericRequest_GETCUR 0x81 00071 /** GET_MIN request code.*/ 00072 #define AUDGenericRequest_GETMIN 0x82 00073 /** GET_MAX request code.*/ 00074 #define AUDGenericRequest_GETMAX 0x83 00075 /** GET_RES request code.*/ 00076 #define AUDGenericRequest_GETRES 0x84 00077 /** @}*/ 00078 00079 /** \addtogroup usb_audio_ctrl_sel USB Audio Control selector values 00080 * @{ 00081 * This section lists the available control selectors for a Feature Unit request. 00082 * - \ref AUDFeatureUnitRequest_MUTE 00083 */ 00084 /** Mute control selector (MUTE_CONTROL). */ 00085 #define AUDFeatureUnitRequest_MUTE 0x01 00086 /** Volume control selector (VOLUME_CONTROL). */ 00087 #define AUDFeatureUnitRequest_VOLUME 0x02 00088 /** @}*/ 00089 00090 /*---------------------------------------------------------------------------- 00091 * Types 00092 *----------------------------------------------------------------------------*/ 00093 00094 #pragma pack(1) 00095 #if defined ( __CC_ARM ) /* Keil ¦̀Vision 4 */ 00096 #elif defined ( __ICCARM__ ) /* IAR Ewarm 5.41+ */ 00097 #define __attribute__(...) 00098 #elif defined ( __GNUC__ ) /* GCC CS3 2009q3-68 */ 00099 #endif 00100 00101 00102 #pragma pack() 00103 00104 /*---------------------------------------------------------------------------- 00105 * Functions 00106 *----------------------------------------------------------------------------*/ 00107 00108 extern uint8_t AUDGenericRequest_GetEntity( 00109 const USBGenericRequest *request); 00110 00111 extern uint8_t AUDGenericRequest_GetInterface( 00112 const USBGenericRequest *request); 00113 00114 00115 extern uint8_t AUDFeatureUnitRequest_GetControl( 00116 const USBGenericRequest *request); 00117 00118 extern uint8_t AUDFeatureUnitRequest_GetChannel( 00119 const USBGenericRequest *request); 00120 00121 /**@}*/ 00122 #endif /* _AUDREQUESTS_H_ */