1/* 2 * @TAG(OTHER_GPL) 3 */ 4 5/* 6 * (C) Copyright 2000-2009 7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 8 * 9 * See file CREDITS for list of people who contributed to this 10 * project. 11 * 12 * This program is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License as 14 * published by the Free Software Foundation; either version 2 of 15 * the License, or (at your option) any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * You should have received a copy of the GNU General Public License 23 * along with this program; if not, write to the Free Software 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 25 * MA 02111-1307 USA 26 */ 27#pragma once 28 29#undef _LINUX_CONFIG_H 30#define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */ 31 32#include "../unimplemented.h" 33 34#ifdef CONFIG_POST 35#define CONFIG_HAS_POST 36#ifndef CONFIG_POST_ALT_LIST 37#define CONFIG_POST_STD_LIST 38#endif 39#endif 40 41#ifdef CONFIG_INIT_CRITICAL 42#error CONFIG_INIT_CRITICAL is deprecated! 43#error Read section CONFIG_SKIP_LOWLEVEL_INIT in README. 44#endif 45 46 47#define ROUND(a,b) (((a) + (b) - 1) & ~((b) - 1)) 48#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 49 50#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) 51 52 53 54#ifdef ETH_DEBUG 55#define _DEBUG 1 56#else 57#define _DEBUG 0 58#endif 59 60/* 61 * Output a debug text when condition "cond" is met. The "cond" should be 62 * computed by a preprocessor in the best case, allowing for the best 63 * optimization. 64 */ 65#define debug_cond(cond, fmt, args...) \ 66 do { \ 67 if (cond) \ 68 printf(fmt, ##args); \ 69 } while (0) 70 71#define debug(fmt, args...) \ 72 debug_cond(_DEBUG, fmt, ##args) 73 74/** 75 * container_of - cast a member of a structure out to the containing structure 76 * @ptr: the pointer to the member. 77 * @type: the type of the container struct this is embedded in. 78 * @member: the name of the member within the struct. 79 * 80 */ 81#define container_of(ptr, type, member) ({ \ 82 const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 83 (type *)( (char *)__mptr - offsetof(type,member) );}) 84