aboutsummaryrefslogtreecommitdiffstats
path: root/usbdrv/asmcommon.inc
diff options
context:
space:
mode:
authoryiancar <yiangosyiangou@cytanet.com.cy>2020-08-16 01:07:21 +0100
committerGitHub <noreply@github.com>2020-08-15 17:07:21 -0700
commitbdb53e4c043d089279d9891b68bea77614cb97ee (patch)
treee9a7ba50a29ae7f45c941d89f2578981cee6a0f4 /usbdrv/asmcommon.inc
parent9a42d205eb60faca494ff4eabce8d59f0ec0fc7f (diff)
downloadv-usb-bdb53e4c043d089279d9891b68bea77614cb97ee.tar.gz
v-usb-bdb53e4c043d089279d9891b68bea77614cb97ee.tar.bz2
v-usb-bdb53e4c043d089279d9891b68bea77614cb97ee.zip
Added 3rd endpoint (#1)HEADmaster
* 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
Diffstat (limited to 'usbdrv/asmcommon.inc')
-rw-r--r--usbdrv/asmcommon.inc26
1 files changed, 24 insertions, 2 deletions
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
@@ -166,6 +172,10 @@ handleIn1: ;[38]
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
rjmp sendCntAndReti ;[43] 47 + 16 = 63 until SOP
@@ -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