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 * 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_ */