下面是一段loader的 代码
#define DEVICE_ID 0xCA
#define MAKER_ID 0x2C
#define NAND_TIMING_1 0x0D
#define NAND_TIMING_2 0x0D
#define BLOCK_SIZE 0x20000 // Expressed in Bytes
#define DATA_BYTES_PER_SECTOR 0x200 // Expressed in Bytes
#define SECTORS_PER_BLOCK 0x100 // Expressed in Bytes
#define SPARE_BYTES_PER_SECTOR 0x08 // Expressed in Bytes
#define BLOCK_TO_SECTOR_SHIFTER 0x8
1. DEVICE_ID 和 MAKER_ID 都会在 datasheet上写明
2. block 和page的关系,会在datasheet第一页有介绍:
• Organization
– Page size x8: 2112 bytes (2048 + 64 bytes)
– Page size x16: 1056 words (1024 + 32 words)
– Block size: 64 pages (128K + 4K bytes)
– Plane size: 2 planes x 1024 blocks per plane
– Device size: 2Gb: 2048 blocks