#define FALSE 0
#define TRUE 1
#define SECTOR_SIZE 2048 // Must be 2048 words for 39VF640XB
#define BLOCK_SIZE 32768 // Must be 32K words for 39VF640XB
#define SST_ID 0x00BF // SST Manufacturer's ID code
#define SST_39VF6401B 0x236D // SST39VF6401B device code
#define SST_39VF6402B 0x236C // SST39VF6402B device code
typedef unsigned char BYTE; // BYTE is 8-bit in length
//typedef unsigned int WORD; // WORD is 16-bit in length
typedef unsigned short WORD; // WORD is 16-bit in length, ARM
//typedef unsigned long int Uint32; // Uint32 is 32-bit in length
typedef unsigned int Uint32; // Uint32 is 32-bit in length, ARM
//Uint32 system_base = 0x4000000; // 4GByte System Memory Address.
#define system_base 0x4000000
// This sample code uses 0x4000000 as the system_base address in ARM system.
// The user should modify this address accordingly.
//#define sysAddress(offset) ((volatile WORD *)(system_base + offset))
#define sysAddress(offset) ((volatile WORD *)(system_base + (((WORD)offset)<<1))) //For ARM CPU
#define MAX_TIMEOUT 0x07FFFFFF // A ceiling constant used by Check_Toggle_
// Ready() and Check_Data_Polling().
// The user should modify this constant accordingly.
// --------------------------------------------------------------------
// EXTERNAL ROUTINES
// --------------------------------------------------------------------
extern void Delay_10_Micro_Seconds();
extern void Delay_20_Micro_Seconds();
extern void Delay_150_Nano_Seconds();
extern void Delay_25_Milli_Seconds();
extern void Delay_50_Milli_Seconds();
// --------------------------------------------------------------------
int Check_SST_39VF640XB(void);
void CFI_Query(WORD*);
void SecID_Query(WORD*, WORD*);
int Erase_One_Sector(Uint32);
int Erase_One_Block (Uint32);
int Erase_Entire_Chip(void);
int Program_One_Word (WORD*, Uint32);
int Program_One_Sector (WORD*, Uint32);
int Program_One_Block (WORD *Src, Uint32 Dst);
int SecID_Lock_Status(void);
int User_SecID_Word_Program (WORD*, WORD*, int);
void User_SecID_Lock_Out (void);
void Erase_Suspend (void);
void Erase_Resume (void);
int Check_Toggle_Ready (Uint32);
int Check_Data_Polling (Uint32, WORD);
|