MCPcopy Create free account
hub / github.com/F-Stack/f-stack / DELAY

Function DELAY

freebsd/mips/nlm/tick.c:197–227  ·  view source on GitHub ↗

* Wait for about n microseconds (at least!). */

Source from the content-addressed store, hash-verified

195 * Wait for about n microseconds (at least!).
196 */
197void
198DELAY(int n)
199{
200 uint32_t cur, last, delta, usecs;
201
202 TSENTER();
203 /*
204 * This works by polling the timer and counting the number of
205 * microseconds that go by.
206 */
207 last = mips_rd_count();
208 delta = usecs = 0;
209
210 while (n > usecs) {
211 cur = mips_rd_count();
212
213 /* Check to see if the timer has wrapped around. */
214 if (cur < last)
215 delta += cur + (0xffffffff - last) + 1;
216 else
217 delta += cur - last;
218
219 last = cur;
220
221 if (delta >= cycles_per_usec) {
222 usecs += delta / cycles_per_usec;
223 delta %= cycles_per_usec;
224 }
225 }
226 TSEXIT();
227}
228
229static int
230clock_start(struct eventtimer *et, sbintime_t first, sbintime_t period)

Callers 15

nlm_usb_hw_resetFunction · 0.70
qca955x_pci_setupFunction · 0.50
qca955x_pci_attachFunction · 0.50
ar71xx_pci_fixupFunction · 0.50
ar71xx_pci_attachFunction · 0.50
ar724x_pci_setupFunction · 0.50
ar724x_pci_fixupFunction · 0.50
ar724x_pci_attachFunction · 0.50
ar71xx_wdog_watchdog_fnFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected