Il y avait des problèmes dans la libraire...

Fork of USBDEVICE by ST

Committer:
qroche
Date:
Sun Sep 03 23:19:21 2017 +0000
Branch:
master
Revision:
5:3329e56e51d7
Parent:
4:50ec00aa4515
fin;

Who changed what in which revision?

UserRevisionLine numberNew 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 3:d9c7334e2183 88 USBDevice::writeNB(EPISO_IN, 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 3:d9c7334e2183 105 USBDevice::writeNB(EPISO_IN, 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 4:50ec00aa4515 116 void USBAudio::writeSync(uint8_t *buf, AudioSampleCorrectType jitter_nb)
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 117 {
frq08711@LMECWL0871.LME.ST.COM 4:50ec00aa4515 118 if ((jitter_nb != RemoveOneSample) && (jitter_nb != AddOneSample)) {
frq08711@LMECWL0871.LME.ST.COM 4:50ec00aa4515 119 jitter_nb = NoCorrection;
frq08711@LMECWL0871.LME.ST.COM 4:50ec00aa4515 120 }
frq08711@LMECWL0871.LME.ST.COM 4:50ec00aa4515 121 /* each sample is 2 bytes */
frq08711@LMECWL0871.LME.ST.COM 4:50ec00aa4515 122 USBDevice::writeNB(EPISO_IN, buf, PACKET_SIZE_ISO_OUT + jitter_nb *(this->channel_nb_out*2), PACKET_SIZE_ISO_OUT+this->channel_nb_out*2);
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 123 }
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 124
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 125 uint32_t USBAudio::readSync(uint8_t *buf)
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 126 {
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 127 uint32_t size = 0;
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 128 USBDevice::readEP(EPISO_OUT, (uint8_t *)buf, &size, PACKET_SIZE_ISO_IN);
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 129 return size;
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 130 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 131
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 132 float USBAudio::getVolume() {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 133 return (mute) ? 0.0 : volume;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 134 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 135
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 136
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 137 bool USBAudio::EPISO_OUT_callback() {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 138 uint32_t size = 0;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 139 interruptOUT = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 140 if (buf_stream_in != NULL) {
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 141 readEP(EPISO_OUT, (uint8_t *)buf_stream_in, &size, PACKET_SIZE_ISO_IN);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 142 available = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 143 buf_stream_in = NULL;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 144 }
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 145 else {
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 146 if (rxDone)
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 147 rxDone.call();
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 148 }
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 149 readStart(EPISO_OUT, PACKET_SIZE_ISO_IN);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 150 return false;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 151 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 152
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 153
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 154 bool USBAudio::EPISO_IN_callback() {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 155 interruptIN = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 156 writeIN = true;
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 157 if (txDone)
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 158 txDone.call();
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 159 return true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 160 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 161
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 162
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 163
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 164 // Called in ISR context on each start of frame
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 165 void USBAudio::SOF(int frameNumber) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 166 uint32_t size = 0;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 167
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 168 if (!interruptOUT) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 169 // read the isochronous endpoint
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 170 if (buf_stream_in != NULL) {
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 171 if (USBDevice::readEP_NB(EPISO_OUT, (uint8_t *)buf_stream_in, &size, PACKET_SIZE_ISO_IN)) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 172 if (size) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 173 available = true;
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 174 readStart(EPISO_OUT, PACKET_SIZE_ISO_IN);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 175 buf_stream_in = NULL;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 176 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 177 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 178 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 179 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 180
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 181 if (!interruptIN) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 182 // write if needed
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 183 if (buf_stream_out != NULL) {
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 184 USBDevice::writeNB(EPISO_IN, (uint8_t *)buf_stream_out, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 185 buf_stream_out = NULL;
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 SOF_handler = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 190 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 191
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 192
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 193 // Called in ISR context
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 194 // Set configuration. Return false if the configuration is not supported.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 195 bool USBAudio::USBCallback_setConfiguration(uint8_t configuration) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 196 if (configuration != DEFAULT_CONFIGURATION) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 197 return false;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 198 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 199
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 200 // Configure isochronous endpoint
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 201 realiseEndpoint(EPISO_OUT, PACKET_SIZE_ISO_IN, ISOCHRONOUS);
frq08711@LMECWL0871.LME.ST.COM 4:50ec00aa4515 202 realiseEndpoint(EPISO_IN, PACKET_SIZE_ISO_OUT+this->channel_nb_out*2, ISOCHRONOUS);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 203
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 204 // activate readings on this endpoint
frq08711@LMECWL0871.LME.ST.COM 3:d9c7334e2183 205 readStart(EPISO_OUT, PACKET_SIZE_ISO_IN);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 206 return true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 207 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 208
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 209
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 210 // Called in ISR context
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 211 // Set alternate setting. Return false if the alternate setting is not supported
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 212 bool USBAudio::USBCallback_setInterface(uint16_t interface, uint8_t alternate) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 213 if (interface == 0 && alternate == 0) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 214 return true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 215 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 216 if (interface == 1 && (alternate == 0 || alternate == 1)) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 217 return true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 218 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 219 if (interface == 2 && (alternate == 0 || alternate == 1)) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 220 return true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 221 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 222 return false;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 223 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 224
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 225
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 226
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 227 // Called in ISR context
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 228 // Called by USBDevice on Endpoint0 request
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 229 // This is used to handle extensions to standard requests and class specific requests.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 230 // Return true if class handles this request
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 231 bool USBAudio::USBCallback_request() {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 232 bool success = false;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 233 CONTROL_TRANSFER * transfer = getTransferPtr();
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 234
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 235 // Process class-specific requests
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 236 if (transfer->setup.bmRequestType.Type == CLASS_TYPE) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 237
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 238 // Feature Unit: Interface = 0, ID = 2
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 239 if (transfer->setup.wIndex == 0x0200) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 240
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 241 // Master Channel
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 242 if ((transfer->setup.wValue & 0xff) == 0) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 243
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 244 switch (transfer->setup.wValue >> 8) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 245 case MUTE_CONTROL:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 246 switch (transfer->setup.bRequest) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 247 case REQUEST_GET_CUR:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 248 transfer->remaining = 1;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 249 transfer->ptr = &mute;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 250 transfer->direction = DEVICE_TO_HOST;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 251 success = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 252 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 253
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 254 case REQUEST_SET_CUR:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 255 transfer->remaining = 1;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 256 transfer->notify = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 257 transfer->direction = HOST_TO_DEVICE;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 258 success = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 259 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 260 default:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 261 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 262 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 263 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 264 case VOLUME_CONTROL:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 265 switch (transfer->setup.bRequest) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 266 case REQUEST_GET_CUR:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 267 transfer->remaining = 2;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 268 transfer->ptr = (uint8_t *)&volCur;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 269 transfer->direction = DEVICE_TO_HOST;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 270 success = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 271 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 272 case REQUEST_GET_MIN:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 273 transfer->remaining = 2;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 274 transfer->ptr = (uint8_t *)&volMin;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 275 transfer->direction = DEVICE_TO_HOST;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 276 success = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 277 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 278 case REQUEST_GET_MAX:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 279 transfer->remaining = 2;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 280 transfer->ptr = (uint8_t *)&volMax;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 281 transfer->direction = DEVICE_TO_HOST;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 282 success = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 283 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 284 case REQUEST_GET_RES:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 285 transfer->remaining = 2;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 286 transfer->ptr = (uint8_t *)&volRes;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 287 transfer->direction = DEVICE_TO_HOST;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 288 success = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 289 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 290
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 291 case REQUEST_SET_CUR:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 292 transfer->remaining = 2;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 293 transfer->notify = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 294 transfer->direction = HOST_TO_DEVICE;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 295 success = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 296 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 297 case REQUEST_SET_MIN:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 298 transfer->remaining = 2;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 299 transfer->notify = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 300 transfer->direction = HOST_TO_DEVICE;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 301 success = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 302 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 303 case REQUEST_SET_MAX:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 304 transfer->remaining = 2;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 305 transfer->notify = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 306 transfer->direction = HOST_TO_DEVICE;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 307 success = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 308 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 309 case REQUEST_SET_RES:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 310 transfer->remaining = 2;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 311 transfer->notify = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 312 transfer->direction = HOST_TO_DEVICE;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 313 success = true;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 314 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 315 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 316 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 317 default:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 318 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 319 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 320 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 321 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 322 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 323 return success;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 324 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 325
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 326
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 327 // Called in ISR context when a data OUT stage has been performed
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 328 void USBAudio::USBCallback_requestCompleted(uint8_t * buf, uint32_t length) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 329 if ((length == 1) || (length == 2)) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 330 uint16_t data = (length == 1) ? *buf : *((uint16_t *)buf);
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 331 CONTROL_TRANSFER * transfer = getTransferPtr();
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 332 switch (transfer->setup.wValue >> 8) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 333 case MUTE_CONTROL:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 334 switch (transfer->setup.bRequest) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 335 case REQUEST_SET_CUR:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 336 mute = data & 0xff;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 337 if (updateVol)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 338 updateVol.call();
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 339 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 340 default:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 341 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 342 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 343 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 344 case VOLUME_CONTROL:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 345 switch (transfer->setup.bRequest) {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 346 case REQUEST_SET_CUR:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 347 volCur = data;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 348 volume = (float)volCur/(float)volMax;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 349 if (updateVol)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 350 updateVol.call();
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 351 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 352 default:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 353 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 354 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 355 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 356 default:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 357 break;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 358 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 359 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 360 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 361
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 362
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 363
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 364 #define TOTAL_DESCRIPTOR_LENGTH ((1 * CONFIGURATION_DESCRIPTOR_LENGTH) \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 365 + (5 * INTERFACE_DESCRIPTOR_LENGTH) \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 366 + (1 * CONTROL_INTERFACE_DESCRIPTOR_LENGTH + 1) \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 367 + (2 * INPUT_TERMINAL_DESCRIPTOR_LENGTH) \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 368 + (1 * FEATURE_UNIT_DESCRIPTOR_LENGTH) \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 369 + (2 * OUTPUT_TERMINAL_DESCRIPTOR_LENGTH) \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 370 + (2 * STREAMING_INTERFACE_DESCRIPTOR_LENGTH) \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 371 + (2 * FORMAT_TYPE_I_DESCRIPTOR_LENGTH) \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 372 + (2 * (ENDPOINT_DESCRIPTOR_LENGTH + 2)) \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 373 + (2 * STREAMING_ENDPOINT_DESCRIPTOR_LENGTH) )
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 374
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 375 #define TOTAL_CONTROL_INTF_LENGTH (CONTROL_INTERFACE_DESCRIPTOR_LENGTH + 1 + \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 376 2*INPUT_TERMINAL_DESCRIPTOR_LENGTH + \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 377 FEATURE_UNIT_DESCRIPTOR_LENGTH + \
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 378 2*OUTPUT_TERMINAL_DESCRIPTOR_LENGTH)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 379
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 380 uint8_t * USBAudio::configurationDesc() {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 381 static uint8_t configDescriptor[] = {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 382 // Configuration 1
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 383 CONFIGURATION_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 384 CONFIGURATION_DESCRIPTOR, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 385 LSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (LSB)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 386 MSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (MSB)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 387 0x03, // bNumInterfaces
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 388 DEFAULT_CONFIGURATION, // bConfigurationValue
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 389 0x00, // iConfiguration
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 390 0x80, // bmAttributes
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 391 50, // bMaxPower
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 392
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 393 // Interface 0, Alternate Setting 0, Audio Control
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 394 INTERFACE_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 395 INTERFACE_DESCRIPTOR, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 396 0x00, // bInterfaceNumber
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 397 0x00, // bAlternateSetting
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 398 0x00, // bNumEndpoints
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 399 AUDIO_CLASS, // bInterfaceClass
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 400 SUBCLASS_AUDIOCONTROL, // bInterfaceSubClass
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 401 0x00, // bInterfaceProtocol
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 402 0x00, // iInterface
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 403
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 404
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 405 // Audio Control Interface
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 406 CONTROL_INTERFACE_DESCRIPTOR_LENGTH + 1,// bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 407 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 408 CONTROL_HEADER, // bDescriptorSubtype
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 409 LSB(0x0100), // bcdADC (LSB)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 410 MSB(0x0100), // bcdADC (MSB)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 411 LSB(TOTAL_CONTROL_INTF_LENGTH), // wTotalLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 412 MSB(TOTAL_CONTROL_INTF_LENGTH), // wTotalLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 413 0x02, // bInCollection
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 414 0x01, // baInterfaceNr
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 415 0x02, // baInterfaceNr
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 416
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 417 // Audio Input Terminal (Speaker)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 418 INPUT_TERMINAL_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 419 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 420 CONTROL_INPUT_TERMINAL, // bDescriptorSubtype
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 421 0x01, // bTerminalID
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 422 LSB(TERMINAL_USB_STREAMING), // wTerminalType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 423 MSB(TERMINAL_USB_STREAMING), // wTerminalType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 424 0x00, // bAssocTerminal
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 425 channel_nb_in, // bNrChannels
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 426 (uint8_t)(LSB(channel_config_in)), // wChannelConfig
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 427 (uint8_t)(MSB(channel_config_in)), // wChannelConfig
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 428 0x00, // iChannelNames
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 429 0x00, // iTerminal
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 430
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 431 // Audio Feature Unit (Speaker)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 432 FEATURE_UNIT_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 433 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 434 CONTROL_FEATURE_UNIT, // bDescriptorSubtype
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 435 0x02, // bUnitID
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 436 0x01, // bSourceID
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 437 0x01, // bControlSize
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 438 CONTROL_MUTE |
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 439 CONTROL_VOLUME, // bmaControls(0)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 440 0x00, // bmaControls(1)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 441 0x00, // iTerminal
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 442
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 443 // Audio Output Terminal (Speaker)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 444 OUTPUT_TERMINAL_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 445 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 446 CONTROL_OUTPUT_TERMINAL, // bDescriptorSubtype
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 447 0x03, // bTerminalID
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 448 LSB(TERMINAL_SPEAKER), // wTerminalType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 449 MSB(TERMINAL_SPEAKER), // wTerminalType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 450 0x00, // bAssocTerminal
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 451 0x02, // bSourceID
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 452 0x00, // iTerminal
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 453
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 454
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 455 // Audio Input Terminal (Microphone)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 456 INPUT_TERMINAL_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 457 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 458 CONTROL_INPUT_TERMINAL, // bDescriptorSubtype
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 459 0x04, // bTerminalID
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 460 LSB(TERMINAL_MICROPHONE), // wTerminalType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 461 MSB(TERMINAL_MICROPHONE), // wTerminalType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 462 0x00, // bAssocTerminal
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 463 channel_nb_out, // bNrChannels
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 464 (uint8_t)(LSB(channel_config_out)), // wChannelConfig
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 465 (uint8_t)(MSB(channel_config_out)), // wChannelConfig
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 466 0x00, // iChannelNames
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 467 0x00, // iTerminal
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 468
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 469 // Audio Output Terminal (Microphone)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 470 OUTPUT_TERMINAL_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 471 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 472 CONTROL_OUTPUT_TERMINAL, // bDescriptorSubtype
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 473 0x05, // bTerminalID
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 474 LSB(TERMINAL_USB_STREAMING), // wTerminalType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 475 MSB(TERMINAL_USB_STREAMING), // wTerminalType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 476 0x00, // bAssocTerminal
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 477 0x04, // bSourceID
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 478 0x00, // iTerminal
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 479
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 480
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 481
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 482
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 483
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 484
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 485 // Interface 1, Alternate Setting 0, Audio Streaming - Zero Bandwith
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 486 INTERFACE_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 487 INTERFACE_DESCRIPTOR, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 488 0x01, // bInterfaceNumber
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 489 0x00, // bAlternateSetting
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 490 0x00, // bNumEndpoints
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 491 AUDIO_CLASS, // bInterfaceClass
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 492 SUBCLASS_AUDIOSTREAMING, // bInterfaceSubClass
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 493 0x00, // bInterfaceProtocol
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 494 0x00, // iInterface
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 495
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 496 // Interface 1, Alternate Setting 1, Audio Streaming - Operational
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 497 INTERFACE_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 498 INTERFACE_DESCRIPTOR, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 499 0x01, // bInterfaceNumber
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 500 0x01, // bAlternateSetting
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 501 0x01, // bNumEndpoints
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 502 AUDIO_CLASS, // bInterfaceClass
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 503 SUBCLASS_AUDIOSTREAMING, // bInterfaceSubClass
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 504 0x00, // bInterfaceProtocol
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 505 0x00, // iInterface
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 506
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 507 // Audio Streaming Interface
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 508 STREAMING_INTERFACE_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 509 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 510 STREAMING_GENERAL, // bDescriptorSubtype
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 511 0x01, // bTerminalLink
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 512 0x00, // bDelay
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 513 LSB(FORMAT_PCM), // wFormatTag
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 514 MSB(FORMAT_PCM), // wFormatTag
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 515
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 516 // Audio Type I Format
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 517 FORMAT_TYPE_I_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 518 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 519 STREAMING_FORMAT_TYPE, // bDescriptorSubtype
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 520 FORMAT_TYPE_I, // bFormatType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 521 channel_nb_in, // bNrChannels
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 522 0x02, // bSubFrameSize
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 523 16, // bBitResolution
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 524 0x01, // bSamFreqType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 525 (uint8_t)(LSB(FREQ_IN)), // tSamFreq
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 526 (uint8_t)((FREQ_IN >> 8) & 0xff), // tSamFreq
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 527 (uint8_t)((FREQ_IN >> 16) & 0xff), // tSamFreq
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 528
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 529 // Endpoint - Standard Descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 530 ENDPOINT_DESCRIPTOR_LENGTH + 2, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 531 ENDPOINT_DESCRIPTOR, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 532 PHY_TO_DESC(EPISO_OUT), // bEndpointAddress
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 533 E_ISOCHRONOUS, // bmAttributes
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 534 (uint8_t)(LSB(PACKET_SIZE_ISO_IN)), // wMaxPacketSize
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 535 (uint8_t)(MSB(PACKET_SIZE_ISO_IN)), // wMaxPacketSize
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 536 0x01, // bInterval
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 537 0x00, // bRefresh
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 538 0x00, // bSynchAddress
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 539
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 540 // Endpoint - Audio Streaming
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 541 STREAMING_ENDPOINT_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 542 ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 543 ENDPOINT_GENERAL, // bDescriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 544 0x00, // bmAttributes
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 545 0x00, // bLockDelayUnits
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 546 LSB(0x0000), // wLockDelay
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 547 MSB(0x0000), // wLockDelay
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 548
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 549
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 550
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 551
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 552
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 553
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 554
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 555 // Interface 1, Alternate Setting 0, Audio Streaming - Zero Bandwith
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 556 INTERFACE_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 557 INTERFACE_DESCRIPTOR, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 558 0x02, // bInterfaceNumber
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 559 0x00, // bAlternateSetting
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 560 0x00, // bNumEndpoints
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 561 AUDIO_CLASS, // bInterfaceClass
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 562 SUBCLASS_AUDIOSTREAMING, // bInterfaceSubClass
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 563 0x00, // bInterfaceProtocol
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 564 0x00, // iInterface
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 565
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 566 // Interface 1, Alternate Setting 1, Audio Streaming - Operational
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 567 INTERFACE_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 568 INTERFACE_DESCRIPTOR, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 569 0x02, // bInterfaceNumber
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 570 0x01, // bAlternateSetting
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 571 0x01, // bNumEndpoints
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 572 AUDIO_CLASS, // bInterfaceClass
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 573 SUBCLASS_AUDIOSTREAMING, // bInterfaceSubClass
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 574 0x00, // bInterfaceProtocol
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 575 0x00, // iInterface
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 576
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 577 // Audio Streaming Interface
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 578 STREAMING_INTERFACE_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 579 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 580 SUBCLASS_AUDIOCONTROL, // bDescriptorSubtype
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 581 0x05, // bTerminalLink (output terminal microphone)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 582 0x01, // bDelay
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 583 0x01, // wFormatTag
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 584 0x00, // wFormatTag
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 585
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 586 // Audio Type I Format
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 587 FORMAT_TYPE_I_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 588 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 589 SUBCLASS_AUDIOSTREAMING, // bDescriptorSubtype
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 590 FORMAT_TYPE_I, // bFormatType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 591 channel_nb_out, // bNrChannels
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 592 0x02, // bSubFrameSize
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 593 0x10, // bBitResolution
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 594 0x01, // bSamFreqType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 595 (uint8_t)(LSB(FREQ_OUT)), // tSamFreq
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 596 (uint8_t)((FREQ_OUT >> 8) & 0xff), // tSamFreq
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 597 (uint8_t)((FREQ_OUT >> 16) & 0xff), // tSamFreq
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 598
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 599 // Endpoint - Standard Descriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 600 ENDPOINT_DESCRIPTOR_LENGTH + 2, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 601 ENDPOINT_DESCRIPTOR, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 602 PHY_TO_DESC(EPISO_IN), // bEndpointAddress
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 603 E_ISOCHRONOUS, // bmAttributes
frq08711@LMECWL0871.LME.ST.COM 4:50ec00aa4515 604 (uint8_t)(LSB(PACKET_SIZE_ISO_OUT+channel_nb_out*2)), // wMaxPacketSize
frq08711@LMECWL0871.LME.ST.COM 4:50ec00aa4515 605 (uint8_t)(MSB(PACKET_SIZE_ISO_OUT+channel_nb_out*2)), // wMaxPacketSize
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 606 0x01, // bInterval
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 607 0x00, // bRefresh
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 608 0x00, // bSynchAddress
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 609
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 610 // Endpoint - Audio Streaming
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 611 STREAMING_ENDPOINT_DESCRIPTOR_LENGTH, // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 612 ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 613 ENDPOINT_GENERAL, // bDescriptor
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 614 0x00, // bmAttributes
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 615 0x00, // bLockDelayUnits
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 616 LSB(0x0000), // wLockDelay
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 617 MSB(0x0000), // wLockDelay
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 618
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 619 // Terminator
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 620 0 // bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 621 };
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 622 return configDescriptor;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 623 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 624
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 625 uint8_t * USBAudio::stringIinterfaceDesc() {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 626 static uint8_t stringIinterfaceDescriptor[] = {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 627 0x0c, //bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 628 STRING_DESCRIPTOR, //bDescriptorType 0x03
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 629 'A',0,'u',0,'d',0,'i',0,'o',0 //bString iInterface - Audio
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 630 };
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 631 return stringIinterfaceDescriptor;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 632 }
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 633
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 634 uint8_t * USBAudio::stringIproductDesc() {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 635 static uint8_t stringIproductDescriptor[] = {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 636 0x16, //bLength
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 637 STRING_DESCRIPTOR, //bDescriptorType 0x03
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 638 '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 639 };
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 640 return stringIproductDescriptor;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 641 }