121 #ifdef DEBUG_USB_HOST 152 goto FailGetDevDescr;
172 #ifdef DEBUG_USB_HOST 189 #ifdef DEBUG_USB_HOST 192 goto FailSetDevTblEntry;
194 #ifdef DEBUG_USB_HOST 197 for (uint8_t i=0; i<num_of_conf; i++) {
202 #ifdef DEBUG_USB_HOST 206 goto FailGetConfDescr;
218 #ifdef DEBUG_USB_HOST 224 goto FailSetConfDescr;
226 #ifdef DEBUG_USB_HOST 243 uint8_t* buf_ptr = buf;
247 unsigned int total_length;
249 boolean isMidi =
false;
256 total_length = buf[2] | ((int)buf[3] << 8);
268 while( buf_ptr < buf + total_length ) {
269 descr_length = *( buf_ptr );
270 descr_type = *( buf_ptr + 1 );
271 switch( descr_type ) {
280 #ifdef DEBUG_USB_HOST 297 #ifdef DEBUG_USB_HOST
298 PrintEndpointDescriptor(epDesc);
305 buf_ptr += descr_length;
327 dataptr[*bytes_rcvd] =
'\0';
328 dataptr[(*bytes_rcvd)+1] =
'\0';
346 goto RecvData_return_from_buffer;
361 RecvData_return_from_buffer:
369 return lookupMsgSize(outBuf[0]);
385 buf[0] = (nCable << 4) | (msg >> 4);
386 if( msg < 0xf0 ) msg = msg & 0xf0;
394 switch(lookupMsgSize(msg)) {
398 buf[0] = (nCable << 4) | 3;
404 if(msg == 0xf1 || msg == 0xf3) {
405 buf[0] = (nCable << 4) | 2;
420 #ifdef DEBUG_USB_HOST 425 PrintHex<uint8_t>(ep_ptr->
bLength, 0x80);
435 PrintHex<uint8_t>(ep_ptr->
bInterval, 0x80);
444 uint8_t USBH_MIDI::lookupMsgSize(uint8_t midiMsg)
448 if( midiMsg < 0xf0 ) midiMsg &= 0xf0;
491 if( *dataptr != 0xf0 ){
496 while(*dataptr != 0xf7)
515 unsigned int n = datasize;
519 buf[0] = (nCable << 4) | 0x4;
523 buf[0] = (nCable << 4) | 0x5;
524 buf[1] = *(dataptr++);
530 buf[0] = (nCable << 4) | 0x6;
531 buf[1] = *(dataptr++);
532 buf[2] = *(dataptr++);
537 buf[0] = (nCable << 4) | 0x7;
539 buf[1] = *(dataptr++);
540 buf[2] = *(dataptr++);
541 buf[3] = *(dataptr++);
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
static const uint8_t epDataInIndexVSP
#define USB_ERROR_EPINFO_IS_NULL
uint8_t RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr)
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
#define USB_DESCRIPTOR_ENDPOINT
#define USB_SUBCLASS_MIDISTREAMING
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
void parseConfigDescr(byte addr, byte conf)
virtual void FreeAddress(uint8_t addr)=0
static const uint8_t epDataOutIndexVSP
#define USB_DESCRIPTOR_CONFIGURATION
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
virtual uint8_t Release()
unsigned int countSysExDataSize(uint8_t *dataptr)
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
static const uint8_t epDataInIndex
#define MIDI_EVENT_PACKET_SIZE
uint8_t SendData(uint8_t *dataptr, byte nCable=0)
uint8_t recvBuf[MIDI_EVENT_PACKET_SIZE]
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
EpInfo epInfo[MIDI_MAX_ENDPOINTS]
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
uint8_t bNumConfigurations
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
static const uint8_t epDataOutIndex
#define MIDI_MAX_ENDPOINTS
AddressPool & GetAddressPool()
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
uint8_t SendSysEx(uint8_t *dataptr, unsigned int datasize, byte nCable=0)
#define USB_DESCRIPTOR_INTERFACE