aboutsummaryrefslogtreecommitdiffstats
path: root/usbdrv/usbdrvasm15.inc
diff options
context:
space:
mode:
Diffstat (limited to 'usbdrv/usbdrvasm15.inc')
-rw-r--r--usbdrv/usbdrvasm15.inc13
1 files changed, 8 insertions, 5 deletions
diff --git a/usbdrv/usbdrvasm15.inc b/usbdrv/usbdrvasm15.inc
index 689d2a3..a315eae 100644
--- a/usbdrv/usbdrvasm15.inc
+++ b/usbdrv/usbdrvasm15.inc
@@ -43,11 +43,14 @@ USB_INTR_VECTOR:
;
; sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K]
; sync up with J to K edge during sync pattern -- use fastest possible loops
-; first part has no timeout because it waits for IDLE or SE1 (== disconnected)
-;-------------------------------------------------------------------------------
-waitForJ: ;-
- sbis USBIN, USBMINUS ;1 <-- sample: wait for D- == 1
- rjmp waitForJ ;2
+;The first part waits at most 1 bit long since we must be in sync pattern.
+;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to
+;waitForJ, ensure that this prerequisite is met.
+waitForJ:
+ sbic USBIN, USBMINUS
+ rjmp waitForK
+ inc YL
+ brne waitForJ ; just make sure we have ANY timeout
;-------------------------------------------------------------------------------
; The following code results in a sampling window of < 1/4 bit
; which meets the spec.