From aacf677a758f61f273ab8dff5c8a6a92eee4404a Mon Sep 17 00:00:00 2001 From: Christian Starkjohann Date: Mon, 20 Oct 2008 13:18:39 +0000 Subject: - use timeout in waitForJ --- usbdrv/usbdrvasm128.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'usbdrv/usbdrvasm128.inc') diff --git a/usbdrv/usbdrvasm128.inc b/usbdrv/usbdrvasm128.inc index 8b19d69..2dd6fe1 100644 --- a/usbdrv/usbdrvasm128.inc +++ b/usbdrv/usbdrvasm128.inc @@ -107,10 +107,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 -- cgit v1.2.3