os/nandboot-R2_0_4/lib/mtd-compat.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002 *!
00003 *! FILE NAME  : mtd-compat.h
00004 *!
00005 *! DESCRIPTION: Compatibility macros and functions etc for linux mtd in
00006 *!              nandboot environment.
00007 *!
00008 *! ---------------------------------------------------------------------------
00009 *! (C) Copyright 2006-2007, Axis Communications AB, LUND, SWEDEN
00010 *!
00011 *! This program is free software; you can redistribute it and/or modify
00012 *! it under the terms of the GNU General Public License as published by
00013 *! the Free Software Foundation; either version 2 of the License, or
00014 *! (at your option) any later version.
00015 *!
00016 *! This program is distributed in the hope that it will be useful,
00017 *! but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 *! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 *! GNU General Public License for more details.
00020 *!
00021 *! You should have received a copy of the GNU General Public License
00022 *! along with this program; if not, write to the Free Software
00023 *! Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00024 *!
00025 *!***************************************************************************/
00026 
00027 #ifndef _MTDCOMPAT_H
00028 #define _MTDCOMPAT_H
00029 
00030 #include <linux/autoconf.h>
00031 
00032 #ifndef __ASSEMBLER__
00033 
00034 #include "lib.h"
00035 
00036 /* local config, we don't want to depend on linux/config.h for this */
00037 #undef CONFIG_MTD_PARTITIONS
00038 #undef CONFIG_MTD_DEBUG
00039 #undef CONFIG_MTD_DEBUG_VERBOSE
00040 #define CONFIG_MTD_DEBUG_VERBOSE 3 /* debug level */
00041 #undef CONFIG_MTD_NAND_VERIFY_WRITE /* avoid conflict with define in config */
00042 #define CONFIG_MTD_NAND_VERIFY_WRITE
00043 
00044 /* our MTD config */
00045 
00046 #define NAND_BBT_SUPPORT  0
00047 #define NAND_WRITE_SUPPORT 0
00048 #define NAND_ERASE_SUPPORT 0
00049 #define NAND_MULTICHIP_SUPPORT 0
00050 #define NAND_HWECC_SUPPORT 0
00051 #define NAND_KVEC_SUPPORT 0
00052 
00053 /* nullify some functions depending on the above macros */
00054 
00055 #if (NAND_ERASE_SUPPORT == 0)
00056 #define nand_erase NULL
00057 #endif
00058 
00059 #if (NAND_WRITE_SUPPORT == 0)
00060 #define nand_write NULL
00061 #define nand_write_ecc NULL
00062 #define nand_write_oob NULL
00063 #define nand_block_markbad NULL
00064 #define nand_default_block_markbad NULL
00065 #endif
00066 
00067 #if (NAND_KVEC_SUPPORT == 0)
00068 #define nand_writev NULL
00069 #define nand_writev_ecc NULL
00070 #endif
00071 
00072 #if (NAND_KVEC_SUPPORT == 0)
00073 struct kvec { int x; };
00074 #endif
00075 
00076 /* min and max, from kernel.h */
00077 #define min_t(type,x,y) \
00078         ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
00079 
00080 #define max_t(type,x,y) \
00081         ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
00082 
00083 #define min(x,y) ({ \
00084         typeof(x) _x = (x);     \
00085         typeof(y) _y = (y);     \
00086         (void) (&_x == &_y);            \
00087         _x < _y ? _x : _y; })
00088 
00089 #define max(x,y) ({ \
00090         typeof(x) _x = (x);     \
00091         typeof(y) _y = (y);     \
00092         (void) (&_x == &_y);            \
00093         _x > _y ? _x : _y; })
00094 
00095 /* conversions - for little endian machines (i.e. CRIS, and ARM as we use it */
00096 /* from byteorder/generic.h -> byteorder/little_endian.h */
00097 #undef cpu_to_le16
00098 #define cpu_to_le16(x) ((__le16) (__u16)(x))
00099 #undef le16_to_cpu
00100 #define le16_to_cpu(x) ((__u16) (__le16)(x))
00101 
00102 /* memory allocation */
00103 #define GFP_KERNEL  0
00104 #define kmalloc(size, mode) malloc(size)
00105 #define kfree(ptr) free(ptr)
00106 
00107 /* task management */
00108 #define HZ 1000
00109 #define TASK_INTERRUPTIBLE 0
00110 #define TASK_UNINTERRUPTIBLE 1
00111 #define set_current_state(x) do { } while (0)
00112 #define schedule() do { } while (0)
00113 #define cond_resched() do { } while (0)
00114 #define wake_up(x) do { } while (0)
00115 
00116 /* list management */
00117 struct list_head { int x; };
00118 #define wait_queue_head_t int
00119 #define DECLARE_WAITQUEUE(x, y)
00120 #define init_waitqueue_head(x) do { } while (0)
00121 #define init_waitqueue_head(x) do { } while (0)
00122 #define add_wait_queue(x, y) do { } while (0)
00123 #define remove_wait_queue(x, y) do { } while (0)
00124 
00125 /* spinlocks */
00126 #define spinlock_t int
00127 #define spin_lock_init(x) do { } while (0)
00128 #define spin_lock(x) do { } while (0)
00129 #define spin_unlock(x) do { } while (0)
00130 
00131 /* system time */
00132 unsigned long jiffies; /* note: never bumped, see time_before on next line */
00133 #define time_before(x, y) (x | y | 1)
00134 
00135 /* interrupts */
00136 #undef local_irq_save
00137 #define local_irq_save(x) do { (void)x; } while (0)
00138 #undef local_irq_restore
00139 #define local_irq_restore(x) do { (void)x; } while (0)
00140 
00141 /* io */
00142 #define __iomem
00143 #define ioremap(addr, pgsize) ((void *) (addr))
00144 #define iounmap(addr) do { } while (0)
00145 
00146 /* printk */
00147 /* Just print format string, as a ... well, string */
00148 #ifdef DO_PRINTK /* defined per file when needed */
00149 #define printk(fmt, params...)  simple_printk(fmt)
00150 void simple_printk(const char *fmt);
00151 #else
00152 #define printk(fmt, params...) do { } while (0)
00153 #endif
00154 #define KERN_INFO ""
00155 #define KERN_DEBUG ""
00156 #define KERN_NOTICE ""
00157 #define KERN_WARNING ""
00158 #define KERN_ERR ""
00159 
00160 /* module stuff */
00161 #define __init
00162 #define __exit
00163 #define module_init(x)
00164 #define module_exit(x)
00165 #define MODULE_LICENSE(x)
00166 #define MODULE_AUTHOR(x)
00167 #define MODULE_DESCRIPTION(x)
00168 #define EXPORT_SYMBOL(x)
00169 #define EXPORT_SYMBOL_GPL(x)
00170 
00171 /* misc */
00172 #define touch_softlockup_watchdog() do { } while (0)
00173 #undef THIS_MODULE
00174 #define THIS_MODULE 0
00175 struct notifier_block { int x; };
00176 
00177 #undef BUG
00178 #define BUG() error2("BUG in " __FILE__, __LINE__, __FUNCTION__)
00179 
00180 #endif /* !__ASSEMBLER__ */
00181 
00182 #endif /* _MTDCOMPAT_H */

Generated on Fri Nov 28 00:06:24 2008 for elphel by  doxygen 1.5.1