1/* 2 * Copyright 2017, Data61 3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4 * ABN 41 687 119 230. 5 * 6 * This software may be distributed and modified according to the terms of 7 * the BSD 2-Clause license. Note that NO WARRANTY is provided. 8 * See "LICENSE_BSD2.txt" for details. 9 * 10 * @TAG(DATA61_BSD) 11 */ 12 13#pragma once 14 15#define ps_ndelay(ns) ps_udelay((ns) / 1000 + 1) 16#define ps_mdelay(ms) ps_udelay((ms) * 1000) 17#define ps_sdelay(s) ps_mdelay((s) * 1000) 18 19/** 20 * Delay execution for at least the given number of microseconds. This is 21 * a trivial function which simply spins in a loop. The actual length of 22 * the delay depends on the current threads remaining time slice and the 23 * number and priority of other threads in the system. 24 * The use of this function should be avoided and replaced with calls to 25 * usleep(...) where possible. 26 * @param[in] us The minimum number of microseconds to delay for 27 */ 28void ps_udelay(unsigned long us); 29 30/** 31 * Provide the current CPU frequency to the libplatsupport delay module. 32 * @parma[in] hz An upper bound estimate of the current cpu frequency 33 * to ensure that the delay requests to ps_udelay can be 34 * met. If this function has not yet been called, a 35 * default frequency will be used. 36 */ 37void ps_cpufreq_hint(unsigned long hz); 38 39