Skip to content

Commit 02657fb

Browse files
cmagliefacchinm
authored andcommitted
USBDevice: added missing ep interrupts in USBDevice_SAMD21G18x
1 parent f051e74 commit 02657fb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cores/arduino/USB/SAMD21_USBDevice.h

+10
Original file line numberDiff line numberDiff line change
@@ -91,27 +91,37 @@ class USBDevice_SAMD21G18x {
9191
// Interrupts
9292
inline uint16_t epInterruptSummary() { return usb.EPINTSMRY.reg; }
9393

94+
inline bool epHasPendingInterrupts(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.reg != 0; }
9495
inline bool epBank0IsSetupReceived(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.RXSTP; }
9596
inline bool epBank0IsStalled(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.STALL0; }
9697
inline bool epBank1IsStalled(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.STALL1; }
98+
inline bool epBank0IsTransferFailed(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.TRFAIL0; }
99+
inline bool epBank1IsTransferFailed(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.TRFAIL1; }
97100
inline bool epBank0IsTransferComplete(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.TRCPT0; }
98101
inline bool epBank1IsTransferComplete(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.TRCPT1; }
99102

103+
inline void epAckPendingInterrupts(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = 0x7F; }
100104
inline void epBank0AckSetupReceived(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_RXSTP; }
101105
inline void epBank0AckStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_STALL(1); }
102106
inline void epBank1AckStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_STALL(2); }
107+
inline void epBank0AckTransferFailed(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRFAIL(1); }
108+
inline void epBank1AckTransferFailed(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRFAIL(2); }
103109
inline void epBank0AckTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRCPT(1); }
104110
inline void epBank1AckTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRCPT(2); }
105111

106112
inline void epBank0EnableSetupReceived(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.RXSTP = 1; }
107113
inline void epBank0EnableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.STALL0 = 1; }
108114
inline void epBank1EnableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.STALL1 = 1; }
115+
inline void epBank0EnableTransferFailed(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.TRFAIL0 = 1; }
116+
inline void epBank1EnableTransferFailed(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.TRFAIL1 = 1; }
109117
inline void epBank0EnableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.TRCPT0 = 1; }
110118
inline void epBank1EnableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.TRCPT1 = 1; }
111119

112120
inline void epBank0DisableSetupReceived(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.RXSTP = 1; }
113121
inline void epBank0DisableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.STALL0 = 1; }
114122
inline void epBank1DisableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.STALL1 = 1; }
123+
inline void epBank0DisableTransferFailed(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.TRFAIL0 = 1; }
124+
inline void epBank1DisableTransferFailed(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.TRFAIL1 = 1; }
115125
inline void epBank0DisableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.TRCPT0 = 1; }
116126
inline void epBank1DisableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.TRCPT1 = 1; }
117127

0 commit comments

Comments
 (0)