nand.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * File : nand.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2011-05-25 Bernard first version
  13. */
  14. #ifndef __NAND_H__
  15. #define __NAND_H__
  16. #include <rtthread.h>
  17. #define IO_NF_PFR FM3_GPIO->PFR3
  18. #define IO_NF_DDR FM3_GPIO->DDR3
  19. #define IO_NF_PDOR FM3_GPIO->PDOR3
  20. #define NF_EN 0x0008
  21. #define NF_DATA_DIR 0x0004
  22. #define EXT_BUS_BASE_ADDR 0x60000000
  23. #define EXT_CS7_OFFSET 0x0E000000
  24. #define EXT_CS7_SIZE 0x02000000
  25. #define NF_FLASH_BASE_ADDR (EXT_BUS_BASE_ADDR+EXT_CS7_OFFSET)
  26. #define NF_ALE_OFFSET 0x00003000
  27. #define NF_ADDR_OFFSET 0x00002000
  28. #define NF_CMD_OFFSET 0x00001000
  29. #define NF_DATA_OFFSET 0x00000000
  30. /* NAND command */
  31. #define NAND_CMD_READ0 0x00
  32. #define NAND_CMD_READ1 0x01
  33. #define NAND_CMD_PAGEPROG 0x10
  34. #define NAND_CMD_READOOB 0x50
  35. #define NAND_CMD_ERASE1 0x60
  36. #define NAND_CMD_STATUS 0x70
  37. #define NAND_CMD_SEQIN 0x80
  38. #define NAND_CMD_READID 0x90
  39. #define NAND_CMD_READID1 0x91
  40. #define NAND_CMD_ERASE2 0xd0
  41. #define NAND_CMD_RESET 0xff
  42. #define FLASH_OK 0
  43. #define FLASH_NG 1
  44. /* nand flash device initialization */
  45. void rt_hw_nand_init(void);
  46. #endif