Path: blob/master/arch/unicore32/include/asm/delay.h
10820 views
/*1* linux/arch/unicore32/include/asm/delay.h2*3* Code specific to PKUnity SoC and UniCore ISA4*5* Copyright (C) 2001-2010 GUAN Xue-tao6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License version 2 as9* published by the Free Software Foundation.10*11* Delay routines, using a pre-computed "loops_per_second" value.12*/13#ifndef __UNICORE_DELAY_H__14#define __UNICORE_DELAY_H__1516#include <asm/param.h> /* HZ */1718extern void __delay(int loops);1920/*21* This function intentionally does not exist; if you see references to22* it, it means that you're calling udelay() with an out of range value.23*24* With currently imposed limits, this means that we support a max delay25* of 2000us. Further limits: HZ<=1000 and bogomips<=335526*/27extern void __bad_udelay(void);2829/*30* division by multiplication: you don't have to worry about31* loss of precision.32*33* Use only for very small delays ( < 1 msec). Should probably use a34* lookup table, really, as the multiplications take much too long with35* short delays. This is a "reasonable" implementation, though (and the36* first constant multiplications gets optimized away if the delay is37* a constant)38*/39extern void __udelay(unsigned long usecs);40extern void __const_udelay(unsigned long);4142#define MAX_UDELAY_MS 24344#define udelay(n) \45(__builtin_constant_p(n) ? \46((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \47__const_udelay((n) * ((2199023U*HZ)>>11))) : \48__udelay(n))4950#endif /* __UNICORE_DELAY_H__ */51525354