From bdb53e4c043d089279d9891b68bea77614cb97ee Mon Sep 17 00:00:00 2001 From: yiancar Date: Sun, 16 Aug 2020 01:07:21 +0100 Subject: Added 3rd endpoint (#1) * Added 3rd endpoint - Added 3rd endpoint check in asmcommon. This adds 2 extra cycles to the USB routine when enabled. With 16MHz clock (most if not all qmk build use that) the routine is still within spec. - Updated prototype.h file to add additional options. - Simulatanius changes in QMK to follow soon * Update usbdrv/usbdrv.c * Update usbdrv/usbdrv.c * Update usbdrv/usbdrv.c * Update usbdrv/usbdrv.c * Update usbdrv/usbdrvasm.S Accepted to keep changes minimal * Update usbdrv/usbdrvasm.S Accepted to keep changes minimal * Update usbdrv/usbdrvasm.S Accepted to keep changes minimal * Update usbdrv/usbdrvasm.S Accepted to keep changes minimal --- usbdrv/asmcommon.inc | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'usbdrv/asmcommon.inc') diff --git a/usbdrv/asmcommon.inc b/usbdrv/asmcommon.inc index d2a4f7c..906dc14 100644 --- a/usbdrv/asmcommon.inc +++ b/usbdrv/asmcommon.inc @@ -110,11 +110,17 @@ handleData: breq doReturn ;[21] lds x2, usbRxLen ;[22] tst x2 ;[24] - brne sendNakAndReti ;[25] +; 2020-05-04 Following change is used to overcome branch +/- 64 word limit. + breq noBranchSendNakAndReti ; [25] + rjmp sendNakAndReti +noBranchSendNakAndReti: ; 2006-03-11: The following two lines fix a problem where the device was not ; recognized if usbPoll() was called less frequently than once every 4 ms. cpi cnt, 4 ;[26] zero sized data packets are status phase only -- ignore and ack - brmi sendAckAndReti ;[27] keep rx buffer clean -- we must not NAK next SETUP +; 2020-05-04 Following change is used to overcome branch +/- 64 word limit. + brpl noBranchSendAckAndReti ;[27] keep rx buffer clean -- we must not NAK next SETUP + rjmp sendAckAndReti +noBranchSendAckAndReti: #if USB_CFG_CHECK_DATA_TOGGLING sts usbCurrentDataToken, token ; store for checking by C code #endif @@ -165,6 +171,10 @@ handleIn1: ;[38] ; 2006-06-10 as suggested by O.Tamura: support second INTR IN / BULK IN endpoint cpi x3, USB_CFG_EP3_NUMBER;[38] breq handleIn3 ;[39] +#endif +#if USB_CFG_HAVE_INTRIN_ENDPOINT4 + cpi x3, USB_CFG_EP4_NUMBER;[38] + breq handleIn4 ;[39] #endif lds cnt, usbTxLen1 ;[40] sbrc cnt, 4 ;[42] all handshake tokens have bit 4 set @@ -184,4 +194,16 @@ handleIn3: ldi YH, hi8(usbTxBuf3) ;[48] rjmp usbSendAndReti ;[49] 51 + 12 = 63 until SOP #endif + +#if USB_CFG_HAVE_INTRIN_ENDPOINT4 +handleIn4: + lds cnt, usbTxLen4 ;[41] + sbrc cnt, 4 ;[43] + rjmp sendCntAndReti ;[44] 49 + 16 = 65 until SOP + sts usbTxLen4, x1 ;[45] x1 == USBPID_NAK from above + ldi YL, lo8(usbTxBuf4) ;[47] + ldi YH, hi8(usbTxBuf4) ;[48] + rjmp usbSendAndReti ;[49] 51 + 12 = 63 until SOP +#endif + #endif -- cgit v1.2.3