www.pudn.com > MPC8241BSP.rar > flash.h


/************************************************************************ 
ccm_flash.h 
Copyright 1999 by cdma 		all right reserved 
Author:            chenhong 
Date:              1999.9.13 
Description:       the head file of flash driver for CHM module  
Note:               
*************************************************************************/ 
 
#ifndef _FLASH_H 
#define _FLASH_H 
 
 
 
/**************************<< Common Defination >>***********************/ 
 
#define FLASH_UNIT_BYTE 		128*1024		/*128*2*1024    	 28F640J5 */  
/*#define FLASH_UNIT_WORD 		128*2*1024/4  	 28F640J5 */ 
#define FLASH_UNIT_UBYTE		128*1024 
#define FLASH_MASK 				0xfffe0000		/*0xfffc0000    	 mask 128k*2 byte block */ 
#define FLASH_DRV_SIZE 				64*128*1024		/*64*128*2*1024  	 28F640J5 */  
/*#define BUFFER_WORD_NUM 		16	*/			/* the word number in  
												   write buffer mode*//*16 ULONG*/ 
#define BUFFER_UBYTE_NUM 		16				/* the word number in  
												   write buffer mode*//*16 USHORT*/ 
#ifndef NULL  
#define NULL 					0 
#endif 
 
#ifndef ULONG 
#define ULONG unsigned long 
#endif 
 
#ifndef USHORT 
#define USHORT unsigned short 
#endif  
 
#ifndef UCHAR 
#define UCHAR unsigned char 
#endif  
 
 
					 
#define FLASH_BASE	/*0xFF000000*/0x70000000 
#define FLASH_OK	0 
#define FLASH_FAIL	-1 
 
/*The maximum time for wait SR.7 to 1(Ready)*/ 
#define FLASH_ERASE_CHIP_LOOP		0X4000000 
#define FLASH_ERASE_SECTOR_LOOP		0X4000000	 
#define FLASH_WRITE_LOOP			0X4000000 
 
 
/****************<< function prototypes >>******************************/ 
extern void FlashInit(void); 
extern int FlashEraseSector(ULONG Offset); 
 
extern int	FlashWrite(ULONG Offset, ULONG DataLen, UCHAR *BufAddr); 
extern int	FlashRead(ULONG Offset, ULONG DataLen, UCHAR *BufAddr); 
 
#endif