ffsport.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * NAND Flash Controller Device Driver
  3. * Copyright (c) 2009, Intel Corporation and its suppliers.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms and conditions of the GNU General Public License,
  7. * version 2, as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  17. *
  18. */
  19. #ifndef _FFSPORT_
  20. #define _FFSPORT_
  21. #include "ffsdefs.h"
  22. #if defined __GNUC__
  23. #define PACKED
  24. #define PACKED_GNU __attribute__ ((packed))
  25. #define UNALIGNED
  26. #endif
  27. #include <linux/semaphore.h>
  28. #include <linux/string.h> /* for strcpy(), stricmp(), etc */
  29. #include <linux/mm.h> /* for kmalloc(), kfree() */
  30. #include <linux/vmalloc.h>
  31. #include <linux/module.h>
  32. #include <linux/moduleparam.h>
  33. #include <linux/init.h>
  34. #include <linux/kernel.h> /* printk() */
  35. #include <linux/fs.h> /* everything... */
  36. #include <linux/errno.h> /* error codes */
  37. #include <linux/types.h> /* size_t */
  38. #include <linux/genhd.h>
  39. #include <linux/blkdev.h>
  40. #include <linux/hdreg.h>
  41. #include <linux/pci.h>
  42. #include "flash.h"
  43. #define VERBOSE 1
  44. #define NAND_DBG_WARN 1
  45. #define NAND_DBG_DEBUG 2
  46. #define NAND_DBG_TRACE 3
  47. extern int nand_debug_level;
  48. #ifdef VERBOSE
  49. #define nand_dbg_print(level, args...) \
  50. do { \
  51. if (level <= nand_debug_level) \
  52. printk(KERN_ALERT args); \
  53. } while (0)
  54. #else
  55. #define nand_dbg_print(level, args...)
  56. #endif
  57. #ifdef SUPPORT_BIG_ENDIAN
  58. #define INVERTUINT16(w) ((u16)(((u16)(w)) << 8) | \
  59. (u16)((u16)(w) >> 8))
  60. #define INVERTUINT32(dw) (((u32)(dw) << 24) | \
  61. (((u32)(dw) << 8) & 0x00ff0000) | \
  62. (((u32)(dw) >> 8) & 0x0000ff00) | \
  63. ((u32)(dw) >> 24))
  64. #else
  65. #define INVERTUINT16(w) w
  66. #define INVERTUINT32(dw) dw
  67. #endif
  68. extern int GLOB_Calc_Used_Bits(u32 n);
  69. extern u64 GLOB_u64_Div(u64 addr, u32 divisor);
  70. extern u64 GLOB_u64_Remainder(u64 addr, u32 divisor_type);
  71. #endif /* _FFSPORT_ */