Go to the documentation of this file.00001 #ifndef __NAND_H__
00002 #define __NAND_H__
00003
00004 #include "types.h"
00005
00006 enum config {
00007 SECT_PER_PAGE = 8,
00008 PAGE_PER_BLK = 128,
00009 TOTALSIZE_GB = 32,
00010 EXTRABLKS = 1967
00011 };
00012
00013 struct config_nand {
00014 _u16 sect_per_page;
00015 _u16 page_per_blk;
00016 _u32 numblks;
00017
00018 _u32 totalsize;
00019 _u32 extrablks;
00020
00021 _u8 bit_sect_per_page;
00022 _u8 bit_page_per_blk;
00023 };
00024
00025 extern struct config_nand config_nand;
00026
00027 #define LPA_MASK_SECT (-config_nand.sect_per_page)
00028 #define LPA_F_SECT(sect) (((sect) & LPA_MASK_SECT) >> (config_nand.bit_sect_per_page))
00029 #define LSN_F_LPA(lpa) ((lpa)*config_nand.sect_per_page)
00030
00031
00032 enum { NAND_REQ_DATA=0,
00033 NAND_REQ_GC,
00034 NAND_REQ_WARM,
00035 };
00036
00037 int nand_open();
00038 void nand_close();
00039
00040 _t_sect nand_page_read(unsigned int blk_no, unsigned int page_no,
00041 unsigned int lsn, int optStat);
00042 void nand_page_write(unsigned int blk_no, unsigned int page_no,
00043 unsigned int lsn, int optStat);
00044 void nand_block_erase(unsigned int blk_no, int optStat);
00045
00046 #endif // __NAND_H__