machine/atsamd21,atsamd51: clear the USB packet size before setting it again when sending

Signed-off-by: Ron Evans <ron@hybridgroup.com>
Этот коммит содержится в:
Ron Evans 2020-03-31 20:23:55 +02:00 коммит произвёл Jaden Weiss
родитель ccf8b378b3
коммит 5d539df216
2 изменённых файлов: 2 добавлений и 4 удалений

Просмотреть файл

@ -1477,8 +1477,6 @@ func handleUSB(intr interrupt.Interrupt) {
// clear stall request
setEPINTENCLR(0, sam.USB_DEVICE_EPINTENCLR_STALL1)
}
} else {
sendZlp()
}
// Now the actual transfer handlers, ignore endpoint number 0 (setup)
@ -1749,6 +1747,7 @@ func sendUSBPacket(ep uint32, data []byte) {
usbEndpointDescriptors[ep].DeviceDescBank[1].PCKSIZE.ClearBits(usb_DEVICE_PCKSIZE_MULTI_PACKET_SIZE_Mask << usb_DEVICE_PCKSIZE_MULTI_PACKET_SIZE_Pos)
// set byte count, which is total number of bytes to be sent
usbEndpointDescriptors[ep].DeviceDescBank[1].PCKSIZE.ClearBits(usb_DEVICE_PCKSIZE_BYTE_COUNT_Mask << usb_DEVICE_PCKSIZE_BYTE_COUNT_Pos)
usbEndpointDescriptors[ep].DeviceDescBank[1].PCKSIZE.SetBits(uint32((len(data) & usb_DEVICE_PCKSIZE_BYTE_COUNT_Mask) << usb_DEVICE_PCKSIZE_BYTE_COUNT_Pos))
}

Просмотреть файл

@ -1648,8 +1648,6 @@ func handleUSBIRQ(interrupt.Interrupt) {
// clear stall request
setEPINTENCLR(0, sam.USB_DEVICE_ENDPOINT_EPINTENCLR_STALL1)
}
} else {
sendZlp()
}
// Now the actual transfer handlers, ignore endpoint number 0 (setup)
@ -1920,6 +1918,7 @@ func sendUSBPacket(ep uint32, data []byte) {
usbEndpointDescriptors[ep].DeviceDescBank[1].PCKSIZE.ClearBits(usb_DEVICE_PCKSIZE_MULTI_PACKET_SIZE_Mask << usb_DEVICE_PCKSIZE_MULTI_PACKET_SIZE_Pos)
// set byte count, which is total number of bytes to be sent
usbEndpointDescriptors[ep].DeviceDescBank[1].PCKSIZE.ClearBits(usb_DEVICE_PCKSIZE_BYTE_COUNT_Mask << usb_DEVICE_PCKSIZE_BYTE_COUNT_Pos)
usbEndpointDescriptors[ep].DeviceDescBank[1].PCKSIZE.SetBits(uint32((len(data) & usb_DEVICE_PCKSIZE_BYTE_COUNT_Mask) << usb_DEVICE_PCKSIZE_BYTE_COUNT_Pos))
}