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

Function DELAY

freebsd/mips/mips/tick.c:196–226  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 14

start_apFunction · 0.70
mtk_usb_phy_attachFunction · 0.50
mtk_soc_reset_deviceFunction · 0.50
mtk_pcie_phy_mt7621_initFunction · 0.50
mtk_pcie_phy_mt7628_initFunction · 0.50
mtk_pcie_phy_mt7620_setFunction · 0.50
mtk_pcie_phy_mt7620_initFunction · 0.50
mtk_pcie_phy_rt3883_initFunction · 0.50
mtk_pcie_phy_setup_slotsFunction · 0.50
mtk_uart_getcFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected