usbdrv/usbdrvasm128.inc

Thu, 16 Feb 2017 14:40:23 +0100

author
Malte Di Donato <mdd@neo-soft.org>
date
Thu, 16 Feb 2017 14:40:23 +0100
changeset 0
9e9b2c78bd31
permissions
-rw-r--r--

added V-USB stack

0
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
1 /* Name: usbdrvasm128.inc
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
3 * Author: Christian Starkjohann
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
4 * Creation Date: 2008-10-11
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
5 * Tabsize: 4
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
6 * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
8 */
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
9
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
10 /* Do not link this file! Link usbdrvasm.S instead, which includes the
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
11 * appropriate implementation!
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
12 */
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
13
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
14 /*
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
15 General Description:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
16 This file is the 12.8 MHz version of the USB driver. It is intended for use
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
17 with the internal RC oscillator. Although 12.8 MHz is outside the guaranteed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
18 calibration range of the oscillator, almost all AVRs can reach this frequency.
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
19 This version contains a phase locked loop in the receiver routine to cope with
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
20 slight clock rate deviations of up to +/- 1%.
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
21
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
22 See usbdrv.h for a description of the entire driver.
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
23
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
24 LIMITATIONS
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
25 ===========
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
26 Although it may seem very handy to save the crystal and use the internal
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
27 RC oscillator of the CPU, this method (and this module) has some serious
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
28 limitations:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
29 (1) The guaranteed calibration range of the oscillator is only 8.1 MHz.
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
30 They typical range is 14.5 MHz and most AVRs can actually reach this rate.
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
31 (2) Writing EEPROM and Flash may be unreliable (short data lifetime) since
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
32 the write procedure is timed from the RC oscillator.
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
33 (3) End Of Packet detection (SE0) should be in bit 1, bit it is only checked
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
34 if bits 0 and 1 both read as 0 on D- and D+ read as 0 in the middle. This may
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
35 cause problems with old hubs which delay SE0 by up to one cycle.
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
36 (4) Code size is much larger than that of the other modules.
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
37
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
38 Since almost all of this code is timing critical, don't change unless you
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
39 really know what you are doing! Many parts require not only a maximum number
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
40 of CPU cycles, but even an exact number of cycles!
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
41
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
42 Implementation notes:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
43 ======================
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
44 min frequency: 67 cycles for 8 bit -> 12.5625 MHz
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
45 max frequency: 69.286 cycles for 8 bit -> 12.99 MHz
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
46 nominal frequency: 12.77 MHz ( = sqrt(min * max))
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
47
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
48 sampling positions: (next even number in range [+/- 0.5])
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
49 cycle index range: 0 ... 66
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
50 bits:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
51 .5, 8.875, 17.25, 25.625, 34, 42.375, 50.75, 59.125
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
52 [0/1], [9], [17], [25/+26], [34], [+42/43], [51], [59]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
53
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
54 bit number: 0 1 2 3 4 5 6 7
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
55 spare cycles 1 2 1 2 1 1 1 0
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
56
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
57 operations to perform: duration cycle
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
58 ----------------
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
59 eor fix, shift 1 -> 00
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
60 andi phase, USBMASK 1 -> 08
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
61 breq se0 1 -> 16 (moved to 11)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
62 st y+, data 2 -> 24, 25
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
63 mov data, fix 1 -> 33
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
64 ser data 1 -> 41
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
65 subi cnt, 1 1 -> 49
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
66 brcs overflow 1 -> 50
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
67
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
68 layout of samples and operations:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
69 [##] = sample bit
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
70 <##> = sample phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
71 *##* = operation
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
72
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
73 0: *00* [01] 02 03 04 <05> 06 07
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
74 1: *08* [09] 10 11 12 <13> 14 15 *16*
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
75 2: [17] 18 19 20 <21> 22 23
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
76 3: *24* *25* [26] 27 28 29 <30> 31 32
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
77 4: *33* [34] 35 36 37 <38> 39 40
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
78 5: *41* [42] 43 44 45 <46> 47 48
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
79 6: *49* *50* [51] 52 53 54 <55> 56 57 58
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
80 7: [59] 60 61 62 <63> 64 65 66
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
81 *****************************************************************************/
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
82
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
83 /* we prefer positive expressions (do if condition) instead of negative
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
84 * (skip if condition), therefore use defines for skip instructions:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
85 */
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
86 #define ifioclr sbis
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
87 #define ifioset sbic
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
88 #define ifrclr sbrs
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
89 #define ifrset sbrc
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
90
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
91 /* The registers "fix" and "data" swap their meaning during the loop. Use
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
92 * defines to keep their name constant.
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
93 */
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
94 #define fix x2
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
95 #define data x1
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
96 #undef phase /* phase has a default definition to x4 */
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
97 #define phase x3
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
98
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
99
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
100 USB_INTR_VECTOR:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
101 ;order of registers pushed: YL, SREG [sofError], YH, shift, x1, x2, x3, cnt, r0
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
102 push YL ;2 push only what is necessary to sync with edge ASAP
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
103 in YL, SREG ;1
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
104 push YL ;2
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
105 ;----------------------------------------------------------------------------
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
106 ; Synchronize with sync pattern:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
107 ;----------------------------------------------------------------------------
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
108 ;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
109 ;sync up with J to K edge during sync pattern -- use fastest possible loops
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
110 ;The first part waits at most 1 bit long since we must be in sync pattern.
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
111 ;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
112 ;waitForJ, ensure that this prerequisite is met.
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
113 waitForJ:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
114 inc YL
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
115 sbis USBIN, USBMINUS
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
116 brne waitForJ ; just make sure we have ANY timeout
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
117 waitForK:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
118 ;The following code results in a sampling window of 1/4 bit which meets the spec.
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
119 sbis USBIN, USBMINUS
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
120 rjmp foundK
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
121 sbis USBIN, USBMINUS
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
122 rjmp foundK
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
123 sbis USBIN, USBMINUS
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
124 rjmp foundK
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
125 sbis USBIN, USBMINUS
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
126 rjmp foundK
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
127 sbis USBIN, USBMINUS ;[0]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
128 rjmp foundK ;[1]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
129 #if USB_COUNT_SOF
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
130 lds YL, usbSofCount
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
131 inc YL
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
132 sts usbSofCount, YL
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
133 #endif /* USB_COUNT_SOF */
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
134 #ifdef USB_SOF_HOOK
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
135 USB_SOF_HOOK
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
136 #endif
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
137 rjmp sofError
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
138
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
139 foundK:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
140 ;{3, 5} after falling D- edge, average delay: 4 cycles [we want 4 for center sampling]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
141 ;we have 1 bit time for setup purposes, then sample again. Numbers in brackets
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
142 ;are cycles from center of first sync (double K) bit after the instruction
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
143 push YH ;[2]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
144 lds YL, usbInputBufOffset;[4]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
145 clr YH ;[6]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
146 subi YL, lo8(-(usbRxBuf));[7]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
147 sbci YH, hi8(-(usbRxBuf));[8]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
148
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
149 sbis USBIN, USBMINUS ;[9] we want two bits K [we want to sample at 8 + 4 - 1.5 = 10.5]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
150 rjmp haveTwoBitsK ;[10]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
151 pop YH ;[11] undo the push from before
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
152 rjmp waitForK ;[13] this was not the end of sync, retry
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
153 haveTwoBitsK:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
154 ;----------------------------------------------------------------------------
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
155 ; push more registers and initialize values while we sample the first bits:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
156 ;----------------------------------------------------------------------------
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
157 #define fix x2
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
158 #define data x1
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
159
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
160 push shift ;[12]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
161 push x1 ;[14]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
162 push x2 ;[16]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
163 ldi shift, 0x80 ;[18] prevent bit-unstuffing but init low bits to 0
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
164 ifioset USBIN, USBMINUS ;[19] [01] <--- bit 0 [10.5 + 8 = 18.5]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
165 ori shift, 1<<0 ;[02]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
166 push x3 ;[03]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
167 push cnt ;[05]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
168 push r0 ;[07]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
169 ifioset USBIN, USBMINUS ;[09] <--- bit 1
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
170 ori shift, 1<<1 ;[10]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
171 ser fix ;[11]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
172 ldi cnt, USB_BUFSIZE ;[12]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
173 mov data, shift ;[13]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
174 lsl shift ;[14]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
175 nop2 ;[15]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
176 ifioset USBIN, USBMINUS ;[17] <--- bit 2
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
177 ori data, 3<<2 ;[18] store in bit 2 AND bit 3
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
178 eor shift, data ;[19] do nrzi decoding
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
179 andi data, 1<<3 ;[20]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
180 in phase, USBIN ;[21] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
181 brne jumpToEntryAfterSet ;[22] if USBMINS at bit 3 was 1
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
182 nop ;[23]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
183 rjmp entryAfterClr ;[24]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
184 jumpToEntryAfterSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
185 rjmp entryAfterSet ;[24]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
186
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
187 ;----------------------------------------------------------------------------
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
188 ; Receiver loop (numbers in brackets are cycles within byte after instr)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
189 ;----------------------------------------------------------------------------
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
190 #undef fix
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
191 #define fix x1
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
192 #undef data
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
193 #define data x2
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
194
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
195 bit7IsSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
196 ifrclr phase, USBMINUS ;[62] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
197 lpm ;[63]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
198 in phase, USBIN ;[64] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
199 ori shift, 1 << 7 ;[65]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
200 nop ;[66]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
201 ;;;;rjmp bit0AfterSet ; -> [00] == [67] moved block up to save jump
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
202 bit0AfterSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
203 eor fix, shift ;[00]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
204 #undef fix
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
205 #define fix x2
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
206 #undef data
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
207 #define data x1 /* we now have result in data, fix is reset to 0xff */
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
208 ifioclr USBIN, USBMINUS ;[01] <--- sample 0
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
209 rjmp bit0IsClr ;[02]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
210 andi shift, ~(7 << 0) ;[03]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
211 breq unstuff0s ;[04]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
212 in phase, USBIN ;[05] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
213 rjmp bit1AfterSet ;[06]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
214 unstuff0s:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
215 in phase, USBIN ;[06] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
216 andi fix, ~(1 << 0) ;[07]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
217 ifioclr USBIN, USBMINUS ;[00]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
218 ifioset USBIN, USBPLUS ;[01]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
219 rjmp bit0IsClr ;[02] executed if first expr false or second true
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
220 se0AndStore: ; executed only if both bits 0
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
221 st y+, x1 ;[15/17] cycles after start of byte
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
222 rjmp se0 ;[17/19]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
223
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
224 bit0IsClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
225 ifrset phase, USBMINUS ;[04] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
226 lpm ;[05]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
227 in phase, USBIN ;[06] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
228 ori shift, 1 << 0 ;[07]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
229 bit1AfterClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
230 andi phase, USBMASK ;[08]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
231 ifioset USBIN, USBMINUS ;[09] <--- sample 1
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
232 rjmp bit1IsSet ;[10]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
233 breq se0AndStore ;[11] if D- was 0 in bits 0 AND 1 and D+ was 0 in between, we have SE0
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
234 andi shift, ~(7 << 1) ;[12]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
235 in phase, USBIN ;[13] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
236 breq unstuff1c ;[14]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
237 rjmp bit2AfterClr ;[15]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
238 unstuff1c:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
239 andi fix, ~(1 << 1) ;[16]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
240 nop2 ;[08]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
241 nop2 ;[10]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
242 bit1IsSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
243 ifrclr phase, USBMINUS ;[12] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
244 lpm ;[13]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
245 in phase, USBIN ;[14] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
246 ori shift, 1 << 1 ;[15]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
247 nop ;[16]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
248 bit2AfterSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
249 ifioclr USBIN, USBMINUS ;[17] <--- sample 2
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
250 rjmp bit2IsClr ;[18]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
251 andi shift, ~(7 << 2) ;[19]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
252 breq unstuff2s ;[20]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
253 in phase, USBIN ;[21] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
254 rjmp bit3AfterSet ;[22]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
255 unstuff2s:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
256 in phase, USBIN ;[22] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
257 andi fix, ~(1 << 2) ;[23]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
258 nop2 ;[16]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
259 nop2 ;[18]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
260 bit2IsClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
261 ifrset phase, USBMINUS ;[20] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
262 lpm ;[21]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
263 in phase, USBIN ;[22] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
264 ori shift, 1 << 2 ;[23]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
265 bit3AfterClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
266 st y+, data ;[24]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
267 entryAfterClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
268 ifioset USBIN, USBMINUS ;[26] <--- sample 3
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
269 rjmp bit3IsSet ;[27]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
270 andi shift, ~(7 << 3) ;[28]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
271 breq unstuff3c ;[29]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
272 in phase, USBIN ;[30] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
273 rjmp bit4AfterClr ;[31]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
274 unstuff3c:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
275 in phase, USBIN ;[31] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
276 andi fix, ~(1 << 3) ;[32]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
277 nop2 ;[25]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
278 nop2 ;[27]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
279 bit3IsSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
280 ifrclr phase, USBMINUS ;[29] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
281 lpm ;[30]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
282 in phase, USBIN ;[31] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
283 ori shift, 1 << 3 ;[32]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
284 bit4AfterSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
285 mov data, fix ;[33] undo this move by swapping defines
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
286 #undef fix
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
287 #define fix x1
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
288 #undef data
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
289 #define data x2
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
290 ifioclr USBIN, USBMINUS ;[34] <--- sample 4
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
291 rjmp bit4IsClr ;[35]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
292 andi shift, ~(7 << 4) ;[36]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
293 breq unstuff4s ;[37]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
294 in phase, USBIN ;[38] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
295 rjmp bit5AfterSet ;[39]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
296 unstuff4s:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
297 in phase, USBIN ;[39] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
298 andi fix, ~(1 << 4) ;[40]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
299 nop2 ;[33]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
300 nop2 ;[35]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
301 bit4IsClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
302 ifrset phase, USBMINUS ;[37] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
303 lpm ;[38]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
304 in phase, USBIN ;[39] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
305 ori shift, 1 << 4 ;[40]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
306 bit5AfterClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
307 ser data ;[41]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
308 ifioset USBIN, USBMINUS ;[42] <--- sample 5
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
309 rjmp bit5IsSet ;[43]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
310 andi shift, ~(7 << 5) ;[44]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
311 breq unstuff5c ;[45]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
312 in phase, USBIN ;[46] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
313 rjmp bit6AfterClr ;[47]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
314 unstuff5c:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
315 in phase, USBIN ;[47] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
316 andi fix, ~(1 << 5) ;[48]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
317 nop2 ;[41]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
318 nop2 ;[43]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
319 bit5IsSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
320 ifrclr phase, USBMINUS ;[45] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
321 lpm ;[46]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
322 in phase, USBIN ;[47] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
323 ori shift, 1 << 5 ;[48]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
324 bit6AfterSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
325 subi cnt, 1 ;[49]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
326 brcs jumpToOverflow ;[50]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
327 ifioclr USBIN, USBMINUS ;[51] <--- sample 6
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
328 rjmp bit6IsClr ;[52]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
329 andi shift, ~(3 << 6) ;[53]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
330 cpi shift, 2 ;[54]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
331 in phase, USBIN ;[55] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
332 brlt unstuff6s ;[56]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
333 rjmp bit7AfterSet ;[57]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
334
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
335 jumpToOverflow:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
336 rjmp overflow
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
337
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
338 unstuff6s:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
339 andi fix, ~(1 << 6) ;[50]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
340 lpm ;[51]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
341 bit6IsClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
342 ifrset phase, USBMINUS ;[54] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
343 lpm ;[55]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
344 in phase, USBIN ;[56] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
345 ori shift, 1 << 6 ;[57]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
346 nop ;[58]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
347 bit7AfterClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
348 ifioset USBIN, USBMINUS ;[59] <--- sample 7
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
349 rjmp bit7IsSet ;[60]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
350 andi shift, ~(1 << 7) ;[61]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
351 cpi shift, 4 ;[62]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
352 in phase, USBIN ;[63] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
353 brlt unstuff7c ;[64]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
354 rjmp bit0AfterClr ;[65] -> [00] == [67]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
355 unstuff7c:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
356 andi fix, ~(1 << 7) ;[58]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
357 nop ;[59]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
358 rjmp bit7IsSet ;[60]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
359
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
360 bit7IsClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
361 ifrset phase, USBMINUS ;[62] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
362 lpm ;[63]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
363 in phase, USBIN ;[64] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
364 ori shift, 1 << 7 ;[65]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
365 nop ;[66]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
366 ;;;;rjmp bit0AfterClr ; -> [00] == [67] moved block up to save jump
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
367 bit0AfterClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
368 eor fix, shift ;[00]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
369 #undef fix
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
370 #define fix x2
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
371 #undef data
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
372 #define data x1 /* we now have result in data, fix is reset to 0xff */
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
373 ifioset USBIN, USBMINUS ;[01] <--- sample 0
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
374 rjmp bit0IsSet ;[02]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
375 andi shift, ~(7 << 0) ;[03]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
376 breq unstuff0c ;[04]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
377 in phase, USBIN ;[05] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
378 rjmp bit1AfterClr ;[06]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
379 unstuff0c:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
380 in phase, USBIN ;[06] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
381 andi fix, ~(1 << 0) ;[07]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
382 ifioclr USBIN, USBMINUS ;[00]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
383 ifioset USBIN, USBPLUS ;[01]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
384 rjmp bit0IsSet ;[02] executed if first expr false or second true
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
385 rjmp se0AndStore ;[03] executed only if both bits 0
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
386 bit0IsSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
387 ifrclr phase, USBMINUS ;[04] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
388 lpm ;[05]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
389 in phase, USBIN ;[06] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
390 ori shift, 1 << 0 ;[07]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
391 bit1AfterSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
392 andi shift, ~(7 << 1) ;[08] compensated by "ori shift, 1<<1" if bit1IsClr
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
393 ifioclr USBIN, USBMINUS ;[09] <--- sample 1
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
394 rjmp bit1IsClr ;[10]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
395 breq unstuff1s ;[11]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
396 nop2 ;[12] do not check for SE0 if bit 0 was 1
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
397 in phase, USBIN ;[14] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
398 rjmp bit2AfterSet ;[15]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
399 unstuff1s:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
400 in phase, USBIN ;[13] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
401 andi fix, ~(1 << 1) ;[14]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
402 lpm ;[07]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
403 nop2 ;[10]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
404 bit1IsClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
405 ifrset phase, USBMINUS ;[12] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
406 lpm ;[13]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
407 in phase, USBIN ;[14] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
408 ori shift, 1 << 1 ;[15]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
409 nop ;[16]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
410 bit2AfterClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
411 ifioset USBIN, USBMINUS ;[17] <--- sample 2
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
412 rjmp bit2IsSet ;[18]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
413 andi shift, ~(7 << 2) ;[19]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
414 breq unstuff2c ;[20]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
415 in phase, USBIN ;[21] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
416 rjmp bit3AfterClr ;[22]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
417 unstuff2c:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
418 in phase, USBIN ;[22] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
419 andi fix, ~(1 << 2) ;[23]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
420 nop2 ;[16]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
421 nop2 ;[18]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
422 bit2IsSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
423 ifrclr phase, USBMINUS ;[20] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
424 lpm ;[21]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
425 in phase, USBIN ;[22] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
426 ori shift, 1 << 2 ;[23]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
427 bit3AfterSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
428 st y+, data ;[24]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
429 entryAfterSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
430 ifioclr USBIN, USBMINUS ;[26] <--- sample 3
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
431 rjmp bit3IsClr ;[27]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
432 andi shift, ~(7 << 3) ;[28]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
433 breq unstuff3s ;[29]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
434 in phase, USBIN ;[30] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
435 rjmp bit4AfterSet ;[31]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
436 unstuff3s:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
437 in phase, USBIN ;[31] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
438 andi fix, ~(1 << 3) ;[32]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
439 nop2 ;[25]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
440 nop2 ;[27]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
441 bit3IsClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
442 ifrset phase, USBMINUS ;[29] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
443 lpm ;[30]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
444 in phase, USBIN ;[31] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
445 ori shift, 1 << 3 ;[32]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
446 bit4AfterClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
447 mov data, fix ;[33] undo this move by swapping defines
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
448 #undef fix
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
449 #define fix x1
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
450 #undef data
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
451 #define data x2
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
452 ifioset USBIN, USBMINUS ;[34] <--- sample 4
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
453 rjmp bit4IsSet ;[35]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
454 andi shift, ~(7 << 4) ;[36]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
455 breq unstuff4c ;[37]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
456 in phase, USBIN ;[38] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
457 rjmp bit5AfterClr ;[39]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
458 unstuff4c:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
459 in phase, USBIN ;[39] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
460 andi fix, ~(1 << 4) ;[40]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
461 nop2 ;[33]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
462 nop2 ;[35]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
463 bit4IsSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
464 ifrclr phase, USBMINUS ;[37] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
465 lpm ;[38]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
466 in phase, USBIN ;[39] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
467 ori shift, 1 << 4 ;[40]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
468 bit5AfterSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
469 ser data ;[41]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
470 ifioclr USBIN, USBMINUS ;[42] <--- sample 5
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
471 rjmp bit5IsClr ;[43]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
472 andi shift, ~(7 << 5) ;[44]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
473 breq unstuff5s ;[45]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
474 in phase, USBIN ;[46] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
475 rjmp bit6AfterSet ;[47]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
476 unstuff5s:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
477 in phase, USBIN ;[47] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
478 andi fix, ~(1 << 5) ;[48]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
479 nop2 ;[41]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
480 nop2 ;[43]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
481 bit5IsClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
482 ifrset phase, USBMINUS ;[45] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
483 lpm ;[46]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
484 in phase, USBIN ;[47] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
485 ori shift, 1 << 5 ;[48]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
486 bit6AfterClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
487 subi cnt, 1 ;[49]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
488 brcs overflow ;[50]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
489 ifioset USBIN, USBMINUS ;[51] <--- sample 6
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
490 rjmp bit6IsSet ;[52]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
491 andi shift, ~(3 << 6) ;[53]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
492 cpi shift, 2 ;[54]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
493 in phase, USBIN ;[55] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
494 brlt unstuff6c ;[56]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
495 rjmp bit7AfterClr ;[57]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
496 unstuff6c:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
497 andi fix, ~(1 << 6) ;[50]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
498 lpm ;[51]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
499 bit6IsSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
500 ifrclr phase, USBMINUS ;[54] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
501 lpm ;[55]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
502 in phase, USBIN ;[56] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
503 ori shift, 1 << 6 ;[57]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
504 bit7AfterSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
505 ifioclr USBIN, USBMINUS ;[59] <--- sample 7
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
506 rjmp bit7IsClr ;[60]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
507 andi shift, ~(1 << 7) ;[61]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
508 cpi shift, 4 ;[62]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
509 in phase, USBIN ;[63] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
510 brlt unstuff7s ;[64]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
511 rjmp bit0AfterSet ;[65] -> [00] == [67]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
512 unstuff7s:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
513 andi fix, ~(1 << 7) ;[58]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
514 nop ;[59]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
515 rjmp bit7IsClr ;[60]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
516
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
517 macro POP_STANDARD ; 14 cycles
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
518 pop r0
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
519 pop cnt
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
520 pop x3
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
521 pop x2
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
522 pop x1
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
523 pop shift
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
524 pop YH
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
525 endm
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
526 macro POP_RETI ; 5 cycles
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
527 pop YL
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
528 out SREG, YL
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
529 pop YL
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
530 endm
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
531
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
532 #include "asmcommon.inc"
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
533
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
534 ;----------------------------------------------------------------------------
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
535 ; Transmitting data
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
536 ;----------------------------------------------------------------------------
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
537
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
538 txByteLoop:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
539 txBitloop:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
540 stuffN1Delay: ; [03]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
541 ror shift ;[-5] [11] [63]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
542 brcc doExorN1 ;[-4] [64]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
543 subi x3, 1 ;[-3]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
544 brne commonN1 ;[-2]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
545 lsl shift ;[-1] compensate ror after rjmp stuffDelay
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
546 nop ;[00] stuffing consists of just waiting 8 cycles
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
547 rjmp stuffN1Delay ;[01] after ror, C bit is reliably clear
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
548
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
549 sendNakAndReti:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
550 ldi cnt, USBPID_NAK ;[-19]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
551 rjmp sendCntAndReti ;[-18]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
552 sendAckAndReti:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
553 ldi cnt, USBPID_ACK ;[-17]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
554 sendCntAndReti:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
555 mov r0, cnt ;[-16]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
556 ldi YL, 0 ;[-15] R0 address is 0
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
557 ldi YH, 0 ;[-14]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
558 ldi cnt, 2 ;[-13]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
559 ; rjmp usbSendAndReti fallthrough
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
560
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
561 ; USB spec says:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
562 ; idle = J
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
563 ; J = (D+ = 0), (D- = 1) or USBOUT = 0x01
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
564 ; K = (D+ = 1), (D- = 0) or USBOUT = 0x02
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
565 ; Spec allows 7.5 bit times from EOP to SOP for replies (= 60 cycles)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
566
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
567 ;usbSend:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
568 ;pointer to data in 'Y'
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
569 ;number of bytes in 'cnt' -- including sync byte
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
570 ;uses: x1...x3, shift, cnt, Y [x1 = mirror USBOUT, x2 = USBMASK, x3 = bitstuff cnt]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
571 ;Numbers in brackets are time since first bit of sync pattern is sent (start of instruction)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
572 usbSendAndReti:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
573 in x2, USBDDR ;[-10] 10 cycles until SOP
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
574 ori x2, USBMASK ;[-9]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
575 sbi USBOUT, USBMINUS ;[-8] prepare idle state; D+ and D- must have been 0 (no pullups)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
576 out USBDDR, x2 ;[-6] <--- acquire bus
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
577 in x1, USBOUT ;[-5] port mirror for tx loop
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
578 ldi shift, 0x40 ;[-4] sync byte is first byte sent (we enter loop after ror)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
579 ldi x2, USBMASK ;[-3]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
580 doExorN1:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
581 eor x1, x2 ;[-2] [06] [62]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
582 ldi x3, 6 ;[-1] [07] [63]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
583 commonN1:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
584 stuffN2Delay:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
585 out USBOUT, x1 ;[00] [08] [64] <--- set bit
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
586 ror shift ;[01]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
587 brcc doExorN2 ;[02]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
588 subi x3, 1 ;[03]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
589 brne commonN2 ;[04]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
590 lsl shift ;[05] compensate ror after rjmp stuffDelay
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
591 rjmp stuffN2Delay ;[06] after ror, C bit is reliably clear
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
592 doExorN2:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
593 eor x1, x2 ;[04] [12]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
594 ldi x3, 6 ;[05] [13]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
595 commonN2:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
596 nop2 ;[06] [14]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
597 subi cnt, 171 ;[08] [16] trick: (3 * 171) & 0xff = 1
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
598 out USBOUT, x1 ;[09] [17] <--- set bit
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
599 brcs txBitloop ;[10] [27] [44]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
600
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
601 stuff6Delay:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
602 ror shift ;[45] [53]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
603 brcc doExor6 ;[46]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
604 subi x3, 1 ;[47]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
605 brne common6 ;[48]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
606 lsl shift ;[49] compensate ror after rjmp stuffDelay
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
607 nop ;[50] stuffing consists of just waiting 8 cycles
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
608 rjmp stuff6Delay ;[51] after ror, C bit is reliably clear
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
609 doExor6:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
610 eor x1, x2 ;[48] [56]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
611 ldi x3, 6 ;[49]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
612 common6:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
613 stuff7Delay:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
614 ror shift ;[50] [58]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
615 out USBOUT, x1 ;[51] <--- set bit
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
616 brcc doExor7 ;[52]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
617 subi x3, 1 ;[53]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
618 brne common7 ;[54]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
619 lsl shift ;[55] compensate ror after rjmp stuffDelay
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
620 rjmp stuff7Delay ;[56] after ror, C bit is reliably clear
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
621 doExor7:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
622 eor x1, x2 ;[54] [62]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
623 ldi x3, 6 ;[55]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
624 common7:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
625 ld shift, y+ ;[56]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
626 nop ;[58]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
627 tst cnt ;[59]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
628 out USBOUT, x1 ;[60] [00]<--- set bit
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
629 brne txByteLoop ;[61] [01]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
630 ;make SE0:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
631 cbr x1, USBMASK ;[02] prepare SE0 [spec says EOP may be 15 to 18 cycles]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
632 lds x2, usbNewDeviceAddr;[03]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
633 lsl x2 ;[05] we compare with left shifted address
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
634 subi YL, 2 + 0 ;[06] Only assign address on data packets, not ACK/NAK in r0
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
635 sbci YH, 0 ;[07]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
636 out USBOUT, x1 ;[00] <-- out SE0 -- from now 2 bits = 16 cycles until bus idle
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
637 ;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
638 ;set address only after data packet was sent, not after handshake
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
639 breq skipAddrAssign ;[01]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
640 sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
641 skipAddrAssign:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
642 ;end of usbDeviceAddress transfer
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
643 ldi x2, 1<<USB_INTR_PENDING_BIT;[03] int0 occurred during TX -- clear pending flag
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
644 USB_STORE_PENDING(x2) ;[04]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
645 ori x1, USBIDLE ;[05]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
646 in x2, USBDDR ;[06]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
647 cbr x2, USBMASK ;[07] set both pins to input
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
648 mov x3, x1 ;[08]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
649 cbr x3, USBMASK ;[09] configure no pullup on both pins
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
650 lpm ;[10]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
651 lpm ;[13]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
652 out USBOUT, x1 ;[16] <-- out J (idle) -- end of SE0 (EOP signal)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
653 out USBDDR, x2 ;[17] <-- release bus now
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
654 out USBOUT, x3 ;[18] <-- ensure no pull-up resistors are active
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
655 rjmp doReturn
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
656
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
657
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
658
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
659 /*****************************************************************************
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
660 The following PHP script generates a code skeleton for the receiver routine:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
661
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
662 <?php
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
663
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
664 function printCmdBuffer($thisBit)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
665 {
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
666 global $cycle;
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
667
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
668 $nextBit = ($thisBit + 1) % 8;
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
669 $s = ob_get_contents();
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
670 ob_end_clean();
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
671 $s = str_replace("#", $thisBit, $s);
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
672 $s = str_replace("@", $nextBit, $s);
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
673 $lines = explode("\n", $s);
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
674 for($i = 0; $i < count($lines); $i++){
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
675 $s = $lines[$i];
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
676 if(ereg("\\[([0-9-][0-9])\\]", $s, $regs)){
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
677 $c = $cycle + (int)$regs[1];
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
678 $s = ereg_replace("\\[[0-9-][0-9]\\]", sprintf("[%02d]", $c), $s);
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
679 }
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
680 if(strlen($s) > 0)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
681 echo "$s\n";
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
682 }
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
683 }
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
684
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
685 function printBit($isAfterSet, $bitNum)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
686 {
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
687 ob_start();
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
688 if($isAfterSet){
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
689 ?>
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
690 ifioclr USBIN, USBMINUS ;[00] <--- sample
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
691 rjmp bit#IsClr ;[01]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
692 andi shift, ~(7 << #) ;[02]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
693 breq unstuff#s ;[03]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
694 in phase, USBIN ;[04] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
695 rjmp bit@AfterSet ;[05]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
696 unstuff#s:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
697 in phase, USBIN ;[05] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
698 andi fix, ~(1 << #) ;[06]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
699 nop2 ;[-1]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
700 nop2 ;[01]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
701 bit#IsClr:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
702 ifrset phase, USBMINUS ;[03] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
703 lpm ;[04]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
704 in phase, USBIN ;[05] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
705 ori shift, 1 << # ;[06]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
706 <?php
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
707 }else{
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
708 ?>
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
709 ifioset USBIN, USBMINUS ;[00] <--- sample
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
710 rjmp bit#IsSet ;[01]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
711 andi shift, ~(7 << #) ;[02]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
712 breq unstuff#c ;[03]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
713 in phase, USBIN ;[04] <- phase
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
714 rjmp bit@AfterClr ;[05]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
715 unstuff#c:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
716 in phase, USBIN ;[05] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
717 andi fix, ~(1 << #) ;[06]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
718 nop2 ;[-1]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
719 nop2 ;[01]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
720 bit#IsSet:
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
721 ifrclr phase, USBMINUS ;[03] check phase only if D- changed
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
722 lpm ;[04]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
723 in phase, USBIN ;[05] <- phase (one cycle too late)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
724 ori shift, 1 << # ;[06]
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
725 <?php
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
726 }
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
727 printCmdBuffer($bitNum);
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
728 }
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
729
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
730 $bitStartCycles = array(1, 9, 17, 26, 34, 42, 51, 59);
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
731 for($i = 0; $i < 16; $i++){
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
732 $bit = $i % 8;
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
733 $emitClrCode = ($i + (int)($i / 8)) % 2;
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
734 $cycle = $bitStartCycles[$bit];
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
735 if($emitClrCode){
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
736 printf("bit%dAfterClr:\n", $bit);
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
737 }else{
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
738 printf("bit%dAfterSet:\n", $bit);
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
739 }
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
740 ob_start();
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
741 echo " ***** ;[-1]\n";
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
742 printCmdBuffer($bit);
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
743 printBit(!$emitClrCode, $bit);
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
744 if($i == 7)
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
745 echo "\n";
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
746 }
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
747
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
748 ?>
9e9b2c78bd31 added V-USB stack
Malte Di Donato <mdd@neo-soft.org>
parents:
diff changeset
749 *****************************************************************************/

mercurial