| /* | |
| * @TAG(OTHER_GPL) | |
| */ | |
| /* | |
| * (C) Copyright 2000-2009 | |
| * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
| * | |
| * See file CREDITS for list of people who contributed to this | |
| * project. | |
| * | |
| * This program is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU General Public License as | |
| * published by the Free Software Foundation; either version 2 of | |
| * the License, or (at your option) any later version. | |
| * | |
| * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| * GNU General Public License for more details. | |
| * | |
| * You should have received a copy of the GNU General Public License | |
| * along with this program; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| * MA 02111-1307 USA | |
| */ | |
| #ifndef __COMMON_H_ | |
| #define __COMMON_H_ 1 | |
| #undef _LINUX_CONFIG_H | |
| #define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */ | |
| #include "config.h" | |
| #include "../unimplemented.h" | |
| #ifdef CONFIG_POST | |
| #define CONFIG_HAS_POST | |
| #ifndef CONFIG_POST_ALT_LIST | |
| #define CONFIG_POST_STD_LIST | |
| #endif | |
| #endif | |
| #ifdef CONFIG_INIT_CRITICAL | |
| #error CONFIG_INIT_CRITICAL is deprecated! | |
| #error Read section CONFIG_SKIP_LOWLEVEL_INIT in README. | |
| #endif | |
| #define ROUND(a,b) (((a) + (b) - 1) & ~((b) - 1)) | |
| #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) | |
| #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) | |
| #ifdef ETH_DEBUG | |
| #define _DEBUG 1 | |
| #else | |
| #define _DEBUG 0 | |
| #endif | |
| /* | |
| * Output a debug text when condition "cond" is met. The "cond" should be | |
| * computed by a preprocessor in the best case, allowing for the best | |
| * optimization. | |
| */ | |
| #define debug_cond(cond, fmt, args...) \ | |
| do { \ | |
| if (cond) \ | |
| printf(fmt, ##args); \ | |
| } while (0) | |
| #define debug(fmt, args...) \ | |
| debug_cond(_DEBUG, fmt, ##args) | |
| /** | |
| * container_of - cast a member of a structure out to the containing structure | |
| * @ptr: the pointer to the member. | |
| * @type: the type of the container struct this is embedded in. | |
| * @member: the name of the member within the struct. | |
| * | |
| */ | |
| #define container_of(ptr, type, member) ({ \ | |
| const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | |
| (type *)( (char *)__mptr - offsetof(type,member) );}) | |
| #endif /* __COMMON_H_ */ |