1:
4g08是,512mb?,= 4096块,??? 每块64页,每页2048字节+16*4空闲区域,
?1208是 64mb,=?,4096块,每块32 页,每页512字节+16字节空闲区域
2:
4G08 每每个page有4个sector,一个块有256个sector,
1208,每个page有1个sector,但是软件上把8个块看成一个块,也就说,软件上把一个块看成256sector
?if ( astNandSpec[dwPrimaryNandDevice].nSctsPerPg == 4 )?// Primary NAND is Large Block...
?{
??wPRIMARY_NAND_BLOCKS = wPRIMARY_REAL_NAND_BLOCKS;
?}
?else
?{
??wPRIMARY_NAND_BLOCKS = wPRIMARY_REAL_NAND_BLOCKS / 8;
?}
?
3页地址偏移:
DWORD?? dwStartPage = blockID <<5;//块地址乘以32
DWORD?? dwPageID = blockID << 6;;//块地址乘以64
?
4相同点:
?? 都是划分sector地址,一个sector地址有512字节,
? 每次都是读写512字节
?
5空闲区域:
4g08的空闲区域如下:
typedef struct _SectorInfo
{
??? DWORD dwReserved1;????????????? // Reserved - used by FAL???? //第5-8个字节
??? BYTE? bOEMReserved;???????????? // For use by OEM??? //第二个字节
??? BYTE? bBadBlock;???????????? // Indicates if block is BAD??? 第一个字节,
??? WORD? wReserved2;?????????????? // Reserved - used by FAL?? //第三和第四个字节
???
}SectorInfo,*PSectorInfo
???? wrdata = (DWORD)(pInfo->bBadBlock) | (((DWORD)(pInfo->bOEMReserved) << 8)&0x0000ff00) | (((DWORD)(pInfo->wReserved2) << 16)&0xffff0000);
???? NF_DATA_W4( wrdata );
???? NF_DATA_W4( pInfo->dwReserved1 );
?
128的空闲区域如下:
typedef struct _SectorInfo
{
??? DWORD dwReserved1;????????????? // Reserved - used by FAL???? //第1-4个字节
??? BYTE? bOEMReserved;???????????? // For use by OEM??? //第5个字节
??? BYTE? bBadBlock;???????????? // Indicates if block is BAD??? 第6个字节,
??? WORD? wReserved2;?????????????? // Reserved - used by FAL?? //第7和第8个字节
???
}SectorInfo,*PSectorInfo
?
??? pInfo->dwReserved1? = NF_DATA_R4();
??? //? OEM byte
??? pInfo->bOEMReserved = (BYTE) NF_DATA_R();
??? //? Read the bad block mark
??? pInfo->bBadBlock = (BYTE) NF_DATA_R();
??? //? Second reserved field (WORD)
??? pInfo->wReserved2 = ((BYTE) NF_DATA_R() << 8);
??? pInfo->wReserved2 |= ((BYTE) NF_DATA_R());
?附录:
?
typedef struct
{
UINT16 nMID; /* Manufacturer ID */
UINT16 nDID; /* Device ID */
UINT16 nNumOfBlks; /* Number of Blocks */
UINT16 nPgsPerBlk; /* Number of Pages per block */
UINT16 nSctsPerPg; /* Number of Sectors per page */
UINT16 nNumOfPlanes; /* Number of Planes */
UINT16 nBlksInRsv; /* The Number of Blocks
in Reservior for Bad Blocks */
UINT8 nBadPos; /* BadBlock Information Poisition*/
UINT8 nLsnPos; /* LSN Position */
UINT8 nECCPos; /* ECC Policy : HW_ECC,SW_ECC */
UINT16 nBWidth; /* Nand Organization X8 or X16 */
UINT16 nTrTime; /* Typical Read Op Time */
UINT16 nTwTime; /* Typical Write Op Time */
UINT16 nTeTime; /* Typical Erase Op Time */
UINT16 nTfTime; /* Typical Transfer Op Time */
} S2440Spec;
static S2440Spec astNandSpec[] = {
/*************************************************************************/
/* nMID,nDID,*/
/* nNumOfBlks */
/* nPgsPerBlk */
/* nSctsPerPg */
/* nNumOfPlanes */
/* nBlksInRsv */
/* nBadPos */
/* nLsnPos */
/* nECCPos */
/* nBWidth */
/* nTrTime */
/* nTwTime */
/* nTeTime */
/* nTfTime*/
/*************************************************************************/
/* 8Gbit DDP NAND Flash */
{ 0xEC,0xD3,8192,64,4,2,160,8,BW_X08,50,350,2000,50},/* 4Gbit DDP NAND Flash */
{ 0xEC,0xAC,4096,80,{ 0xEC,0xDC,//{ 0xEC,0xBC,BW_X16,0xCC,/* 2Gbit NAND Flash */
{ 0xEC,0xAA,2048,1,40,0xDA,0xBA,0xCA,/* 2Gbit DDP NAND Flash */
{ 0xEC,/*1Gbit NAND Flash */
{ 0xEC,0xA1,1024,20,0xF1,0xB1,0xC1,/* 1Gbit NAND Flash */
{ 0xEC,0x79,32,120,5,6,0x78,0x74,11,0x72,/* 512Mbit NAND Flash */
//1208参数: 总块数为4096 每块页数32
// 每页sector数为1 总Planes 数:1,nBlksInRsv :4
{ 0xEC,0x76,70,0x36,0x56,0x46,/* 256Mbit NAND Flash */
{ 0xEC,0x75,35,0x35,0x55,0x45,/* 128Mbit NAND Flash */
{ 0xEC,0x73,0x33,0x53,0x43,{ 0x00,0x00,0}
};