Mercurial > ~darius > hgwebdir.cgi > tempctrl
comparison 1wire-delay.h @ 10:eb1faf51968e
- Add some useful return values to search functions.
- Remove some unecessary trailing \'s in macros
- Replace some inline assembly I missed last time with C/macros.
author | darius |
---|---|
date | Mon, 12 Jul 2004 23:59:00 +0930 |
parents | f9a085a0ba93 |
children | 8dc98a293e43 |
comparison
equal
deleted
inserted
replaced
9:7ed10c59ba06 | 10:eb1faf51968e |
---|---|
39 #define DELAY_A asm volatile( \ | 39 #define DELAY_A asm volatile( \ |
40 "ldi r21, 6\n\t" \ | 40 "ldi r21, 6\n\t" \ |
41 "L_%=: nop\n\t" \ | 41 "L_%=: nop\n\t" \ |
42 "dec r21\n\t" \ | 42 "dec r21\n\t" \ |
43 "brne L_%=\n\t" \ | 43 "brne L_%=\n\t" \ |
44 ::: "r21"); | 44 ::: "r21") |
45 | 45 |
46 /* 64 usec */ | 46 /* 64 usec */ |
47 #define DELAY_B asm volatile( \ | 47 #define DELAY_B asm volatile( \ |
48 "ldi r21, 32\n\t" \ | 48 "ldi r21, 32\n\t" \ |
49 "L_%=: nop\n\t" \ | 49 "L_%=: nop\n\t" \ |
51 "nop\n\t" \ | 51 "nop\n\t" \ |
52 "nop\n\t" \ | 52 "nop\n\t" \ |
53 "nop\n\t" \ | 53 "nop\n\t" \ |
54 "dec r21\n\t" \ | 54 "dec r21\n\t" \ |
55 "brne L_%=\n\t" \ | 55 "brne L_%=\n\t" \ |
56 ::: "r21"); | 56 ::: "r21") |
57 | 57 |
58 /* 60 usec */ | 58 /* 60 usec */ |
59 #define DELAY_C asm volatile( \ | 59 #define DELAY_C asm volatile( \ |
60 "ldi r21, 30\n\t" \ | 60 "ldi r21, 30\n\t" \ |
61 "L_%=: nop\n\t" \ | 61 "L_%=: nop\n\t" \ |
63 "nop\n\t" \ | 63 "nop\n\t" \ |
64 "nop\n\t" \ | 64 "nop\n\t" \ |
65 "nop\n\t" \ | 65 "nop\n\t" \ |
66 "dec r21\n\t" \ | 66 "dec r21\n\t" \ |
67 "brne L_%=\n\t" \ | 67 "brne L_%=\n\t" \ |
68 ::: "r21"); | 68 ::: "r21") |
69 | 69 |
70 /* 10 usec */ | 70 /* 10 usec */ |
71 #define DELAY_D asm volatile( \ | 71 #define DELAY_D asm volatile( \ |
72 "ldi r21, 9\n\t" \ | 72 "ldi r21, 9\n\t" \ |
73 "L_%=: nop\n\t" \ | 73 "L_%=: nop\n\t" \ |
74 "dec r21\n\t" \ | 74 "dec r21\n\t" \ |
75 "brne L_%=\n\t" \ | 75 "brne L_%=\n\t" \ |
76 ::: "r21"); | 76 ::: "r21") |
77 | 77 |
78 /* 9 usec */ | 78 /* 9 usec */ |
79 #define DELAY_E asm volatile( \ | 79 #define DELAY_E asm volatile( \ |
80 "ldi r21, 8\n\t" \ | 80 "ldi r21, 8\n\t" \ |
81 "L_%=: nop\n\t" \ | 81 "L_%=: nop\n\t" \ |
82 "dec r21\n\t" \ | 82 "dec r21\n\t" \ |
83 "brne L_%=\n\t" \ | 83 "brne L_%=\n\t" \ |
84 ::: "r21"); | 84 ::: "r21") |
85 | 85 |
86 /* 55 usec */ | 86 /* 55 usec */ |
87 #define DELAY_F asm volatile( \ | 87 #define DELAY_F asm volatile( \ |
88 "ldi r21, 27\n\t" \ | 88 "ldi r21, 27\n\t" \ |
89 "L_%=: nop\n\t" \ | 89 "L_%=: nop\n\t" \ |
99 "nop\n\t" \ | 99 "nop\n\t" \ |
100 "nop\n\t" \ | 100 "nop\n\t" \ |
101 "nop\n\t" \ | 101 "nop\n\t" \ |
102 "dec r21\n\t" \ | 102 "dec r21\n\t" \ |
103 "brne L_%=\n\t" \ | 103 "brne L_%=\n\t" \ |
104 ::: "r21"); | 104 ::: "r21") |
105 | 105 |
106 /* 0 usec */ | 106 /* 0 usec */ |
107 #define DELAY_G | 107 #define DELAY_G |
108 | 108 |
109 /* 480 usec */ | 109 /* 480 usec */ |
122 "nop\n\t" \ | 122 "nop\n\t" \ |
123 "nop\n\t" \ | 123 "nop\n\t" \ |
124 "nop\n\t" \ | 124 "nop\n\t" \ |
125 "dec r21\n\t" \ | 125 "dec r21\n\t" \ |
126 "brne L_%=\n\t" \ | 126 "brne L_%=\n\t" \ |
127 ::: "r21"); | 127 ::: "r21") |
128 | 128 |
129 /* 70 usec */ | 129 /* 70 usec */ |
130 #define DELAY_I asm volatile( \ | 130 #define DELAY_I asm volatile( \ |
131 "ldi r21, 35\n\t" \ | 131 "ldi r21, 35\n\t" \ |
132 "L_%=: nop\n\t" \ | 132 "L_%=: nop\n\t" \ |
134 "nop\n\t" \ | 134 "nop\n\t" \ |
135 "nop\n\t" \ | 135 "nop\n\t" \ |
136 "nop\n\t" \ | 136 "nop\n\t" \ |
137 "dec r21\n\t" \ | 137 "dec r21\n\t" \ |
138 "brne L_%=\n\t" \ | 138 "brne L_%=\n\t" \ |
139 ::: "r21"); | 139 ::: "r21") |
140 #else | 140 #else |
141 #error No 1 wire delay routines for selected clock speed | 141 #error No 1 wire delay routines for selected clock speed |
142 #endif | 142 #endif |
143 | 143 |