Annotation of Gnu-Mach/i386/i386at/gpl/linux/include/asm/delay.h, revision 1.1

1.1     ! root        1: #ifndef _I386_DELAY_H
        !             2: #define _I386_DELAY_H
        !             3: 
        !             4: /*
        !             5:  * Copyright (C) 1993 Linus Torvalds
        !             6:  *
        !             7:  * Delay routines, using a pre-computed "loops_per_second" value.
        !             8:  */
        !             9:  
        !            10: #ifdef __SMP__
        !            11: #include <asm/smp.h>
        !            12: #endif 
        !            13: 
        !            14: extern __inline__ void __delay(int loops)
        !            15: {
        !            16:        __asm__ __volatile__(
        !            17:                ".align 2,0x90\n1:\tdecl %0\n\tjns 1b"
        !            18:                :/* no outputs */
        !            19:                :"a" (loops)
        !            20:                :"ax");
        !            21: }
        !            22: 
        !            23: /*
        !            24:  * division by multiplication: you don't have to worry about
        !            25:  * loss of precision.
        !            26:  *
        !            27:  * Use only for very small delays ( < 1 msec).  Should probably use a
        !            28:  * lookup table, really, as the multiplications take much too long with
        !            29:  * short delays.  This is a "reasonable" implementation, though (and the
        !            30:  * first constant multiplications gets optimized away if the delay is
        !            31:  * a constant)
        !            32:  */
        !            33: extern __inline__ void udelay(unsigned long usecs)
        !            34: {
        !            35:        usecs *= 0x000010c6;            /* 2**32 / 1000000 */
        !            36:        __asm__("mull %0"
        !            37:                :"=d" (usecs)
        !            38: #ifdef __SMP__
        !            39:                :"a" (usecs),"0" (cpu_data[smp_processor_id()].udelay_val)
        !            40: #else
        !            41:                :"a" (usecs),"0" (loops_per_sec)
        !            42: #endif
        !            43:                :"ax");
        !            44:                
        !            45:        __delay(usecs);
        !            46: }
        !            47: 
        !            48: extern __inline__ unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c)
        !            49: {
        !            50:        __asm__("mull %1 ; divl %2"
        !            51:                :"=a" (a)
        !            52:                :"d" (b),
        !            53:                 "r" (c),
        !            54:                 "0" (a)
        !            55:                :"dx");
        !            56:        return a;
        !            57: }
        !            58: 
        !            59: #endif /* defined(_I386_DELAY_H) */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.