aboutsummaryrefslogtreecommitdiffstats
path: root/usbdrv/usbdrvasm16.inc
diff options
context:
space:
mode:
authorChristian Starkjohann <cs+github@obdev.at>2009-08-09 18:59:43 +0000
committerChristian Starkjohann <cs+github@obdev.at>2009-08-09 18:59:43 +0000
commit3aa5195808868206835073e3c1a638a5973e20d8 (patch)
treeb9556d1ee1a8317cc80e603784c54c1fb98414f6 /usbdrv/usbdrvasm16.inc
parente48398bee7d1ec5fe2301118f1be2a160dd949bd (diff)
downloadv-usb-3aa5195808868206835073e3c1a638a5973e20d8.tar.gz
v-usb-3aa5195808868206835073e3c1a638a5973e20d8.tar.bz2
v-usb-3aa5195808868206835073e3c1a638a5973e20d8.zip
- fixed duration of unstuffing routine for bit 6 (was one cycle too long)
Diffstat (limited to 'usbdrv/usbdrvasm16.inc')
-rw-r--r--usbdrv/usbdrvasm16.inc15
1 files changed, 9 insertions, 6 deletions
diff --git a/usbdrv/usbdrvasm16.inc b/usbdrv/usbdrvasm16.inc
index 2430170..4c00faa 100644
--- a/usbdrv/usbdrvasm16.inc
+++ b/usbdrv/usbdrvasm16.inc
@@ -117,12 +117,15 @@ haveTwoBitsK:
; Receiver loop (numbers in brackets are cycles within byte after instr)
;----------------------------------------------------------------------------
+; duration of unstuffing code should be 10.66666667 cycles. We adjust "leap"
+; accordingly to approximate this value in the long run.
+
unstuff6:
andi x2, USBMASK ;[03]
ori x3, 1<<6 ;[04] will not be shifted any more
andi shift, ~0x80;[05]
mov x1, x2 ;[06] sampled bit 7 is actually re-sampled bit 6
- subi leap, 3 ;[07] since this is a short (10 cycle) bit, enforce leap bit
+ subi leap, -1 ;[07] total duration = 11 bits -> subtract 1/3
rjmp didUnstuff6 ;[08]
unstuff7:
@@ -130,7 +133,7 @@ unstuff7:
in x2, USBIN ;[00] [10] re-sample bit 7
andi x2, USBMASK ;[01]
andi shift, ~0x80;[02]
- subi leap, 3 ;[03] since this is a short (10 cycle) bit, enforce leap bit
+ subi leap, 2 ;[03] total duration = 10 bits -> add 1/3
rjmp didUnstuff7 ;[04]
unstuffEven:
@@ -139,8 +142,8 @@ unstuffEven:
andi shift, ~0x80;[01]
andi x1, USBMASK ;[02]
breq se0 ;[03]
- subi leap, 3 ;[04] since this is a short (10 cycle) bit, enforce leap bit
- nop ;[05]
+ subi leap, -1 ;[04] total duration = 11 bits -> subtract 1/3
+ nop2 ;[05]
rjmp didUnstuffE ;[06]
unstuffOdd:
@@ -149,8 +152,8 @@ unstuffOdd:
andi shift, ~0x80;[01]
andi x2, USBMASK ;[02]
breq se0 ;[03]
- subi leap, 3 ;[04] since this is a short (10 cycle) bit, enforce leap bit
- nop ;[05]
+ subi leap, -1 ;[04] total duration = 11 bits -> subtract 1/3
+ nop2 ;[05]
rjmp didUnstuffO ;[06]
rxByteLoop: