⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c2194.h

📁 Flash MLC Low Level Driver Source Code
💻 H
📖 第 1 页 / 共 2 页
字号:
   #define PAGE_DATA_SIZE        512            /* Page data size in byte */
   #define PAGE_SPARE_SIZE       16             /* Spare page size in byte */
   #define NUM_BLOCKS		     1024           /* Number of blocks in device*/
   #define HALF_PAGE_POINTER     (ubyte) 0x01   /* Half page Pointer */
   #define SHIFT_A8				 1
   typedef ubyte dataWidth;                     /* Flash data type */
#endif 


#ifdef NAND128RW4A
   #define FLASH_WIDTH           16             /* Flash data width */
   #define FLASH_SIZE            0x800000       /* Flash size in word */
   #define PAGE_SIZE             264            /* Page size in word */
   #define PAGE_DATA_SIZE        256            /* Page data size in word */
   #define PAGE_SPARE_SIZE       8              /* Spare page size in word */
   #define NUM_BLOCKS		     1024           /* Number of blocks in device*/
   #define HALF_PAGE_POINTER     (ubyte) 0x00   /* Half page Pointer */
   #define SHIFT_A8				 0
   typedef uword dataWidth;                     /* Flash data type */
#endif 


#ifdef NAND256RW3A
   #define FLASH_WIDTH           8              /* Flash data width */
   #define FLASH_SIZE            0x2000000      /* Flash size in byte */
   #define PAGE_SIZE             528            /* Page size  in byte */
   #define PAGE_DATA_SIZE        512            /* Page data size  in byte */
   #define PAGE_SPARE_SIZE       16             /* Spare page size in byte */
   #define NUM_BLOCKS		     2048           /*number of blocks in device*/
   #define HALF_PAGE_POINTER     (ubyte) 0x01   /* Half page Pointer */
   #define SHIFT_A8				 1
   typedef ubyte dataWidth;                     /* Flash data type */
#endif 


#ifdef NAND256RW4A
   #define FLASH_WIDTH           16             /* Flash data width */
   #define FLASH_SIZE            0x1000000      /* Flash size in word */
   #define PAGE_SIZE             264            /* Page size in word */
   #define PAGE_DATA_SIZE        256            /* Page data size  in word */
   #define PAGE_SPARE_SIZE       8              /* Spare page size in word */
   #define NUM_BLOCKS		     2048           /* Number of blocks in device*/
   #define HALF_PAGE_POINTER     (ubyte) 0x00   /* Half page Pointer */
   #define SHIFT_A8				 0
   typedef uword dataWidth;                     /* Flash data type */
#endif 


#ifdef NAND512RW3A
   #define FLASH_WIDTH           8              /* Flash data width */
   #define FLASH_SIZE            0x4000000      /* Flash size in byte */
   #define PAGE_SIZE             528            /* Page size in byte */ 
   #define PAGE_DATA_SIZE     	 512            /* Page data size in byte */
   #define PAGE_SPARE_SIZE       16             /* Spare page size in byte */
   #define NUM_BLOCKS		     4096           /* Number of blocks in device*/
   #define HALF_PAGE_POINTER     (ubyte) 0x01   /* Half page Pointer */
   #define SHIFT_A8				 1
   typedef ubyte dataWidth;                     /* Flash data type */
#endif 


#ifdef NAND512RW4A
   #define FLASH_WIDTH           16             /* Flash data width */
   #define FLASH_SIZE            0x2000000      /* Flash size in word */
   #define PAGE_SIZE             264            /* Page size in word */ 
   #define PAGE_DATA_SIZE        256            /* Page data size in word */
   #define PAGE_SPARE_SIZE       8              /* Spare page size in word */
   #define NUM_BLOCKS		     4096           /* Number of blocks in device*/
   #define HALF_PAGE_POINTER     (ubyte) 0x00   /* Half page Pointer */
   #define SHIFT_A8		 0
   typedef uword dataWidth;                     /* Flash data type */
#endif 


