Mbed OS Reference
Loading...
Searching...
No Matches
USBAudio_Types.h
1/*
2 * Copyright (c) 2018-2019, Arm Limited and affiliates.
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef USBAUDIO_TYPES_H
19#define USBAUDIO_TYPES_H
20
21
22#define DEFAULT_CONFIGURATION (1)
23
24// Audio Request Codes
25#define REQUEST_SET_CUR 0x01
26#define REQUEST_GET_CUR 0x81
27#define REQUEST_SET_MIN 0x02
28#define REQUEST_GET_MIN 0x82
29#define REQUEST_SET_MAX 0x03
30#define REQUEST_GET_MAX 0x83
31#define REQUEST_SET_RES 0x04
32#define REQUEST_GET_RES 0x84
33
34#define MUTE_CONTROL 0x01
35#define VOLUME_CONTROL 0x02
36
37
38// Audio Descriptor Sizes
39#define CONTROL_INTERFACE_DESCRIPTOR_LENGTH 0x09
40#define STREAMING_INTERFACE_DESCRIPTOR_LENGTH 0x07
41#define INPUT_TERMINAL_DESCRIPTOR_LENGTH 0x0C
42#define OUTPUT_TERMINAL_DESCRIPTOR_LENGTH 0x09
43#define FEATURE_UNIT_DESCRIPTOR_LENGTH 0x09
44#define STREAMING_ENDPOINT_DESCRIPTOR_LENGTH 0x07
45
46// Audio Format Type Descriptor Sizes
47#define FORMAT_TYPE_I_DESCRIPTOR_LENGTH 0x0b
48
49#define AUDIO_CLASS 0x01
50#define SUBCLASS_AUDIOCONTROL 0x01
51#define SUBCLASS_AUDIOSTREAMING 0x02
52
53// Audio Descriptor Types
54#define INTERFACE_DESCRIPTOR_TYPE 0x24
55#define ENDPOINT_DESCRIPTOR_TYPE 0x25
56
57// Audio Control Interface Descriptor Subtypes
58#define CONTROL_HEADER 0x01
59#define CONTROL_INPUT_TERMINAL 0x02
60#define CONTROL_OUTPUT_TERMINAL 0x03
61#define CONTROL_FEATURE_UNIT 0x06
62
63// USB Terminal Types
64#define TERMINAL_USB_STREAMING 0x0101
65
66// Predefined Audio Channel Configuration Bits
67// Mono
68#define CHANNEL_M 0x0000
69#define CHANNEL_L 0x0001 /* Left Front */
70#define CHANNEL_R 0x0002 /* Right Front */
71
72// Feature Unit Control Bits
73#define CONTROL_MUTE 0x0001
74#define CONTROL_VOLUME 0x0002
75
76// Input Terminal Types
77#define TERMINAL_MICROPHONE 0x0201
78
79// Output Terminal Types
80#define TERMINAL_SPEAKER 0x0301
81#define TERMINAL_HEADPHONES 0x0302
82
83// Audio Streaming Interface Descriptor Subtypes
84#define STREAMING_GENERAL 0x01
85#define STREAMING_FORMAT_TYPE 0x02
86
87// Audio Data Format Type I Codes
88#define FORMAT_PCM 0x0001
89
90// Audio Format Types
91#define FORMAT_TYPE_I 0x01
92
93// Audio Endpoint Descriptor Subtypes
94#define ENDPOINT_GENERAL 0x01
95
96#endif