@@ -362,6 +362,7 @@ int musb_bulk_urb_init(struct usbh_bus *bus, uint8_t chidx, struct usbh_urb *urb
362362
363363 HWREGB (USB_RXADDR_BASE (chidx )) = urb -> hport -> dev_addr ;
364364 HWREGB (USB_RXTYPE_BASE (chidx )) = (urb -> ep -> bEndpointAddress & 0x0f ) | speed | USB_TXTYPE1_PROTO_BULK ;
365+ HWREGH (USB_RXMAP_BASE (chidx )) = USB_GET_MAXPACKETSIZE (urb -> ep -> wMaxPacketSize );
365366 HWREGB (USB_RXINTERVAL_BASE (chidx )) = 0 ;
366367 HWREGB (USB_RXHUBADDR_BASE (chidx )) = 0 ;
367368 HWREGB (USB_RXHUBPORT_BASE (chidx )) = 0 ;
@@ -377,6 +378,7 @@ int musb_bulk_urb_init(struct usbh_bus *bus, uint8_t chidx, struct usbh_urb *urb
377378
378379 HWREGB (USB_TXADDR_BASE (chidx )) = urb -> hport -> dev_addr ;
379380 HWREGB (USB_TXTYPE_BASE (chidx )) = (urb -> ep -> bEndpointAddress & 0x0f ) | speed | USB_TXTYPE1_PROTO_BULK ;
381+ HWREGH (USB_TXMAP_BASE (chidx )) = USB_GET_MAXPACKETSIZE (urb -> ep -> wMaxPacketSize );
380382 HWREGB (USB_TXINTERVAL_BASE (chidx )) = 0 ;
381383 HWREGB (USB_TXHUBADDR_BASE (chidx )) = 0 ;
382384 HWREGB (USB_TXHUBPORT_BASE (chidx )) = 0 ;
@@ -419,6 +421,7 @@ int musb_intr_urb_init(struct usbh_bus *bus, uint8_t chidx, struct usbh_urb *urb
419421
420422 HWREGB (USB_RXADDR_BASE (chidx )) = urb -> hport -> dev_addr ;
421423 HWREGB (USB_RXTYPE_BASE (chidx )) = (urb -> ep -> bEndpointAddress & 0x0f ) | speed | USB_TXTYPE1_PROTO_INT ;
424+ HWREGH (USB_RXMAP_BASE (chidx )) = USB_GET_MAXPACKETSIZE (urb -> ep -> wMaxPacketSize );
422425 HWREGB (USB_RXINTERVAL_BASE (chidx )) = urb -> ep -> bInterval ;
423426 HWREGB (USB_RXHUBADDR_BASE (chidx )) = 0 ;
424427 HWREGB (USB_RXHUBPORT_BASE (chidx )) = 0 ;
@@ -434,6 +437,7 @@ int musb_intr_urb_init(struct usbh_bus *bus, uint8_t chidx, struct usbh_urb *urb
434437
435438 HWREGB (USB_TXADDR_BASE (chidx )) = urb -> hport -> dev_addr ;
436439 HWREGB (USB_TXTYPE_BASE (chidx )) = (urb -> ep -> bEndpointAddress & 0x0f ) | speed | USB_TXTYPE1_PROTO_INT ;
440+ HWREGH (USB_TXMAP_BASE (chidx )) = USB_GET_MAXPACKETSIZE (urb -> ep -> wMaxPacketSize );
437441 HWREGB (USB_TXINTERVAL_BASE (chidx )) = urb -> ep -> bInterval ;
438442 HWREGB (USB_TXHUBADDR_BASE (chidx )) = 0 ;
439443 HWREGB (USB_TXHUBPORT_BASE (chidx )) = 0 ;
@@ -751,12 +755,14 @@ int usbh_submit_urb(struct usbh_urb *urb)
751755 case USB_ENDPOINT_TYPE_BULK :
752756 ret = musb_bulk_urb_init (bus , chidx , urb , urb -> transfer_buffer , urb -> transfer_buffer_length );
753757 if (ret < 0 ) {
758+ usb_osal_leave_critical_section (flags );
754759 return ret ;
755760 }
756761 break ;
757762 case USB_ENDPOINT_TYPE_INTERRUPT :
758763 ret = musb_intr_urb_init (bus , chidx , urb , urb -> transfer_buffer , urb -> transfer_buffer_length );
759764 if (ret < 0 ) {
765+ usb_osal_leave_critical_section (flags );
760766 return ret ;
761767 }
762768 break ;
0 commit comments