Go to the documentation of this file.
158 goto FailGetDevDescr;
192 goto FailGetDevDescr;
195 pid = udd->idProduct;
196 num_of_conf = udd->bNumConfigurations;
202 goto FailSetDevTblEntry;
214 for (uint8_t i=0; i<num_of_conf; i++) {
217 goto FailGetConfDescr;
226 goto FailGetConfDescr;
230 USBTRACE(
"MIDI not found. Attempts bulk device\r\n");
246 goto FailSetConfDescr;
263 uint8_t* buf_ptr = buf;
265 uint8_t descr_length;
267 uint16_t total_length;
276 total_length = buf[2] | ((int)buf[3] << 8);
288 while( buf_ptr < buf + total_length ) {
289 descr_length = *( buf_ptr );
290 descr_type = *( buf_ptr + 1 );
291 switch( descr_type ) {
327 #ifdef DEBUG_USB_HOST
328 PrintEndpointDescriptor(epDesc);
335 buf_ptr += descr_length;
355 if(
vid == 0x1235 ) {
360 if(
pid == 0x20 ||
pid == 0x36 ||
pid == 0x51 ||
pid == 0x69 ) {
366 if( ( 0x30 <=
pid &&
pid <= 0x32) ||
pid == 0x35 || ( 0x7B <=
pid &&
pid <= 0x7D) ) {
380 dataptr[*bytes_rcvd] =
'\0';
381 dataptr[(*bytes_rcvd)+1] =
'\0';
399 goto RecvData_return_from_buffer;
414 RecvData_return_from_buffer:
417 if( isRaw ==
true ) {
446 buf[0] = (nCable << 4) | (msg >> 4);
447 if( msg < 0xf0 ) msg = msg & 0xf0;
459 buf[0] = (nCable << 4) | 3;
465 if(msg == 0xf1 || msg == 0xf3) {
466 buf[0] = (nCable << 4) | 2;
481 #ifdef DEBUG_USB_HOST
484 USBTRACE(
"Endpoint descriptor:\r\n");
504 if( (cin & 0xc) == 4 ) {
505 if( cin == 4 || cin == 7 )
return 3;
506 if( cin == 6 )
return 2;
507 if( cin == 5 )
return 1;
510 if( midiMsg < 0xf0 ) midiMsg &= 0xf0;
553 if( *dataptr != 0xf0 ){
558 while(*dataptr != 0xf7)
577 uint16_t n = datasize;
578 uint16_t pktSize = (n*10/3+7)/10*4;
590 buf[wptr] = (nCable << 4) | 0x4;
594 buf[wptr++] = (nCable << 4) | 0x5;
595 buf[wptr++] = *(dataptr++);
601 buf[wptr++] = (nCable << 4) | 0x6;
602 buf[wptr++] = *(dataptr++);
603 buf[wptr++] = *(dataptr++);
608 buf[wptr] = (nCable << 4) | 0x7;
612 buf[wptr++] = *(dataptr++);
613 buf[wptr++] = *(dataptr++);
614 buf[wptr++] = *(dataptr++);
619 if( wptr >= maxpkt || n == 0 ){
640 uint8_t cin = *(p) & 0x0f;
643 if( (cin & 0xc) != 4 )
return rc;
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
uint8_t parseConfigDescr(uint8_t addr, uint8_t conf)
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
uint16_t countSysExDataSize(uint8_t *dataptr)
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
static const uint8_t epDataInIndexVSP
static const uint8_t epDataOutIndexVSP
#define MIDI_MAX_SYSEX_SIZE
#define USB_DESCRIPTOR_ENDPOINT
#define USB_DESCRIPTOR_CONFIGURATION
void D_PrintHex(T val, int lvl)
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
static const uint8_t epDataInIndex
#define USB_SUBCLASS_MIDISTREAMING
#define USB_NAK_MAX_POWER
uint8_t recvBuf[MIDI_EVENT_PACKET_SIZE]
#define USB_DESCRIPTOR_INTERFACE
#define bmUSB_TRANSFER_TYPE
void setupDeviceSpecific()
uint8_t lookupMsgSize(uint8_t midiMsg, uint8_t cin=0)
uint8_t SendRawData(uint16_t bytes_send, uint8_t *dataptr)
#define MIDI_MAX_ENDPOINTS
uint8_t extractSysExData(uint8_t *p, uint8_t *buf)
uint8_t SendData(uint8_t *dataptr, uint8_t nCable=0)
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
#define USB_ERROR_EPINFO_IS_NULL
virtual uint8_t Release()
uint8_t RecvRawData(uint8_t *outBuf)
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
uint8_t bTransferTypeMask
virtual void FreeAddress(uint8_t addr)=0
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
uint8_t SendSysEx(uint8_t *dataptr, uint16_t datasize, uint8_t nCable=0)
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
#define MIDI_EVENT_PACKET_SIZE
EpInfo epInfo[MIDI_MAX_ENDPOINTS]
static const uint8_t epDataOutIndex
#define USB_TRANSFER_TYPE_BULK
uint8_t RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr)
AddressPool & GetAddressPool()