Il y avait des problèmes dans la libraire...
Fork of USBDEVICE by
USBAudio/USBAudio.cpp@1:2a3ae13b45ef, 2016-12-15 (annotated)
- Committer:
- frq08711@LMECWL0871.LME.ST.COM
- Date:
- Thu Dec 15 17:40:59 2016 +0100
- Revision:
- 1:2a3ae13b45ef
- Child:
- 3:d9c7334e2183
copy of git hub directory unsupported/USBDevice
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 1 | /* Copyright (c) 2010-2011 mbed.org, MIT License |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 2 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 7 | * Software is furnished to do so, subject to the following conditions: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 8 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 10 | * substantial portions of the Software. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 11 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 17 | */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 18 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 19 | #include "stdint.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 20 | #include "USBAudio.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 21 | #include "USBAudio_Types.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 22 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 23 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 24 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 25 | USBAudio::USBAudio(uint32_t frequency_in, uint8_t channel_nb_in, uint32_t frequency_out, uint8_t channel_nb_out, uint16_t vendor_id, uint16_t product_id, uint16_t product_release): USBDevice(vendor_id, product_id, product_release) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 26 | mute = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 27 | volCur = 0x0080; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 28 | volMin = 0x0000; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 29 | volMax = 0x0100; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 30 | volRes = 0x0004; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 31 | available = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 32 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 33 | FREQ_IN = frequency_in; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 34 | FREQ_OUT = frequency_out; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 35 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 36 | this->channel_nb_in = channel_nb_in; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 37 | this->channel_nb_out = channel_nb_out; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 38 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 39 | // stereo -> *2, mono -> *1 |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 40 | PACKET_SIZE_ISO_IN = (FREQ_IN / 500) * channel_nb_in; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 41 | PACKET_SIZE_ISO_OUT = (FREQ_OUT / 500) * channel_nb_out; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 42 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 43 | // STEREO -> left and right |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 44 | channel_config_in = (channel_nb_in == 1) ? CHANNEL_M : CHANNEL_L + CHANNEL_R; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 45 | channel_config_out = (channel_nb_out == 1) ? CHANNEL_M : CHANNEL_L + CHANNEL_R; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 46 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 47 | SOF_handler = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 48 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 49 | buf_stream_out = NULL; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 50 | buf_stream_in = NULL; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 51 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 52 | interruptOUT = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 53 | writeIN = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 54 | interruptIN = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 55 | available = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 56 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 57 | volume = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 58 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 59 | // connect the device |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 60 | USBDevice::connect(); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 61 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 62 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 63 | bool USBAudio::read(uint8_t * buf) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 64 | buf_stream_in = buf; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 65 | SOF_handler = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 66 | while (!available || !SOF_handler); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 67 | available = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 68 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 69 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 70 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 71 | bool USBAudio::readNB(uint8_t * buf) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 72 | buf_stream_in = buf; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 73 | SOF_handler = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 74 | while (!SOF_handler); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 75 | if (available) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 76 | available = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 77 | buf_stream_in = NULL; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 78 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 79 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 80 | return false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 81 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 82 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 83 | bool USBAudio::readWrite(uint8_t * buf_read, uint8_t * buf_write) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 84 | buf_stream_in = buf_read; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 85 | SOF_handler = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 86 | writeIN = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 87 | if (interruptIN) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 88 | USBDevice::writeNB(EP3IN, buf_write, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 89 | } else { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 90 | buf_stream_out = buf_write; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 91 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 92 | while (!available); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 93 | if (interruptIN) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 94 | while (!writeIN); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 95 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 96 | while (!SOF_handler); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 97 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 98 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 99 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 100 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 101 | bool USBAudio::write(uint8_t * buf) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 102 | writeIN = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 103 | SOF_handler = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 104 | if (interruptIN) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 105 | USBDevice::writeNB(EP3IN, buf, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 106 | } else { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 107 | buf_stream_out = buf; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 108 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 109 | while (!SOF_handler); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 110 | if (interruptIN) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 111 | while (!writeIN); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 112 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 113 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 114 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 115 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 116 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 117 | float USBAudio::getVolume() { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 118 | return (mute) ? 0.0 : volume; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 119 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 120 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 121 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 122 | bool USBAudio::EPISO_OUT_callback() { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 123 | uint32_t size = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 124 | interruptOUT = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 125 | if (buf_stream_in != NULL) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 126 | readEP(EP3OUT, (uint8_t *)buf_stream_in, &size, PACKET_SIZE_ISO_IN); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 127 | available = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 128 | buf_stream_in = NULL; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 129 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 130 | readStart(EP3OUT, PACKET_SIZE_ISO_IN); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 131 | return false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 132 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 133 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 134 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 135 | bool USBAudio::EPISO_IN_callback() { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 136 | interruptIN = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 137 | writeIN = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 138 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 139 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 140 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 141 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 142 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 143 | // Called in ISR context on each start of frame |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 144 | void USBAudio::SOF(int frameNumber) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 145 | uint32_t size = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 146 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 147 | if (!interruptOUT) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 148 | // read the isochronous endpoint |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 149 | if (buf_stream_in != NULL) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 150 | if (USBDevice::readEP_NB(EP3OUT, (uint8_t *)buf_stream_in, &size, PACKET_SIZE_ISO_IN)) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 151 | if (size) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 152 | available = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 153 | readStart(EP3OUT, PACKET_SIZE_ISO_IN); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 154 | buf_stream_in = NULL; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 155 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 156 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 157 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 158 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 159 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 160 | if (!interruptIN) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 161 | // write if needed |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 162 | if (buf_stream_out != NULL) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 163 | USBDevice::writeNB(EP3IN, (uint8_t *)buf_stream_out, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 164 | buf_stream_out = NULL; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 165 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 166 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 167 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 168 | SOF_handler = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 169 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 170 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 171 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 172 | // Called in ISR context |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 173 | // Set configuration. Return false if the configuration is not supported. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 174 | bool USBAudio::USBCallback_setConfiguration(uint8_t configuration) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 175 | if (configuration != DEFAULT_CONFIGURATION) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 176 | return false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 177 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 178 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 179 | // Configure isochronous endpoint |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 180 | realiseEndpoint(EP3OUT, PACKET_SIZE_ISO_IN, ISOCHRONOUS); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 181 | realiseEndpoint(EP3IN, PACKET_SIZE_ISO_OUT, ISOCHRONOUS); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 182 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 183 | // activate readings on this endpoint |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 184 | readStart(EP3OUT, PACKET_SIZE_ISO_IN); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 185 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 186 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 187 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 188 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 189 | // Called in ISR context |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 190 | // Set alternate setting. Return false if the alternate setting is not supported |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 191 | bool USBAudio::USBCallback_setInterface(uint16_t interface, uint8_t alternate) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 192 | if (interface == 0 && alternate == 0) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 193 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 194 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 195 | if (interface == 1 && (alternate == 0 || alternate == 1)) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 196 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 197 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 198 | if (interface == 2 && (alternate == 0 || alternate == 1)) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 199 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 200 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 201 | return false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 202 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 203 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 204 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 205 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 206 | // Called in ISR context |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 207 | // Called by USBDevice on Endpoint0 request |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 208 | // This is used to handle extensions to standard requests and class specific requests. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 209 | // Return true if class handles this request |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 210 | bool USBAudio::USBCallback_request() { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 211 | bool success = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 212 | CONTROL_TRANSFER * transfer = getTransferPtr(); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 213 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 214 | // Process class-specific requests |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 215 | if (transfer->setup.bmRequestType.Type == CLASS_TYPE) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 216 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 217 | // Feature Unit: Interface = 0, ID = 2 |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 218 | if (transfer->setup.wIndex == 0x0200) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 219 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 220 | // Master Channel |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 221 | if ((transfer->setup.wValue & 0xff) == 0) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 222 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 223 | switch (transfer->setup.wValue >> 8) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 224 | case MUTE_CONTROL: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 225 | switch (transfer->setup.bRequest) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 226 | case REQUEST_GET_CUR: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 227 | transfer->remaining = 1; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 228 | transfer->ptr = &mute; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 229 | transfer->direction = DEVICE_TO_HOST; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 230 | success = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 231 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 232 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 233 | case REQUEST_SET_CUR: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 234 | transfer->remaining = 1; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 235 | transfer->notify = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 236 | transfer->direction = HOST_TO_DEVICE; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 237 | success = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 238 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 239 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 240 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 241 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 242 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 243 | case VOLUME_CONTROL: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 244 | switch (transfer->setup.bRequest) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 245 | case REQUEST_GET_CUR: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 246 | transfer->remaining = 2; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 247 | transfer->ptr = (uint8_t *)&volCur; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 248 | transfer->direction = DEVICE_TO_HOST; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 249 | success = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 250 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 251 | case REQUEST_GET_MIN: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 252 | transfer->remaining = 2; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 253 | transfer->ptr = (uint8_t *)&volMin; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 254 | transfer->direction = DEVICE_TO_HOST; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 255 | success = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 256 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 257 | case REQUEST_GET_MAX: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 258 | transfer->remaining = 2; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 259 | transfer->ptr = (uint8_t *)&volMax; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 260 | transfer->direction = DEVICE_TO_HOST; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 261 | success = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 262 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 263 | case REQUEST_GET_RES: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 264 | transfer->remaining = 2; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 265 | transfer->ptr = (uint8_t *)&volRes; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 266 | transfer->direction = DEVICE_TO_HOST; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 267 | success = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 268 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 269 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 270 | case REQUEST_SET_CUR: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 271 | transfer->remaining = 2; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 272 | transfer->notify = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 273 | transfer->direction = HOST_TO_DEVICE; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 274 | success = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 275 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 276 | case REQUEST_SET_MIN: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 277 | transfer->remaining = 2; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 278 | transfer->notify = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 279 | transfer->direction = HOST_TO_DEVICE; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 280 | success = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 281 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 282 | case REQUEST_SET_MAX: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 283 | transfer->remaining = 2; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 284 | transfer->notify = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 285 | transfer->direction = HOST_TO_DEVICE; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 286 | success = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 287 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 288 | case REQUEST_SET_RES: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 289 | transfer->remaining = 2; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 290 | transfer->notify = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 291 | transfer->direction = HOST_TO_DEVICE; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 292 | success = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 293 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 294 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 295 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 296 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 297 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 298 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 299 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 300 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 301 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 302 | return success; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 303 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 304 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 305 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 306 | // Called in ISR context when a data OUT stage has been performed |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 307 | void USBAudio::USBCallback_requestCompleted(uint8_t * buf, uint32_t length) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 308 | if ((length == 1) || (length == 2)) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 309 | uint16_t data = (length == 1) ? *buf : *((uint16_t *)buf); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 310 | CONTROL_TRANSFER * transfer = getTransferPtr(); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 311 | switch (transfer->setup.wValue >> 8) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 312 | case MUTE_CONTROL: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 313 | switch (transfer->setup.bRequest) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 314 | case REQUEST_SET_CUR: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 315 | mute = data & 0xff; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 316 | if (updateVol) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 317 | updateVol.call(); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 318 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 319 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 320 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 321 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 322 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 323 | case VOLUME_CONTROL: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 324 | switch (transfer->setup.bRequest) { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 325 | case REQUEST_SET_CUR: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 326 | volCur = data; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 327 | volume = (float)volCur/(float)volMax; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 328 | if (updateVol) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 329 | updateVol.call(); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 330 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 331 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 332 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 333 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 334 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 335 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 336 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 337 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 338 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 339 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 340 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 341 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 342 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 343 | #define TOTAL_DESCRIPTOR_LENGTH ((1 * CONFIGURATION_DESCRIPTOR_LENGTH) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 344 | + (5 * INTERFACE_DESCRIPTOR_LENGTH) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 345 | + (1 * CONTROL_INTERFACE_DESCRIPTOR_LENGTH + 1) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 346 | + (2 * INPUT_TERMINAL_DESCRIPTOR_LENGTH) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 347 | + (1 * FEATURE_UNIT_DESCRIPTOR_LENGTH) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 348 | + (2 * OUTPUT_TERMINAL_DESCRIPTOR_LENGTH) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 349 | + (2 * STREAMING_INTERFACE_DESCRIPTOR_LENGTH) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 350 | + (2 * FORMAT_TYPE_I_DESCRIPTOR_LENGTH) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 351 | + (2 * (ENDPOINT_DESCRIPTOR_LENGTH + 2)) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 352 | + (2 * STREAMING_ENDPOINT_DESCRIPTOR_LENGTH) ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 353 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 354 | #define TOTAL_CONTROL_INTF_LENGTH (CONTROL_INTERFACE_DESCRIPTOR_LENGTH + 1 + \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 355 | 2*INPUT_TERMINAL_DESCRIPTOR_LENGTH + \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 356 | FEATURE_UNIT_DESCRIPTOR_LENGTH + \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 357 | 2*OUTPUT_TERMINAL_DESCRIPTOR_LENGTH) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 358 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 359 | uint8_t * USBAudio::configurationDesc() { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 360 | static uint8_t configDescriptor[] = { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 361 | // Configuration 1 |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 362 | CONFIGURATION_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 363 | CONFIGURATION_DESCRIPTOR, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 364 | LSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (LSB) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 365 | MSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (MSB) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 366 | 0x03, // bNumInterfaces |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 367 | DEFAULT_CONFIGURATION, // bConfigurationValue |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 368 | 0x00, // iConfiguration |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 369 | 0x80, // bmAttributes |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 370 | 50, // bMaxPower |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 371 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 372 | // Interface 0, Alternate Setting 0, Audio Control |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 373 | INTERFACE_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 374 | INTERFACE_DESCRIPTOR, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 375 | 0x00, // bInterfaceNumber |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 376 | 0x00, // bAlternateSetting |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 377 | 0x00, // bNumEndpoints |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 378 | AUDIO_CLASS, // bInterfaceClass |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 379 | SUBCLASS_AUDIOCONTROL, // bInterfaceSubClass |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 380 | 0x00, // bInterfaceProtocol |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 381 | 0x00, // iInterface |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 382 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 383 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 384 | // Audio Control Interface |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 385 | CONTROL_INTERFACE_DESCRIPTOR_LENGTH + 1,// bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 386 | INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 387 | CONTROL_HEADER, // bDescriptorSubtype |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 388 | LSB(0x0100), // bcdADC (LSB) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 389 | MSB(0x0100), // bcdADC (MSB) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 390 | LSB(TOTAL_CONTROL_INTF_LENGTH), // wTotalLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 391 | MSB(TOTAL_CONTROL_INTF_LENGTH), // wTotalLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 392 | 0x02, // bInCollection |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 393 | 0x01, // baInterfaceNr |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 394 | 0x02, // baInterfaceNr |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 395 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 396 | // Audio Input Terminal (Speaker) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 397 | INPUT_TERMINAL_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 398 | INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 399 | CONTROL_INPUT_TERMINAL, // bDescriptorSubtype |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 400 | 0x01, // bTerminalID |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 401 | LSB(TERMINAL_USB_STREAMING), // wTerminalType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 402 | MSB(TERMINAL_USB_STREAMING), // wTerminalType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 403 | 0x00, // bAssocTerminal |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 404 | channel_nb_in, // bNrChannels |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 405 | (uint8_t)(LSB(channel_config_in)), // wChannelConfig |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 406 | (uint8_t)(MSB(channel_config_in)), // wChannelConfig |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 407 | 0x00, // iChannelNames |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 408 | 0x00, // iTerminal |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 409 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 410 | // Audio Feature Unit (Speaker) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 411 | FEATURE_UNIT_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 412 | INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 413 | CONTROL_FEATURE_UNIT, // bDescriptorSubtype |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 414 | 0x02, // bUnitID |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 415 | 0x01, // bSourceID |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 416 | 0x01, // bControlSize |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 417 | CONTROL_MUTE | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 418 | CONTROL_VOLUME, // bmaControls(0) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 419 | 0x00, // bmaControls(1) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 420 | 0x00, // iTerminal |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 421 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 422 | // Audio Output Terminal (Speaker) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 423 | OUTPUT_TERMINAL_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 424 | INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 425 | CONTROL_OUTPUT_TERMINAL, // bDescriptorSubtype |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 426 | 0x03, // bTerminalID |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 427 | LSB(TERMINAL_SPEAKER), // wTerminalType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 428 | MSB(TERMINAL_SPEAKER), // wTerminalType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 429 | 0x00, // bAssocTerminal |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 430 | 0x02, // bSourceID |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 431 | 0x00, // iTerminal |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 432 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 433 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 434 | // Audio Input Terminal (Microphone) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 435 | INPUT_TERMINAL_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 436 | INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 437 | CONTROL_INPUT_TERMINAL, // bDescriptorSubtype |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 438 | 0x04, // bTerminalID |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 439 | LSB(TERMINAL_MICROPHONE), // wTerminalType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 440 | MSB(TERMINAL_MICROPHONE), // wTerminalType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 441 | 0x00, // bAssocTerminal |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 442 | channel_nb_out, // bNrChannels |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 443 | (uint8_t)(LSB(channel_config_out)), // wChannelConfig |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 444 | (uint8_t)(MSB(channel_config_out)), // wChannelConfig |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 445 | 0x00, // iChannelNames |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 446 | 0x00, // iTerminal |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 447 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 448 | // Audio Output Terminal (Microphone) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 449 | OUTPUT_TERMINAL_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 450 | INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 451 | CONTROL_OUTPUT_TERMINAL, // bDescriptorSubtype |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 452 | 0x05, // bTerminalID |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 453 | LSB(TERMINAL_USB_STREAMING), // wTerminalType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 454 | MSB(TERMINAL_USB_STREAMING), // wTerminalType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 455 | 0x00, // bAssocTerminal |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 456 | 0x04, // bSourceID |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 457 | 0x00, // iTerminal |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 458 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 459 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 460 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 461 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 462 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 463 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 464 | // Interface 1, Alternate Setting 0, Audio Streaming - Zero Bandwith |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 465 | INTERFACE_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 466 | INTERFACE_DESCRIPTOR, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 467 | 0x01, // bInterfaceNumber |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 468 | 0x00, // bAlternateSetting |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 469 | 0x00, // bNumEndpoints |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 470 | AUDIO_CLASS, // bInterfaceClass |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 471 | SUBCLASS_AUDIOSTREAMING, // bInterfaceSubClass |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 472 | 0x00, // bInterfaceProtocol |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 473 | 0x00, // iInterface |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 474 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 475 | // Interface 1, Alternate Setting 1, Audio Streaming - Operational |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 476 | INTERFACE_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 477 | INTERFACE_DESCRIPTOR, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 478 | 0x01, // bInterfaceNumber |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 479 | 0x01, // bAlternateSetting |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 480 | 0x01, // bNumEndpoints |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 481 | AUDIO_CLASS, // bInterfaceClass |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 482 | SUBCLASS_AUDIOSTREAMING, // bInterfaceSubClass |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 483 | 0x00, // bInterfaceProtocol |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 484 | 0x00, // iInterface |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 485 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 486 | // Audio Streaming Interface |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 487 | STREAMING_INTERFACE_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 488 | INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 489 | STREAMING_GENERAL, // bDescriptorSubtype |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 490 | 0x01, // bTerminalLink |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 491 | 0x00, // bDelay |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 492 | LSB(FORMAT_PCM), // wFormatTag |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 493 | MSB(FORMAT_PCM), // wFormatTag |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 494 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 495 | // Audio Type I Format |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 496 | FORMAT_TYPE_I_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 497 | INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 498 | STREAMING_FORMAT_TYPE, // bDescriptorSubtype |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 499 | FORMAT_TYPE_I, // bFormatType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 500 | channel_nb_in, // bNrChannels |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 501 | 0x02, // bSubFrameSize |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 502 | 16, // bBitResolution |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 503 | 0x01, // bSamFreqType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 504 | (uint8_t)(LSB(FREQ_IN)), // tSamFreq |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 505 | (uint8_t)((FREQ_IN >> 8) & 0xff), // tSamFreq |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 506 | (uint8_t)((FREQ_IN >> 16) & 0xff), // tSamFreq |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 507 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 508 | // Endpoint - Standard Descriptor |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 509 | ENDPOINT_DESCRIPTOR_LENGTH + 2, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 510 | ENDPOINT_DESCRIPTOR, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 511 | PHY_TO_DESC(EPISO_OUT), // bEndpointAddress |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 512 | E_ISOCHRONOUS, // bmAttributes |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 513 | (uint8_t)(LSB(PACKET_SIZE_ISO_IN)), // wMaxPacketSize |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 514 | (uint8_t)(MSB(PACKET_SIZE_ISO_IN)), // wMaxPacketSize |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 515 | 0x01, // bInterval |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 516 | 0x00, // bRefresh |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 517 | 0x00, // bSynchAddress |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 518 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 519 | // Endpoint - Audio Streaming |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 520 | STREAMING_ENDPOINT_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 521 | ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 522 | ENDPOINT_GENERAL, // bDescriptor |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 523 | 0x00, // bmAttributes |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 524 | 0x00, // bLockDelayUnits |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 525 | LSB(0x0000), // wLockDelay |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 526 | MSB(0x0000), // wLockDelay |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 527 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 528 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 529 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 530 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 531 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 532 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 533 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 534 | // Interface 1, Alternate Setting 0, Audio Streaming - Zero Bandwith |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 535 | INTERFACE_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 536 | INTERFACE_DESCRIPTOR, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 537 | 0x02, // bInterfaceNumber |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 538 | 0x00, // bAlternateSetting |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 539 | 0x00, // bNumEndpoints |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 540 | AUDIO_CLASS, // bInterfaceClass |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 541 | SUBCLASS_AUDIOSTREAMING, // bInterfaceSubClass |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 542 | 0x00, // bInterfaceProtocol |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 543 | 0x00, // iInterface |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 544 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 545 | // Interface 1, Alternate Setting 1, Audio Streaming - Operational |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 546 | INTERFACE_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 547 | INTERFACE_DESCRIPTOR, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 548 | 0x02, // bInterfaceNumber |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 549 | 0x01, // bAlternateSetting |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 550 | 0x01, // bNumEndpoints |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 551 | AUDIO_CLASS, // bInterfaceClass |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 552 | SUBCLASS_AUDIOSTREAMING, // bInterfaceSubClass |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 553 | 0x00, // bInterfaceProtocol |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 554 | 0x00, // iInterface |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 555 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 556 | // Audio Streaming Interface |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 557 | STREAMING_INTERFACE_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 558 | INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 559 | SUBCLASS_AUDIOCONTROL, // bDescriptorSubtype |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 560 | 0x05, // bTerminalLink (output terminal microphone) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 561 | 0x01, // bDelay |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 562 | 0x01, // wFormatTag |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 563 | 0x00, // wFormatTag |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 564 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 565 | // Audio Type I Format |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 566 | FORMAT_TYPE_I_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 567 | INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 568 | SUBCLASS_AUDIOSTREAMING, // bDescriptorSubtype |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 569 | FORMAT_TYPE_I, // bFormatType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 570 | channel_nb_out, // bNrChannels |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 571 | 0x02, // bSubFrameSize |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 572 | 0x10, // bBitResolution |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 573 | 0x01, // bSamFreqType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 574 | (uint8_t)(LSB(FREQ_OUT)), // tSamFreq |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 575 | (uint8_t)((FREQ_OUT >> 8) & 0xff), // tSamFreq |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 576 | (uint8_t)((FREQ_OUT >> 16) & 0xff), // tSamFreq |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 577 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 578 | // Endpoint - Standard Descriptor |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 579 | ENDPOINT_DESCRIPTOR_LENGTH + 2, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 580 | ENDPOINT_DESCRIPTOR, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 581 | PHY_TO_DESC(EPISO_IN), // bEndpointAddress |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 582 | E_ISOCHRONOUS, // bmAttributes |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 583 | (uint8_t)(LSB(PACKET_SIZE_ISO_OUT)), // wMaxPacketSize |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 584 | (uint8_t)(MSB(PACKET_SIZE_ISO_OUT)), // wMaxPacketSize |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 585 | 0x01, // bInterval |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 586 | 0x00, // bRefresh |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 587 | 0x00, // bSynchAddress |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 588 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 589 | // Endpoint - Audio Streaming |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 590 | STREAMING_ENDPOINT_DESCRIPTOR_LENGTH, // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 591 | ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 592 | ENDPOINT_GENERAL, // bDescriptor |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 593 | 0x00, // bmAttributes |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 594 | 0x00, // bLockDelayUnits |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 595 | LSB(0x0000), // wLockDelay |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 596 | MSB(0x0000), // wLockDelay |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 597 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 598 | // Terminator |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 599 | 0 // bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 600 | }; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 601 | return configDescriptor; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 602 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 603 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 604 | uint8_t * USBAudio::stringIinterfaceDesc() { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 605 | static uint8_t stringIinterfaceDescriptor[] = { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 606 | 0x0c, //bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 607 | STRING_DESCRIPTOR, //bDescriptorType 0x03 |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 608 | 'A',0,'u',0,'d',0,'i',0,'o',0 //bString iInterface - Audio |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 609 | }; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 610 | return stringIinterfaceDescriptor; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 611 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 612 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 613 | uint8_t * USBAudio::stringIproductDesc() { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 614 | static uint8_t stringIproductDescriptor[] = { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 615 | 0x16, //bLength |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 616 | STRING_DESCRIPTOR, //bDescriptorType 0x03 |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 617 | 'M',0,'b',0,'e',0,'d',0,' ',0,'A',0,'u',0,'d',0,'i',0,'o',0 //bString iProduct - Mbed Audio |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 618 | }; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 619 | return stringIproductDescriptor; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 620 | } |