📄 nand.h
字号:
#include <bios/config.h>/* define NAND Flash ID */#define SAMSUNG 0xEC#if defined(CONFIG_BOOT_NAND_SIZE_8MB)#define K9F6408U0A 0xE6 /* 8 MByte */#define K9S6408V0A 0xE6 /* 8 MByte */#define DEVICE K9F6408U0A#define device_name "K9F6408U0A"#elif defined(CONFIG_BOOT_NAND_SIZE_16MB)#elif defined(CONFIG_BOOT_NAND_SIZE_32MB)#define K9S5608V0A 0x75 /* 32 MByte */#define DEVICE K9S5608V0A#define device_name "K9S5608U0A"#elif defined(CONFIG_BOOT_NAND_SIZE_64MB)#define K9S1208V0M 0x76 /* 64 MByte */#define DEVICE K9S1208V0M#define device_name "K9S1208V0M"#elif defined(CONFIG_BOOT_NAND_SIZE_128MB)#endif#define COMPANY SAMSUNG#define company_name "SAMSUNG"#if defined(CONFIG_BOOT_NAND_SIZE_8MB)/* * ----------------------------------------------- * K9F6408U0A Array Organization * 1 Page = 512+16 Bytes * 1 Block = 1Page * 16 = (8K + 256) Bytes * 1 Device = 1Block * 1024 = (8M + 256K) Bytes * ------------------------------------------------ */#define Page 512#define Block Page*16#define Device Block*1024#define max_block_size 0x400#elif defined(CONFIG_BOOT_NAND_SIZE_16MB)#elif defined(CONFIG_BOOT_NAND_SIZE_32MB)/* * ----------------------------------------------- * K9S5608V0A Array Organization * 1 Page = 512+16 Bytes * 1 Block = 1Page * 32 = (16K + 512) Bytes * 1 Device = 1Block * 2048 = (32M + 1024K) Bytes * ------------------------------------------------ */#define Page 512#define Block Page*32#define Device Block*2048#define max_block_size 0x800#elif defined(CONFIG_BOOT_NAND_SIZE_64MB)/* * ----------------------------------------------- * K9S1208V0M Array Organization * 1 Page = 512+16 Bytes * 1 Block = 1Page * 32 = (16K + 512) Bytes * 1 Device = 1Block * 4096 = (64M + 2048K) Bytes * ------------------------------------------------ */#define Page 512#define Block Page*32#define Device Block*4096#define max_block_size 0x1000#elif defined(CONFIG_BOOT_NAND_SIZE_128MB)#endifextern int nand_page_size;extern int nand_block_size;extern int nand_max_block;#if defined(CONFIG_BOOT_NAND_SIZE_8MB)/**************************************************************************//* Phy-offset, Block-num, Page-num *//* _______________ 0x0000000 0x000(0) 0x0 *//* flash0 (8KB) | boot bios | *//* |_______________|0x0002000 0x001(1) 0x0010 *//* flash1 (8KB) | SYSTEM CONF. | *//* |_______________|0x0004000 0x002(2) 0x0020 *//* | | *//* flash3(112KB)| real bios | *//* |_______________|0x0020000 0x010(16) 0x0100 *//* | | *//* flash2 (~1MB)| Comp. kernel | *//* |_______________|0x0100000 0x080(128) 0x0800 *//* | | *//* flash3 (4MB) | APPLICATION | *//* |(Comp. rom F/S)| *//* | | *//* |_______________|0x0500000 0x280(640) 0x2800 *//* | | *//* flash4 (64KB)| USER AREA. | mount to "/tmp" (EXT2 F/S) *//* |_______________|0x0510000 0x288(648) 0x2880 *//* | | *//* flash5 ~ NOT USED ~ (Reserved EXT2 FS) *//* | | *//* |_______________|0x0800000 0x400(1024) 0x4000 *//* *//**************************************************************************/#define NAND_BOOT_BLOCK (0x000)#define NAND_BOOT_SIZE (0x001) /* 8 KB */#define NAND_CONF_BLOCK (NAND_BOOT_BLOCK + NAND_BOOT_SIZE)#define NAND_CONF_SIZE (0x001) /* 8 KB */#define NAND_BIOS_BLOCK (NAND_CONF_BLOCK + NAND_CONF_SIZE)#define NAND_BIOS_SIZE (0x00E) /* 112 KB */#define NAND_KERNEL_BLOCK (NAND_BIOS_BLOCK + NAND_BIOS_SIZE)#define NAND_KERNEL_SIZE (0x070) /* 1 MB */#define NAND_APPS_BLOCK (NAND_KERNEL_BLOCK + NAND_KERNEL_SIZE)#define NAND_APPS_SIZE (0x200) /* 4 MB */#define NAND_USER_BLOCK (NAND_APPS_BLOCK + NAND_APPS_SIZE)#define NAND_USER_SIZE (0x008) /* 64 KB */#define NAND_FREE_BLOCK (NAND_USER_BLOCK + NAND_USER_SIZE)#define NAND_FREE_SIZE (max_block_size - NAND_FREE_BLOCK)#elif defined(CONFIG_BOOT_NAND_SIZE_16MB)#elif defined(CONFIG_BOOT_NAND_SIZE_32MB)/****************************************************************************//* Phy-offset, Block-num, Page-num *//* _______________ 0x0000000 0x000(0) 0x0000 *//* flash0 (16KB) | boot bios | *//* |_______________|0x0004000 0x001(1) 0x00020 *//* flash1 (16KB) | SYSTEM CONF. | *//* |_______________|0x0008000 0x002(2) 0x00040 *//* | | *//* flash3(112KB) | real bios | *//* |_______________|0x0024000 0x009(9) 0x00120 *//* | | *//* flash2 (~1MB) | Comp. kernel | *//* |_______________|0x0124000 0x049(73) 0x00920 *//* | | *//* flash3 (4MB) | APPLICATION | *//* |(Comp. rom F/S)| *//* | | *//* |_______________|0x0524000 0x149(329) 0x02920 *//* | | *//* flash4 (64KB) | USER AREA. | mount to "/tmp" (EXT2 F/S) *//* |_______________|0x0534000 0x14D(333) 0x029A0 *//* | | *//* flash5 (26MB) ~ NOT USED ~ (Reserved EXT2 FS) *//* | | *//* |_______________|0x2000000 0x800(2048) 0x10000 *//* *//****************************************************************************/#define NAND_BOOT_BLOCK (0x000)#define NAND_BOOT_SIZE (0x001) /* 16 KB */#define NAND_CONF_BLOCK (NAND_BOOT_BLOCK + NAND_BOOT_SIZE)#define NAND_CONF_SIZE (0x001) /* 16 KB */#define NAND_BIOS_BLOCK (NAND_CONF_BLOCK + NAND_CONF_SIZE)#define NAND_BIOS_SIZE (0x007) /* 112 KB */#define NAND_KERNEL_BLOCK (NAND_BIOS_BLOCK + NAND_BIOS_SIZE)#define NAND_KERNEL_SIZE (0x040) /* 1 MB */#define NAND_APPS_BLOCK (NAND_KERNEL_BLOCK + NAND_KERNEL_SIZE)#define NAND_APPS_SIZE (0x100) /* 4 MB */#define NAND_USER_BLOCK (NAND_APPS_BLOCK + NAND_APPS_SIZE)#define NAND_USER_SIZE (0x004) /* 64 KB */#define NAND_FREE_BLOCK (NAND_USER_BLOCK + NAND_USER_SIZE)#define NAND_FREE_SIZE (max_block_size - NAND_FREE_BLOCK)#elif defined(CONFIG_BOOT_NAND_SIZE_64MB)/****************************************************************************//* Phy-offset, Block-num, Page-num *//* _______________ 0x0000000 0x000(0) 0x0000 *//* flash0 (16KB) | boot bios | *//* |_______________|0x0004000 0x001(1) 0x00020 *//* flash1 (16KB) | SYSTEM CONF. | *//* |_______________|0x0008000 0x002(2) 0x00040 *//* | | *//* flash3(112KB) | real bios | *//* |_______________|0x0024000 0x009(9) 0x00120 *//* | | *//* flash2 (~1MB) | Comp. kernel | *//* |_______________|0x0124000 0x049(73) 0x00920 *//* | | *//* flash3 (4MB) | APPLICATION | *//* |(Comp. rom F/S)| *//* | | *//* |_______________|0x0524000 0x149(329) 0x02920 *//* | | *//* flash4 (64KB) | USER AREA. | mount to "/tmp" (EXT2 F/S) *//* |_______________|0x0510000 0x14D(333) 0x029A0 *//* | | *//* flash5 (61MB) ~ NOT USED ~ (Reserved EXT2 FS) *//* | | *//* |_______________|0x4000000 0x1000(4096) 0x20000 *//* *//****************************************************************************/#define NAND_BOOT_BLOCK (0x000)#define NAND_BOOT_SIZE (0x001) /* 16 KB */#define NAND_CONF_BLOCK (NAND_BOOT_BLOCK + NAND_BOOT_SIZE)#define NAND_CONF_SIZE (0x001) /* 16 KB */#define NAND_BIOS_BLOCK (NAND_CONF_BLOCK + NAND_CONF_SIZE)#define NAND_BIOS_SIZE (0x007) /* 112 KB */#define NAND_KERNEL_BLOCK (NAND_BIOS_BLOCK + NAND_BIOS_SIZE)#define NAND_KERNEL_SIZE (0x040) /* 1 MB */#define NAND_APPS_BLOCK (NAND_KERNEL_BLOCK + NAND_KERNEL_SIZE)#define NAND_APPS_SIZE (0x100) /* 4 MB */#define NAND_USER_BLOCK (NAND_APPS_BLOCK + NAND_APPS_SIZE)#define NAND_USER_SIZE (0x004) /* 64 KB */#define NAND_FREE_BLOCK (NAND_USER_BLOCK + NAND_USER_SIZE)#define NAND_FREE_SIZE (max_block_size - NAND_FREE_BLOCK)#elif defined(CONFIG_BOOT_NAND_SIZE_128MB)#endif#define nand_read (0x00)#define nand_write (0x01)#define nand_erase (0x02)extern int nand_flash_control(int, int, int, unsigned char *, int);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -