Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

bits.h

Go to the documentation of this file.
00001 /*
00002  * Some of this code has been taken from bitops.h
00003  * Copyright 1992, Linus Torvalds.
00004  *
00005  * Others functions has been added by
00006  * Miguel Masmano Tello <mmasmano@disca.upv.es>
00007  * Copyright (C) Feb, 2003 OCERA Consortium
00008  * Release under the terms of the GNU General Public License Version 2
00009  */
00010 
00011 #define ADDR (*(volatile long *) addr)
00012 
00023 static __inline__ int TLSF_ffs(int x)
00024 {
00025         int r;
00026 
00027         __asm__("bsfl %1,%0\n\t"
00028                 "jnz 1f\n\t"
00029                 "movl $-1,%0\n"
00030                 "1:" : "=r" (r) : "g" (x));
00031         return r;
00032 }
00033 
00034 
00043 static __inline__ int TLSF_fls(int x)
00044 {
00045         int r;
00046 
00047         __asm__("bsrl %1,%0\n\t"
00048                 "jnz 1f\n\t"
00049                 "movl $-1,%0\n"
00050                 "1:" : "=r" (r) : "g" (x));
00051         return r;
00052 }
00053 
00063 /*
00064 static __inline__ void __set_bit(int nr, volatile void * addr)
00065 {
00066         __asm__(
00067                 "btsl %1,%0"
00068                 :"=m" (ADDR)
00069                 :"Ir" (nr));
00070 }
00071 */
00082 static __inline__ void __clear_bit(int nr, volatile void * addr)
00083 {
00084         __asm__ __volatile__( 
00085                 "btrl %1,%0"
00086                 :"=m" (ADDR)
00087                 :"Ir" (nr));
00088 }
00089 
00090 
00091 
00092 

Generated on Wed Jan 14 12:58:56 2004 for RTL-lwIP-0.4 by doxygen 1.3.4