#ifdef NAND01GRW3A
   #define FLASH_WIDTH           8               /* Flash data width */
   #define FLASH_SIZE            0x8000000       /* Flash size in byte */
   #define PAGE_SIZE             528             /* Page size in byte */
   #define PAGE_DATA_SIZE        512             /* Page data size in byte */
   #define PAGE_SPARE_SIZE       16              /* Spare page size in byte */
   #define NUM_BLOCKS		     8192            /* Number of blocks in device*/
   #define HALF_PAGE_POINTER     (ubyte) 0x01    /* Half page Pointer */
   #define SHIFT_A8		 1
   typedef ubyte dataWidth;                     /* Flash data type */
#endif 


#ifdef NAND01GRW4A
   #define FLASH_WIDTH           16             /* Flash data width */
   #define FLASH_SIZE            0x4000000      /* Flash size in word */
   #define PAGE_SIZE             264            /* Page size in word */
   #define PAGE_DATA_SIZE        256            /* Page data size in word */
   #define NUM_BLOCKS		     8192           /* Number of blocks in device*/
   #define PAGE_SPARE_SIZE       8              /* Spare page size in word */
   #define HALF_PAGE_POINTER     (ubyte) 0x00   /* Half page Pointer */
   #define SHIFT_A8		 1
   typedef ubyte dataWidth;                     /* Flash data type */
#endif 






/*******************************************************************************
			                      Utility
*******************************************************************************/
#define ADDRESS_2_BLOCK(Address)        (Address >> (13+HALF_PAGE_POINTER)) 
#define BLOCK_SIZE 	                    (PAGE_DATA_SIZE*NUM_PAGE_BLOCK)
#define BLOCK_2_ADDRESS(Num_block)      ((udword) (Num_block* BLOCK_SIZE))
/****************************** Utility ***************************************/


/*******************************************************************************
                           HARDWARE DEPENDENT LAYER
                                Basic functions
*******************************************************************************/

void NAND_Open(void);
void NAND_CommandInput(ubyte ubCommand);    /* Put a command on bus */
void NAND_AddressInput(ubyte ubAddress);    /* Put an address on bus */
void NAND_DataInput(dataWidth ubData);      /* Write a data to flash */
dataWidth NAND_DataOutput(void);            /* Read a data from the flash */
void NAND_Close(void);                      /* Close the command after an */
                                            /* operation is completed. */

/*************************  HARDWARE DEPENDENT LAYER **************************/
                                


/*******************************************************************************
			                    Return Codes
*******************************************************************************/
typedef ubyte NAND_Ret;

#define NAND_PASS                  0x00 /* the operation on the NAND was
                                            successfully completed*/
#define NAND_FAIL                  0x01 /* the operation on the nand failed */
#define NAND_FLASH_SIZE_OVERFLOW   0x02 /* the address is not within the device*/
#define NAND_PAGE_OVERFLOW         0x04 /* attempt to access more than one page*/
#define NAND_WRONG_ADDRESS         0x08 /* the address is not */

/******************************  Return Codes *********************************/


/******************************************************************************
                           HARDWARE INDIPENDENT LAYER
                            Nand operation functions
******************************************************************************/                             
 
NAND_Ret NAND_BlockErase(udword udAddress);
          
NAND_Ret NAND_CopyBack(udword udSourceAddr,udword udDestinationAddr);

NAND_Ret NAND_PageRead(udword udAddress, dataWidth *Buffer, udword udlength);

NAND_Ret NAND_PageProgram(udword udAddress, dataWidth *Buffer, udword udlength);

NAND_Ret NAND_SpareProgram(udword udAddress, dataWidth *Buffer, udword udlength);

void NAND_ReadElectronicSignature(dataWidth *ubBuffer);

ubyte NAND_ReadStatusRegister(void);

void NAND_Reset(void);
                       
NAND_Ret NAND_SpareRead(udword udAddress, dataWidth *Buffer, udword udlength);

/************************ HARDWARE INDIPENDENT LAYER **************************/

#endif //__NAND512__H__






⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -