| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 32 | kaklik | /******************************************************************************** |
| 2 | File Information: |
||
| 3 | FileName: usb_function_audio.c |
||
| 4 | Dependencies: See INCLUDES section |
||
| 5 | Processor: PIC18 or PIC24 USB Microcontrollers |
||
| 6 | Hardware: The code is natively intended to be used on the following |
||
| 7 | hardware platforms: PICDEM FS USB Demo Board, |
||
| 8 | PIC18F87J50 FS USB Plug-In Module, or |
||
| 9 | Explorer 16 + PIC24 USB PIM. The firmware may be |
||
| 10 | modified for use on other USB platforms by editing the |
||
| 11 | HardwareProfile.h file. |
||
| 12 | Complier: Microchip C18 (for PIC18) or C30 (for PIC24) |
||
| 13 | Company: Microchip Technology, Inc. |
||
| 14 | |||
| 15 | Software License Agreement: |
||
| 16 | |||
| 17 | The software supplied herewith by Microchip Technology Incorporated |
||
| 18 | (the Company) for its PIC® Microcontroller is intended and |
||
| 19 | supplied to you, the Companys customer, for use solely and |
||
| 20 | exclusively on Microchip PIC Microcontroller products. The |
||
| 21 | software is owned by the Company and/or its supplier, and is |
||
| 22 | protected under applicable copyright laws. All rights are reserved. |
||
| 23 | Any use in violation of the foregoing restrictions may subject the |
||
| 24 | user to criminal sanctions under applicable laws, as well as to |
||
| 25 | civil liability for the breach of the terms and conditions of this |
||
| 26 | license. |
||
| 27 | |||
| 28 | THIS SOFTWARE IS PROVIDED IN AN AS IS CONDITION. NO WARRANTIES, |
||
| 29 | WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED |
||
| 30 | TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
||
| 31 | PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, |
||
| 32 | IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR |
||
| 33 | CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
||
| 34 | |||
| 35 | Summary: |
||
| 36 | This file contains all of functions, macros, definitions, variables, |
||
| 37 | datatypes, etc. that are required for usage with the Audio function |
||
| 38 | driver. This file should be included in projects that use the Audio |
||
| 39 | \function driver. |
||
| 40 | |||
| 41 | |||
| 42 | |||
| 43 | This file is located in the "\<Install Directory\>\\Microchip\\USB\\Audio |
||
| 44 | Device Driver" directory. |
||
| 45 | Description: |
||
| 46 | USB Audio Function Driver File |
||
| 47 | |||
| 48 | This file contains all of functions, macros, definitions, variables, |
||
| 49 | datatypes, etc. that are required for usage with the Audio function |
||
| 50 | driver. This file should be included in projects that use the Audio |
||
| 51 | \function driver. |
||
| 52 | |||
| 53 | This file is located in the "\<Install Directory\>\\Microchip\\USB\\Audio |
||
| 54 | Device Driver" directory. |
||
| 55 | |||
| 56 | When including this file in a new project, this file can either be |
||
| 57 | referenced from the directory in which it was installed or copied |
||
| 58 | directly into the user application folder. If the first method is |
||
| 59 | chosen to keep the file located in the folder in which it is installed |
||
| 60 | then include paths need to be added so that the library and the |
||
| 61 | application both know where to reference each others files. If the |
||
| 62 | application folder is located in the same folder as the Microchip |
||
| 63 | folder (like the current demo folders), then the following include |
||
| 64 | paths need to be added to the application's project: |
||
| 65 | |||
| 66 | |||
| 67 | ..\\..\\Include |
||
| 68 | |||
| 69 | . |
||
| 70 | |||
| 71 | |||
| 72 | If a different directory structure is used, modify the paths as |
||
| 73 | required. An example using absolute paths instead of relative paths |
||
| 74 | would be the following: |
||
| 75 | |||
| 76 | C:\\Microchip Solutions\\Microchip\\Include |
||
| 77 | |||
| 78 | C:\\Microchip Solutions\\My Demo Application |
||
| 79 | |||
| 80 | Change History: |
||
| 81 | Rev Description |
||
| 82 | ----- ----------- |
||
| 83 | 2.6- No change |
||
| 84 | 2.7a |
||
| 85 | ********************************************************************************/ |
||
| 86 | |||
| 87 | /** I N C L U D E S *******************************************************/ |
||
| 88 | #include "./USB/usb.h" |
||
| 89 | #include "./USB/usb_function_audio.h" |
||
| 90 | |||
| 91 | #ifdef USB_USE_AUDIO_CLASS |
||
| 92 | |||
| 93 | #if defined USB_AUDIO_TERMINAL_CONTROL_REQUESTS_HANDLER |
||
| 94 | void USB_AUDIO_TERMINAL_CONTROL_REQUESTS_HANDLER(void); |
||
| 95 | #endif |
||
| 96 | |||
| 97 | #if defined USB_AUDIO_MIXER_UNIT_CONTROL_REQUESTS_HANDLER |
||
| 98 | void USB_AUDIO_MIXER_UNIT_CONTROL_REQUESTS_HANDLER(void); |
||
| 99 | #endif |
||
| 100 | |||
| 101 | #if defined USB_AUDIO_SELECTOR_UNIT_CONTROL_REQUESTS_HANDLER |
||
| 102 | void USB_AUDIO_SELECTOR_UNIT_CONTROL_REQUESTS_HANDLER(void); |
||
| 103 | #endif |
||
| 104 | |||
| 105 | #if defined USB_AUDIO_FEATURE_UNIT_CONTROL_REQUESTS_HANDLER |
||
| 106 | void USB_AUDIO_FEATURE_UNIT_CONTROL_REQUESTS_HANDLER(void); |
||
| 107 | #endif |
||
| 108 | |||
| 109 | #if defined USB_AUDIO_PROCESSING_UNIT_CONTROL_REQUESTS_HANDLER |
||
| 110 | void USB_AUDIO_PROCESSING_UNIT_CONTROL_REQUESTS_HANDLER(void); |
||
| 111 | #endif |
||
| 112 | |||
| 113 | #if defined USB_AUDIO_EXTENSION_UNIT_CONTROL_REQUESTS_HANDLER |
||
| 114 | void USB_AUDIO_EXTENSION_UNIT_CONTROL_REQUESTS_HANDLER(void); |
||
| 115 | #endif |
||
| 116 | |||
| 117 | #if defined USB_AUDIO_INTRFACE_CONTROL_REQUESTS_HANDLER |
||
| 118 | void USB_AUDIO_INTRFACE_CONTROL_REQUESTS_HANDLER(void); |
||
| 119 | #endif |
||
| 120 | |||
| 121 | #if defined USB_AUDIO_ENDPOINT_CONTROL_REQUESTS_HANDLER |
||
| 122 | void USB_AUDIO_ENDPOINT_CONTROL_REQUESTS_HANDLER(void); |
||
| 123 | #endif |
||
| 124 | |||
| 125 | #if defined USB_AUDIO_MEMORY_REQUESTS_HANDLER |
||
| 126 | void USB_AUDIO_MEMORY_REQUESTS_HANDLER(void); |
||
| 127 | #endif |
||
| 128 | |||
| 129 | #if defined USB_AUDIO_STATUS_REQUESTS_HANDLER |
||
| 130 | void USB_AUDIO_STATUS_REQUESTS_HANDLER(void); |
||
| 131 | #endif |
||
| 132 | |||
| 133 | |||
| 134 | |||
| 135 | /** V A R I A B L E S ********************************************************/ |
||
| 136 | unsigned char TempBuffer[8]; |
||
| 137 | |||
| 138 | /** C L A S S S P E C I F I C R E Q ****************************************/ |
||
| 139 | /****************************************************************************** |
||
| 140 | Function: |
||
| 141 | void USBCheckAudioRequest(void) |
||
| 142 | |||
| 143 | Description: |
||
| 144 | This routine checks the setup data packet to see if it |
||
| 145 | knows how to handle it |
||
| 146 | |||
| 147 | PreCondition: |
||
| 148 | None |
||
| 149 | |||
| 150 | Parameters: |
||
| 151 | None |
||
| 152 | |||
| 153 | Return Values: |
||
| 154 | None |
||
| 155 | |||
| 156 | Remarks: |
||
| 157 | None |
||
| 158 | |||
| 159 | *****************************************************************************/ |
||
| 160 | |||
| 161 | void USBCheckAudioRequest(void) |
||
| 162 | { |
||
| 163 | /* |
||
| 164 | * If request recipient is not an interface then return |
||
| 165 | */ |
||
| 166 | if(SetupPkt.Recipient != USB_SETUP_RECIPIENT_INTERFACE_BITFIELD) return; |
||
| 167 | /* |
||
| 168 | * If request type is not class-specific then return |
||
| 169 | */ |
||
| 170 | if(SetupPkt.RequestType != USB_SETUP_TYPE_CLASS_BITFIELD) return; |
||
| 171 | /* |
||
| 172 | * Interface ID must match interface numbers associated with |
||
| 173 | * Audio class, else return |
||
| 174 | */ |
||
| 175 | if((SetupPkt.bIntfID != AUDIO_CONTROL_INTERFACE_ID)&& |
||
| 176 | (SetupPkt.bIntfID != AUDIO_STREAMING_INTERFACE_ID)) return; |
||
| 177 | switch(SetupPkt.W_Index.byte.HB)// checking for the Entity ID (Entity ID are defined in the config.h file) |
||
| 178 | { |
||
| 179 | case ID_INPUT_TERMINAL: |
||
| 180 | #if defined USB_AUDIO_INPUT_TERMINAL_CONTROL_REQUESTS_HANDLER |
||
| 181 | USB_AUDIO_INPUT_TERMINAL_CONTROL_REQUESTS_HANDLER(); |
||
| 182 | #endif |
||
| 183 | break; |
||
| 184 | case ID_OUTPUT_TERMINAL: |
||
| 185 | #if defined USB_AUDIO_OUTPUT_TERMINAL_CONTROL_REQUESTS_HANDLER |
||
| 186 | USB_AUDIO_OUTPUT_TERMINAL_CONTROL_REQUESTS_HANDLER(); |
||
| 187 | #endif |
||
| 188 | break; |
||
| 189 | case ID_MIXER_UNIT: |
||
| 190 | #if defined USB_AUDIO_MIXER_UNIT_CONTROL_REQUESTS_HANDLER |
||
| 191 | USB_AUDIO_MIXER_UNIT_CONTROL_REQUESTS_HANDLER(); |
||
| 192 | #endif |
||
| 193 | break; |
||
| 194 | case ID_SELECTOR_UNIT: |
||
| 195 | #if defined USB_AUDIO_SELECTOR_UNIT_CONTROL_REQUESTS_HANDLER |
||
| 196 | USB_AUDIO_SELECTOR_UNIT_CONTROL_REQUESTS_HANDLER(); |
||
| 197 | #endif |
||
| 198 | break; |
||
| 199 | case ID_FEATURE_UNIT: |
||
| 200 | #if defined USB_AUDIO_FEATURE_UNIT_CONTROL_REQUESTS_HANDLER |
||
| 201 | USB_AUDIO_FEATURE_UNIT_CONTROL_REQUESTS_HANDLER(); |
||
| 202 | #endif |
||
| 203 | break; |
||
| 204 | case ID_PROCESSING_UNIT: |
||
| 205 | #if defined USB_AUDIO_PROCESSING_UNIT_CONTROL_REQUESTS_HANDLER |
||
| 206 | USB_AUDIO_PROCESSING_UNIT_CONTROL_REQUESTS_HANDLER(); |
||
| 207 | #endif |
||
| 208 | break; |
||
| 209 | case ID_EXTENSION_UNIT: |
||
| 210 | #if defined USB_AUDIO_EXTENSION_UNIT_CONTROL_REQUESTS_HANDLER |
||
| 211 | USB_AUDIO_EXTENSION_UNIT_CONTROL_REQUESTS_HANDLER(); |
||
| 212 | #endif |
||
| 213 | break; |
||
| 214 | default: |
||
| 215 | break; |
||
| 216 | |||
| 217 | }//end switch(SetupPkt.bRequest |
||
| 218 | }//end USBCheckAudioRequest |
||
| 219 | |||
| 220 | #endif |
Powered by WebSVN v2.8.3