mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 18:53:29 +00:00
raise timeouts on USB on atsamd and fix slice sizing
This commit is contained in:
@@ -1747,7 +1747,7 @@ func handleStandardSetup(setup usbSetup) bool {
|
|||||||
func cdcSetup(setup usbSetup) bool {
|
func cdcSetup(setup usbSetup) bool {
|
||||||
if setup.bmRequestType == usb_REQUEST_DEVICETOHOST_CLASS_INTERFACE {
|
if setup.bmRequestType == usb_REQUEST_DEVICETOHOST_CLASS_INTERFACE {
|
||||||
if setup.bRequest == usb_CDC_GET_LINE_CODING {
|
if setup.bRequest == usb_CDC_GET_LINE_CODING {
|
||||||
b := make([]byte, 0, 7)
|
b := make([]byte, 7)
|
||||||
b[0] = byte(usbLineInfo.dwDTERate)
|
b[0] = byte(usbLineInfo.dwDTERate)
|
||||||
b[1] = byte(usbLineInfo.dwDTERate >> 8)
|
b[1] = byte(usbLineInfo.dwDTERate >> 8)
|
||||||
b[2] = byte(usbLineInfo.dwDTERate >> 16)
|
b[2] = byte(usbLineInfo.dwDTERate >> 16)
|
||||||
@@ -1819,7 +1819,7 @@ func receiveUSBControlPacket() []byte {
|
|||||||
setEPSTATUSCLR(0, sam.USB_DEVICE_EPSTATUSCLR_BK0RDY)
|
setEPSTATUSCLR(0, sam.USB_DEVICE_EPSTATUSCLR_BK0RDY)
|
||||||
|
|
||||||
// Wait until OUT transfer is ready.
|
// Wait until OUT transfer is ready.
|
||||||
timeout := 3000
|
timeout := 300000
|
||||||
for (getEPSTATUS(0) & sam.USB_DEVICE_EPSTATUS_BK0RDY) == 0 {
|
for (getEPSTATUS(0) & sam.USB_DEVICE_EPSTATUS_BK0RDY) == 0 {
|
||||||
timeout--
|
timeout--
|
||||||
if timeout == 0 {
|
if timeout == 0 {
|
||||||
@@ -1957,7 +1957,7 @@ func sendConfiguration(setup usbSetup) {
|
|||||||
sz := uint16(configDescriptorSize + cdcSize)
|
sz := uint16(configDescriptorSize + cdcSize)
|
||||||
config := NewConfigDescriptor(sz, 2)
|
config := NewConfigDescriptor(sz, 2)
|
||||||
|
|
||||||
buf := make([]byte, 0)
|
buf := make([]byte, 0, sz)
|
||||||
buf = append(buf, config.Bytes()...)
|
buf = append(buf, config.Bytes()...)
|
||||||
buf = append(buf, cdc.Bytes()...)
|
buf = append(buf, cdc.Bytes()...)
|
||||||
|
|
||||||
|
|||||||
@@ -1614,7 +1614,7 @@ func receiveUSBControlPacket() []byte {
|
|||||||
setEPSTATUSCLR(0, sam.USB_DEVICE_EPSTATUSCLR_BK0RDY)
|
setEPSTATUSCLR(0, sam.USB_DEVICE_EPSTATUSCLR_BK0RDY)
|
||||||
|
|
||||||
// Wait until OUT transfer is ready.
|
// Wait until OUT transfer is ready.
|
||||||
timeout := 3000
|
timeout := 300000
|
||||||
for (getEPSTATUS(0) & sam.USB_DEVICE_EPSTATUS_BK0RDY) == 0 {
|
for (getEPSTATUS(0) & sam.USB_DEVICE_EPSTATUS_BK0RDY) == 0 {
|
||||||
timeout--
|
timeout--
|
||||||
if timeout == 0 {
|
if timeout == 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user