| 1 |
/** |
| 2 |
****************************************************************************** |
| 3 |
* @file usbh_audio.h |
| 4 |
* @author MCD Application Team |
| 5 |
* @version V3.0.0 |
| 6 |
* @date 18-February-2014 |
| 7 |
* @brief This file contains all the prototypes for the usbh_audio.c |
| 8 |
****************************************************************************** |
| 9 |
* @attention |
| 10 |
* |
| 11 |
* <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2> |
| 12 |
* |
| 13 |
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
| 14 |
* You may not use this file except in compliance with the License. |
| 15 |
* You may obtain a copy of the License at: |
| 16 |
* |
| 17 |
* http://www.st.com/software_license_agreement_liberty_v2 |
| 18 |
* |
| 19 |
* Unless required by applicable law or agreed to in writing, software |
| 20 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 21 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 22 |
* See the License for the specific language governing permissions and |
| 23 |
* limitations under the License. |
| 24 |
* |
| 25 |
****************************************************************************** |
| 26 |
*/ |
| 27 |
|
| 28 |
/* Define to prevent recursive ----------------------------------------------*/ |
| 29 |
#ifndef __USBH_AUDIO_H |
| 30 |
#define __USBH_AUDIO_H |
| 31 |
|
| 32 |
/* Includes ------------------------------------------------------------------*/ |
| 33 |
#include "usbh_core.h" |
| 34 |
|
| 35 |
/** @addtogroup USBH_LIB |
| 36 |
* @{ |
| 37 |
*/ |
| 38 |
|
| 39 |
/** @addtogroup USBH_CLASS |
| 40 |
* @{ |
| 41 |
*/ |
| 42 |
|
| 43 |
/** @addtogroup USBH_AUDIO_CLASS |
| 44 |
* @{ |
| 45 |
*/ |
| 46 |
|
| 47 |
/** @defgroup USBH_AUDIO_CORE |
| 48 |
* @brief This file is the Header file for usbh_audio.c |
| 49 |
* @{ |
| 50 |
*/ |
| 51 |
|
| 52 |
|
| 53 |
/** @defgroup USBH_AUDIO_CORE_Exported_Types |
| 54 |
* @{ |
| 55 |
*/ |
| 56 |
|
| 57 |
/* States for AUDIO State Machine */ |
| 58 |
typedef enum |
| 59 |
{ |
| 60 |
AUDIO_INIT = 0, |
| 61 |
AUDIO_IDLE, |
| 62 |
AUDIO_CS_REQUESTS, |
| 63 |
AUDIO_SET_DEFAULT_FEATURE_UNIT, |
| 64 |
AUDIO_SET_INTERFACE, |
| 65 |
AUDIO_SET_STREAMING_INTERFACE, |
| 66 |
AUDIO_SET_CUR1, |
| 67 |
AUDIO_GET_MIN, |
| 68 |
AUDIO_GET_MAX, |
| 69 |
AUDIO_GET_RES, |
| 70 |
AUDIO_GET_CUR1, |
| 71 |
AUDIO_SET_CUR2, |
| 72 |
AUDIO_GET_CUR2, |
| 73 |
AUDIO_SET_CUR3, |
| 74 |
AUDIO_SET_INTERFACE0, |
| 75 |
AUDIO_SET_INTERFACE1, |
| 76 |
AUDIO_SET_INTERFACE2, |
| 77 |
AUDIO_ISOC_OUT, |
| 78 |
AUDIO_ISOC_IN, |
| 79 |
AUDIO_ISOC_POLL, |
| 80 |
AUDIO_ERROR, |
| 81 |
} |
| 82 |
AUDIO_StateTypeDef; |
| 83 |
|
| 84 |
typedef enum |
| 85 |
{ |
| 86 |
AUDIO_REQ_INIT = 1, |
| 87 |
AUDIO_REQ_IDLE, |
| 88 |
AUDIO_REQ_SET_DEFAULT_IN_INTERFACE, |
| 89 |
AUDIO_REQ_SET_DEFAULT_OUT_INTERFACE, |
| 90 |
AUDIO_REQ_SET_IN_INTERFACE, |
| 91 |
AUDIO_REQ_SET_OUT_INTERFACE, |
| 92 |
AUDIO_REQ_CS_REQUESTS, |
| 93 |
} |
| 94 |
AUDIO_ReqStateTypeDef; |
| 95 |
|
| 96 |
typedef enum |
| 97 |
{ |
| 98 |
AUDIO_REQ_SET_VOLUME = 1, |
| 99 |
AUDIO_REQ_SET_MUTE, |
| 100 |
AUDIO_REQ_GET_CURR_VOLUME, |
| 101 |
AUDIO_REQ_GET_MIN_VOLUME, |
| 102 |
AUDIO_REQ_GET_MAX_VOLUME, |
| 103 |
AUDIO_REQ_GET_VOLUME, |
| 104 |
AUDIO_REQ_GET_RESOLUTION, |
| 105 |
AUDIO_REQ_CS_IDLE, |
| 106 |
} |
| 107 |
AUDIO_CSReqStateTypeDef; |
| 108 |
|
| 109 |
typedef enum |
| 110 |
{ |
| 111 |
AUDIO_PLAYBACK_INIT = 1, |
| 112 |
AUDIO_PLAYBACK_SET_EP, |
| 113 |
AUDIO_PLAYBACK_SET_EP_FREQ, |
| 114 |
AUDIO_PLAYBACK_PLAY, |
| 115 |
AUDIO_PLAYBACK_IDLE, |
| 116 |
} |
| 117 |
AUDIO_PlayStateTypeDef; |
| 118 |
|
| 119 |
typedef enum |
| 120 |
{ |
| 121 |
VOLUME_UP = 1, |
| 122 |
VOLUME_DOWN = 2, |
| 123 |
} |
| 124 |
AUDIO_VolumeCtrlTypeDef; |
| 125 |
|
| 126 |
typedef enum |
| 127 |
{ |
| 128 |
AUDIO_CONTROL_INIT = 1, |
| 129 |
AUDIO_CONTROL_CHANGE, |
| 130 |
AUDIO_CONTROL_IDLE, |
| 131 |
AUDIO_CONTROL_VOLUME_UP, |
| 132 |
AUDIO_CONTROL_VOLUME_DOWN, |
| 133 |
} |
| 134 |
AUDIO_ControlStateTypeDef; |
| 135 |
|
| 136 |
|
| 137 |
typedef enum |
| 138 |
{ |
| 139 |
AUDIO_DATA_START_OUT = 1, |
| 140 |
AUDIO_DATA_OUT, |
| 141 |
} |
| 142 |
AUDIO_ProcessingTypeDef; |
| 143 |
|
| 144 |
/* Structure for AUDIO process */ |
| 145 |
typedef struct |
| 146 |
{ |
| 147 |
uint8_t Channels; |
| 148 |
uint8_t Bits; |
| 149 |
uint32_t SampleRate; |
| 150 |
} |
| 151 |
AUDIO_FormatTypeDef; |
| 152 |
|
| 153 |
typedef struct |
| 154 |
{ |
| 155 |
uint8_t Ep; |
| 156 |
uint16_t EpSize; |
| 157 |
uint8_t AltSettings; |
| 158 |
uint8_t interface; |
| 159 |
uint8_t valid; |
| 160 |
uint16_t Poll; |
| 161 |
} |
| 162 |
AUDIO_STREAMING_IN_HandleTypeDef; |
| 163 |
|
| 164 |
typedef struct |
| 165 |
{ |
| 166 |
uint8_t Ep; |
| 167 |
uint16_t EpSize; |
| 168 |
uint8_t AltSettings; |
| 169 |
uint8_t interface; |
| 170 |
uint8_t valid; |
| 171 |
uint16_t Poll; |
| 172 |
} |
| 173 |
AUDIO_STREAMING_OUT_HandleTypeDef; |
| 174 |
|
| 175 |
|
| 176 |
typedef struct |
| 177 |
{ |
| 178 |
uint8_t mute; |
| 179 |
uint32_t volumeMin; |
| 180 |
uint32_t volumeMax; |
| 181 |
uint32_t volume; |
| 182 |
uint32_t resolution; |
| 183 |
} |
| 184 |
AUDIO_ControlAttributeTypeDef; |
| 185 |
|
| 186 |
typedef struct |
| 187 |
{ |
| 188 |
|
| 189 |
uint8_t Ep; |
| 190 |
uint16_t EpSize; |
| 191 |
uint8_t interface; |
| 192 |
uint8_t AltSettings; |
| 193 |
uint8_t supported; |
| 194 |
|
| 195 |
uint8_t Pipe; |
| 196 |
uint8_t Poll; |
| 197 |
uint32_t timer ; |
| 198 |
|
| 199 |
uint8_t asociated_as; |
| 200 |
uint8_t asociated_mixer; |
| 201 |
uint8_t asociated_selector; |
| 202 |
uint8_t asociated_feature; |
| 203 |
uint8_t asociated_terminal; |
| 204 |
uint8_t asociated_channels; |
| 205 |
|
| 206 |
uint32_t frequency; |
| 207 |
uint8_t *buf; |
| 208 |
uint8_t *cbuf; |
| 209 |
uint32_t partial_ptr; |
| 210 |
|
| 211 |
uint32_t global_ptr; |
| 212 |
uint16_t frame_length; |
| 213 |
uint32_t total_length; |
| 214 |
|
| 215 |
AUDIO_ControlAttributeTypeDef attribute; |
| 216 |
} |
| 217 |
AUDIO_InterfaceStreamPropTypeDef; |
| 218 |
|
| 219 |
typedef struct |
| 220 |
{ |
| 221 |
|
| 222 |
uint8_t Ep; |
| 223 |
uint16_t EpSize; |
| 224 |
uint8_t interface; |
| 225 |
uint8_t supported; |
| 226 |
|
| 227 |
uint8_t Pipe; |
| 228 |
uint8_t Poll; |
| 229 |
uint32_t timer ; |
| 230 |
} |
| 231 |
AUDIO_InterfaceControlPropTypeDef; |
| 232 |
|
| 233 |
|
| 234 |
#define AUDIO_MAX_AUDIO_STD_INTERFACE 0x05 |
| 235 |
#define AUDIO_MAX_FREQ_SUPPORTED 0x05 |
| 236 |
#define AUDIO_MAX_STREAMING_INTERFACE 0x05 |
| 237 |
#define AUDIO_MAX_NUM_IN_TERMINAL 0x04 |
| 238 |
#define AUDIO_MAX_NUM_OUT_TERMINAL 0x04 |
| 239 |
#define AUDIO_MAX_NUM_FEATURE_UNIT 0x04 |
| 240 |
#define AUDIO_MAX_NUM_MIXER_UNIT 0x04 |
| 241 |
#define AUDIO_MAX_NUM_SELECTOR_UNIT 0x04 |
| 242 |
|
| 243 |
#define HEADPHONE_SUPPORTED 0x01 |
| 244 |
#define MICROPHONE_SUPPORTED 0x02 |
| 245 |
#define HEADSET_SUPPORTED 0x03 |
| 246 |
|
| 247 |
|
| 248 |
/*Class-Specific AS(Audio Streaming) Interface Descriptor*/ |
| 249 |
typedef struct |
| 250 |
{ |
| 251 |
uint8_t bLength; |
| 252 |
uint8_t bDescriptorType; |
| 253 |
uint8_t bDescriptorSubtype; |
| 254 |
uint8_t bTerminalLink; |
| 255 |
uint8_t bDelay; |
| 256 |
uint8_t wFormatTag[2]; |
| 257 |
} |
| 258 |
AUDIO_ASGeneralDescTypeDef; |
| 259 |
|
| 260 |
/*Class-Specific AS(Audio Streaming) Format Type Descriptor*/ |
| 261 |
typedef struct |
| 262 |
{ |
| 263 |
uint8_t bLength; /*At to be deside*/ |
| 264 |
uint8_t bDescriptorType; |
| 265 |
uint8_t bDescriptorSubtype; |
| 266 |
uint8_t bFormatType; |
| 267 |
uint8_t bNrChannels; |
| 268 |
uint8_t bSubframeSize; |
| 269 |
uint8_t bBitResolution; |
| 270 |
uint8_t bSamFreqType; |
| 271 |
uint8_t tSamFreq[][3]; |
| 272 |
} |
| 273 |
AUDIO_ASFormatTypeDescTypeDef; |
| 274 |
|
| 275 |
/*Class-Specific AS(Audio Streaming) Interface Descriptor*/ |
| 276 |
typedef struct |
| 277 |
{ |
| 278 |
AUDIO_ASGeneralDescTypeDef *GeneralDesc; |
| 279 |
AUDIO_ASFormatTypeDescTypeDef *FormatTypeDesc; |
| 280 |
} |
| 281 |
AUDIO_ASDescTypeDef; |
| 282 |
|
| 283 |
/* 4.3.2 Class-Specific AC Interface Descriptor */ |
| 284 |
|
| 285 |
typedef struct |
| 286 |
{ |
| 287 |
uint8_t bLength; |
| 288 |
uint8_t bDescriptorType; |
| 289 |
uint8_t bDescriptorSubtype; |
| 290 |
uint8_t bcdADC[2]; |
| 291 |
uint8_t wTotalLength[2]; |
| 292 |
uint8_t bInCollection; |
| 293 |
uint8_t baInterfaceNr[]; |
| 294 |
} |
| 295 |
AUDIO_HeaderDescTypeDef; |
| 296 |
|
| 297 |
/* 4.3.2.1 Input Terminal Descriptor */ |
| 298 |
typedef struct |
| 299 |
{ |
| 300 |
uint8_t bLength; |
| 301 |
uint8_t bDescriptorType; |
| 302 |
uint8_t bDescriptorSubtype; |
| 303 |
uint8_t bTerminalID; |
| 304 |
uint8_t wTerminalType[2]; |
| 305 |
uint8_t bAssocTerminal; |
| 306 |
uint8_t bNrChannels; |
| 307 |
uint8_t wChannelConfig[2]; |
| 308 |
uint8_t iChannelNames; |
| 309 |
uint8_t iTerminal; |
| 310 |
} |
| 311 |
AUDIO_ITDescTypeDef; |
| 312 |
|
| 313 |
/* 4.3.2.2 Output Terminal Descriptor */ |
| 314 |
typedef struct |
| 315 |
{ |
| 316 |
uint8_t bLength; |
| 317 |
uint8_t bDescriptorType; |
| 318 |
uint8_t bDescriptorSubtype; |
| 319 |
uint8_t bTerminalID; |
| 320 |
uint8_t wTerminalType[2]; |
| 321 |
uint8_t bAssocTerminal; |
| 322 |
uint8_t bSourceID; |
| 323 |
uint8_t iTerminal; |
| 324 |
} |
| 325 |
AUDIO_OTDescTypeDef; |
| 326 |
|
| 327 |
/* 4.3.2.3 Feature Descriptor */ |
| 328 |
typedef struct |
| 329 |
{ |
| 330 |
uint8_t bLength; |
| 331 |
uint8_t bDescriptorType; |
| 332 |
uint8_t bDescriptorSubtype; |
| 333 |
uint8_t bUnitID; |
| 334 |
uint8_t bSourceID; |
| 335 |
uint8_t bControlSize; |
| 336 |
uint8_t bmaControls[][2]; |
| 337 |
} |
| 338 |
AUDIO_FeatureDescTypeDef; |
| 339 |
|
| 340 |
|
| 341 |
/* 4.3.2.3 Feature Descriptor */ |
| 342 |
typedef struct |
| 343 |
{ |
| 344 |
uint8_t bLength; |
| 345 |
uint8_t bDescriptorType; |
| 346 |
uint8_t bDescriptorSubtype; |
| 347 |
uint8_t bUnitID; |
| 348 |
uint8_t bNrInPins; |
| 349 |
uint8_t bSourceID0; |
| 350 |
uint8_t bSourceID1; |
| 351 |
uint8_t bNrChannels; |
| 352 |
uint8_t bmChannelsConfig[2]; |
| 353 |
uint8_t iChannelsNames; |
| 354 |
uint8_t bmaControls; |
| 355 |
uint8_t iMixer; |
| 356 |
} |
| 357 |
AUDIO_MixerDescTypeDef; |
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
/* 4.3.2.3 Feature Descriptor */ |
| 362 |
typedef struct |
| 363 |
{ |
| 364 |
uint8_t bLength; |
| 365 |
uint8_t bDescriptorType; |
| 366 |
uint8_t bDescriptorSubtype; |
| 367 |
uint8_t bUnitID; |
| 368 |
uint8_t bNrInPins; |
| 369 |
uint8_t bSourceID0; |
| 370 |
uint8_t iSelector; |
| 371 |
} |
| 372 |
AUDIO_SelectorDescTypeDef; |
| 373 |
|
| 374 |
/*Class-Specific AC(Audio Control) Interface Descriptor*/ |
| 375 |
typedef struct |
| 376 |
{ |
| 377 |
AUDIO_HeaderDescTypeDef *HeaderDesc; |
| 378 |
AUDIO_ITDescTypeDef *InputTerminalDesc [AUDIO_MAX_NUM_IN_TERMINAL]; |
| 379 |
AUDIO_OTDescTypeDef *OutputTerminalDesc[AUDIO_MAX_NUM_OUT_TERMINAL]; |
| 380 |
AUDIO_FeatureDescTypeDef *FeatureUnitDesc [AUDIO_MAX_NUM_FEATURE_UNIT]; |
| 381 |
AUDIO_MixerDescTypeDef *MixerUnitDesc [AUDIO_MAX_NUM_MIXER_UNIT]; |
| 382 |
AUDIO_SelectorDescTypeDef *SelectorUnitDesc [AUDIO_MAX_NUM_SELECTOR_UNIT]; |
| 383 |
} |
| 384 |
AUDIO_ACDescTypeDef; |
| 385 |
|
| 386 |
/*Class-Specific AC : Global descriptor*/ |
| 387 |
|
| 388 |
typedef struct |
| 389 |
{ |
| 390 |
AUDIO_ACDescTypeDef cs_desc; /* Only one control descriptor*/ |
| 391 |
AUDIO_ASDescTypeDef as_desc[AUDIO_MAX_STREAMING_INTERFACE]; |
| 392 |
|
| 393 |
uint16_t ASNum; |
| 394 |
uint16_t InputTerminalNum; |
| 395 |
uint16_t OutputTerminalNum; |
| 396 |
uint16_t FeatureUnitNum; |
| 397 |
uint16_t SelectorUnitNum; |
| 398 |
uint16_t MixerUnitNum; |
| 399 |
} |
| 400 |
AUDIO_ClassSpecificDescTypedef; |
| 401 |
|
| 402 |
|
| 403 |
typedef struct _AUDIO_Process |
| 404 |
{ |
| 405 |
AUDIO_ReqStateTypeDef req_state; |
| 406 |
AUDIO_CSReqStateTypeDef cs_req_state; |
| 407 |
AUDIO_PlayStateTypeDef play_state; |
| 408 |
AUDIO_ControlStateTypeDef control_state; |
| 409 |
AUDIO_ProcessingTypeDef processing_state; |
| 410 |
|
| 411 |
AUDIO_STREAMING_IN_HandleTypeDef stream_in[AUDIO_MAX_AUDIO_STD_INTERFACE]; |
| 412 |
AUDIO_STREAMING_OUT_HandleTypeDef stream_out[AUDIO_MAX_AUDIO_STD_INTERFACE]; |
| 413 |
AUDIO_ClassSpecificDescTypedef class_desc; |
| 414 |
|
| 415 |
AUDIO_InterfaceStreamPropTypeDef headphone; |
| 416 |
AUDIO_InterfaceStreamPropTypeDef microphone; |
| 417 |
AUDIO_InterfaceControlPropTypeDef control; |
| 418 |
uint16_t mem [8]; |
| 419 |
uint8_t temp_feature; |
| 420 |
uint8_t temp_channels; |
| 421 |
} |
| 422 |
AUDIO_HandleTypeDef; |
| 423 |
|
| 424 |
/** |
| 425 |
* @} |
| 426 |
*/ |
| 427 |
|
| 428 |
/** @defgroup USBH_AUDIO_CORE_Exported_Defines |
| 429 |
* @{ |
| 430 |
*/ |
| 431 |
|
| 432 |
|
| 433 |
/*Audio Interface Subclass Codes*/ |
| 434 |
#define AC_CLASS 0x01 |
| 435 |
|
| 436 |
/* A.2 Audio Interface Subclass Codes */ |
| 437 |
#define USB_SUBCLASS_AUDIOCONTROL 0x01 |
| 438 |
#define USB_SUBCLASS_AUDIOSTREAMING 0x02 |
| 439 |
#define USB_SUBCLASS_MIDISTREAMING 0x03 |
| 440 |
|
| 441 |
#define USB_DESC_TYPE_CS_INTERFACE 0x24 |
| 442 |
#define USB_DESC_TYPE_CS_ENDPOINT 0x25 |
| 443 |
|
| 444 |
/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */ |
| 445 |
#define UAC_HEADER 0x01 |
| 446 |
#define UAC_INPUT_TERMINAL 0x02 |
| 447 |
#define UAC_OUTPUT_TERMINAL 0x03 |
| 448 |
#define UAC_MIXER_UNIT 0x04 |
| 449 |
#define UAC_SELECTOR_UNIT 0x05 |
| 450 |
#define UAC_FEATURE_UNIT 0x06 |
| 451 |
#define UAC_PROCESSING_UNIT 0x07 |
| 452 |
#define UAC_EXTENSION_UNIT 0x08 |
| 453 |
|
| 454 |
/*Audio Class-Specific Endpoint Descriptor Subtypes*/ |
| 455 |
#define EP_CONTROL_UNDEFINED 0x00 |
| 456 |
#define SAMPLING_FREQ_CONTROL 0x01 |
| 457 |
#define PITCH_CONTROL 0x02 |
| 458 |
|
| 459 |
/*Feature unit control selector*/ |
| 460 |
#define FU_CONTROL_UNDEFINED 0x00 |
| 461 |
#define MUTE_CONTROL 0x01 |
| 462 |
#define VOLUME_CONTROL 0x02 |
| 463 |
#define BASS_CONTROL 0x03 |
| 464 |
#define MID_CONTROL 0x04 |
| 465 |
#define TREBLE_CONTROL 0x05 |
| 466 |
#define GRAPHIC_EQUALIZER_CONTROL 0x06 |
| 467 |
#define AUTOMATIC_GAIN_CONTROL 0x07 |
| 468 |
#define DELAY_CONTROL 0x08 |
| 469 |
#define BASS_BOOST_CONTROL 0x09 |
| 470 |
#define LOUDNESS_CONTROL 0x0A |
| 471 |
|
| 472 |
/*Terminal control selector*/ |
| 473 |
#define TE_CONTROL_UNDEFINED 0x00 |
| 474 |
#define COPY_PROTECT_CONTROL 0x01 |
| 475 |
|
| 476 |
|
| 477 |
/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ |
| 478 |
#define UAC_AS_GENERAL 0x01 |
| 479 |
#define UAC_FORMAT_TYPE 0x02 |
| 480 |
#define UAC_FORMAT_SPECIFIC 0x03 |
| 481 |
|
| 482 |
/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */ |
| 483 |
#define UAC_EP_GENERAL 0x01 |
| 484 |
|
| 485 |
/* A.9 Audio Class-Specific Request Codes */ |
| 486 |
#define UAC_SET_ 0x00 |
| 487 |
#define UAC_GET_ 0x80 |
| 488 |
|
| 489 |
#define UAC__CUR 0x1 |
| 490 |
#define UAC__MIN 0x2 |
| 491 |
#define UAC__MAX 0x3 |
| 492 |
#define UAC__RES 0x4 |
| 493 |
#define UAC__MEM 0x5 |
| 494 |
|
| 495 |
#define UAC_SET_CUR (UAC_SET_ | UAC__CUR) |
| 496 |
#define UAC_GET_CUR (UAC_GET_ | UAC__CUR) |
| 497 |
#define UAC_SET_MIN (UAC_SET_ | UAC__MIN) |
| 498 |
#define UAC_GET_MIN (UAC_GET_ | UAC__MIN) |
| 499 |
#define UAC_SET_MAX (UAC_SET_ | UAC__MAX) |
| 500 |
#define UAC_GET_MAX (UAC_GET_ | UAC__MAX) |
| 501 |
#define UAC_SET_RES (UAC_SET_ | UAC__RES) |
| 502 |
#define UAC_GET_RES (UAC_GET_ | UAC__RES) |
| 503 |
#define UAC_SET_MEM (UAC_SET_ | UAC__MEM) |
| 504 |
#define UAC_GET_MEM (UAC_GET_ | UAC__MEM) |
| 505 |
|
| 506 |
#define UAC_GET_STAT 0xff |
| 507 |
|
| 508 |
/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ |
| 509 |
#define UAC_MS_HEADER 0x01 |
| 510 |
#define UAC_MIDI_IN_JACK 0x02 |
| 511 |
#define UAC_MIDI_OUT_JACK 0x03 |
| 512 |
|
| 513 |
/* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */ |
| 514 |
#define UAC_MS_GENERAL 0x01 |
| 515 |
|
| 516 |
/* Terminals - 2.1 USB Terminal Types */ |
| 517 |
#define UAC_TERMINAL_UNDEFINED 0x100 |
| 518 |
#define UAC_TERMINAL_STREAMING 0x101 |
| 519 |
#define UAC_TERMINAL_VENDOR_SPEC 0x1FF |
| 520 |
|
| 521 |
/** |
| 522 |
* @} |
| 523 |
*/ |
| 524 |
|
| 525 |
/** @defgroup USBH_AUDIO_CORE_Exported_Macros |
| 526 |
* @{ |
| 527 |
*/ |
| 528 |
/** |
| 529 |
* @} |
| 530 |
*/ |
| 531 |
|
| 532 |
/** @defgroup USBH_AUDIO_CORE_Exported_Variables |
| 533 |
* @{ |
| 534 |
*/ |
| 535 |
extern USBH_ClassTypeDef AUDIO_Class; |
| 536 |
#define USBH_AUDIO_CLASS &AUDIO_Class |
| 537 |
/** |
| 538 |
* @} |
| 539 |
*/ |
| 540 |
|
| 541 |
/** @defgroup USBH_AUDIO_CORE_Exported_FunctionsPrototype |
| 542 |
* @{ |
| 543 |
*/ |
| 544 |
USBH_StatusTypeDef USBH_AUDIO_SetFrequency (USBH_HandleTypeDef *phost, |
| 545 |
uint16_t sample_rate, |
| 546 |
uint8_t channel_num, |
| 547 |
uint8_t data_width); |
| 548 |
|
| 549 |
USBH_StatusTypeDef USBH_AUDIO_Play (USBH_HandleTypeDef *phost, uint8_t *buf, uint32_t length); |
| 550 |
USBH_StatusTypeDef USBH_AUDIO_Stop (USBH_HandleTypeDef *phost); |
| 551 |
USBH_StatusTypeDef USBH_AUDIO_Suspend (USBH_HandleTypeDef *phost); |
| 552 |
USBH_StatusTypeDef USBH_AUDIO_Resume (USBH_HandleTypeDef *phost); |
| 553 |
USBH_StatusTypeDef USBH_AUDIO_SetVolume (USBH_HandleTypeDef *phost, AUDIO_VolumeCtrlTypeDef volume_ctl); |
| 554 |
USBH_StatusTypeDef USBH_AUDIO_ChangeOutBuffer (USBH_HandleTypeDef *phost, uint8_t *buf); |
| 555 |
int32_t USBH_AUDIO_GetOutOffset (USBH_HandleTypeDef *phost); |
| 556 |
|
| 557 |
void USBH_AUDIO_FrequencySet(USBH_HandleTypeDef *phost); |
| 558 |
/** |
| 559 |
* @} |
| 560 |
*/ |
| 561 |
|
| 562 |
|
| 563 |
#endif /* __USBH_AUDIO_H */ |
| 564 |
|
| 565 |
/** |
| 566 |
* @} |
| 567 |
*/ |
| 568 |
|
| 569 |
/** |
| 570 |
* @} |
| 571 |
*/ |
| 572 |
|
| 573 |
/** |
| 574 |
* @} |
| 575 |
*/ |
| 576 |
|
| 577 |
/** |
| 578 |
* @} |
| 579 |
*/ |
| 580 |
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
| 581 |
|