|
Message
From: cvs at opencores.org<cvs@o...>
Date: Tue Dec 20 12:35:33 CET 2005
Subject: [cvs-checkins] MODIFIED: or1k ...
Date: 00/05/12 20:12:35 Added: or1k/rc203soc/sw/uClinux/include/asm-generic bitops.h unaligned.h Log: First Import of RC20x uClinux Revision Changes Path 1.1 or1k/rc203soc/sw/uClinux/include/asm-generic/bitops.h http://www.opencores.org/cvsweb.shtml/or1k/rc203soc/sw/uClinux/include/asm-generic/bitops.h?rev=1.1&content-type=text/x-cvsweb-markup Index: bitops.h =================================================================== #ifndef _ASM_GENERIC_BITOPS_H_ #define _ASM_GENERIC_BITOPS_H_ /* * For the benefit of those who are trying to port Linux to another * architecture, here are some C-language equivalents. You should * recode these in the native assembly language, if at all possible. * To guarantee atomicity, these routines call cli() and sti() to * disable interrupts while they operate. (You have to provide inline * routines to cli() and sti().) * * Also note, these routines assume that you have 32 bit integers. * You will have to change this if you are trying to port Linux to the * Alpha architecture or to a Cray. :-) * * C language equivalents written by Theodore Ts'o, 9/26/92 */ extern __inline__ int set_bit(int nr,int * addr) { int mask, retval; addr += nr >> 5; mask = 1 << (nr & 0x1f); cli(); retval = (mask & *addr) != 0; *addr |= mask; sti(); return retval; } extern __inline__ int clear_bit(int nr, int * addr) { int mask, retval; addr += nr >> 5; mask = 1 << (nr & 0x1f); cli(); retval = (mask & *addr) != 0; *addr &= ~mask; sti(); return retval; } extern __inline__ int test_bit(int nr, int * addr) { int mask; addr += nr >> 5; mask = 1 << (nr & 0x1f); return ((mask & *addr) != 0); } #endif /* _ASM_GENERIC_BITOPS_H */ 1.1 or1k/rc203soc/sw/uClinux/include/asm-generic/unaligned.h http://www.opencores.org/cvsweb.shtml/or1k/rc203soc/sw/uClinux/include/asm-generic/unaligned.h?rev=1.1&content-type=text/x-cvsweb-markup Index: unaligned.h =================================================================== #ifndef _ASM_GENERIC_UNALIGNED_H_ #define _ASM_GENERIC_UNALIGNED_H_ /* * For the benefit of those who are trying to port Linux to another * architecture, here are some C-language equivalents. */ #include <asm/string.h> #define get_unaligned(ptr) \ ({ __typeof__(*(ptr)) __tmp; memcpy(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) #define put_unaligned(val, ptr) \ ({ __typeof__(*(ptr)) __tmp = (val); \ memcpy((ptr), &__tmp, sizeof(*(ptr))); \ (void)0; }) #endif /* _ASM_GENERIC_UNALIGNED_H */
|
 |