usb: remove allocs in ISR

This commit is contained in:
Kenneth Bell
2022-10-05 16:18:56 +01:00
committed by Ron Evans
parent 7e9d84777e
commit 8f33721b88
3 changed files with 47 additions and 32 deletions
+15 -12
View File
@@ -305,23 +305,26 @@ type USBBuffer struct {
}
var (
usbDPSRAM = (*USBDPSRAM)(unsafe.Pointer(uintptr(0x50100000)))
epXdata0 [16]bool
usbDPSRAM = (*USBDPSRAM)(unsafe.Pointer(uintptr(0x50100000)))
epXdata0 [16]bool
setupBytes [8]byte
)
func (d *USBDPSRAM) setupBytes() []byte {
var buf [8]byte
buf[0] = byte(d.EPxControl[usb.CONTROL_ENDPOINT].In.Get())
buf[1] = byte(d.EPxControl[usb.CONTROL_ENDPOINT].In.Get() >> 8)
buf[2] = byte(d.EPxControl[usb.CONTROL_ENDPOINT].In.Get() >> 16)
buf[3] = byte(d.EPxControl[usb.CONTROL_ENDPOINT].In.Get() >> 24)
buf[4] = byte(d.EPxControl[usb.CONTROL_ENDPOINT].Out.Get())
buf[5] = byte(d.EPxControl[usb.CONTROL_ENDPOINT].Out.Get() >> 8)
buf[6] = byte(d.EPxControl[usb.CONTROL_ENDPOINT].Out.Get() >> 16)
buf[7] = byte(d.EPxControl[usb.CONTROL_ENDPOINT].Out.Get() >> 24)
data := d.EPxControl[usb.CONTROL_ENDPOINT].In.Get()
setupBytes[0] = byte(data)
setupBytes[1] = byte(data >> 8)
setupBytes[2] = byte(data >> 16)
setupBytes[3] = byte(data >> 24)
return buf[:]
data = d.EPxControl[usb.CONTROL_ENDPOINT].Out.Get()
setupBytes[4] = byte(data)
setupBytes[5] = byte(data >> 8)
setupBytes[6] = byte(data >> 16)
setupBytes[7] = byte(data >> 24)
return setupBytes[:]
}
func (d *USBDPSRAM) clear() {