aboutsummaryrefslogtreecommitdiffstats
path: root/usbdrv/usbdrvasm12.inc
diff options
context:
space:
mode:
authorChristian Starkjohann <cs+github@obdev.at>2008-10-20 13:18:39 +0000
committerChristian Starkjohann <cs+github@obdev.at>2008-10-20 13:18:39 +0000
commitaacf677a758f61f273ab8dff5c8a6a92eee4404a (patch)
treec5598e6b6d5a887f1d08f31a5ff930a1f058e8be /usbdrv/usbdrvasm12.inc
parent232152349a0a601dd67581850fd08e108867d250 (diff)
downloadv-usb-aacf677a758f61f273ab8dff5c8a6a92eee4404a.tar.gz
v-usb-aacf677a758f61f273ab8dff5c8a6a92eee4404a.tar.bz2
v-usb-aacf677a758f61f273ab8dff5c8a6a92eee4404a.zip
- use timeout in waitForJ
Diffstat (limited to 'usbdrv/usbdrvasm12.inc')
-rw-r--r--usbdrv/usbdrvasm12.inc10
1 files changed, 7 insertions, 3 deletions
diff --git a/usbdrv/usbdrvasm12.inc b/usbdrv/usbdrvasm12.inc
index d9da1dc..f891ab6 100644
--- a/usbdrv/usbdrvasm12.inc
+++ b/usbdrv/usbdrvasm12.inc
@@ -48,10 +48,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)
+;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:
- sbis USBIN, USBMINUS ;1 [40] wait for D- == 1
- rjmp waitForJ ;2
+ sbic USBIN, USBMINUS
+ rjmp waitForK
+ inc YL
+ brne waitForJ ; just make sure we have ANY timeout
waitForK:
;The following code results in a sampling window of 1/4 bit which meets the spec.
sbis USBIN, USBMINUS