|
发表于 2006-4-12 07:04:36
|
显示全部楼层
点击此处下载armok01114386.rar
#define AT1M 0x3
#define AT2M 0x5
#define AT4M 0x7
#define AT8M 0x9
#define AT16M 0xB
#define AT32M 0xD
#define AT64M 0xF
#define AT128M 0x4
#define AT256M 0x6
#define AT512M 0x8
/*
Function : sets CS low to high and high to low
Arguments : none
Returns : none
*/
void AT45_Reset(void);
/*
Function : waits until memory is ready
Arguments : none
Returns : none
*/
void AT45_Ready(void);
/*
Function : detects type of dataflash
Arguments : none
Returns :
Hex Binary Device Density
0x3 0 0 1 1 1M
0x5 0 1 0 1 2M
0x7 0 1 1 1 4M
0x9 1 0 0 1 8M
0xB 1 0 1 1 16M
0xD 1 1 0 1 32M
0xF 1 1 1 1 64M
0x4 0 1 0 0 128M
0x6 0 1 1 0 256M
0x8 1 0 0 0 512M
*/
unsigned char AT45_DetectDevice(void);
/*
Function : reads dataflash memory
Arguments :
address 32bit (r,PA12-PA0,BA9-BA0)
r - reserved
PA12-PA0 - specify page to be read
BA9-BA0 - specify the starting byte address of page
pointer_ram - pointer to array to be written with data
n - number of bytes to be read
Returns : none
*/
void AT45_ContinousArrayRead(unsigned long address, unsigned char *pointer_ram ,unsigned long n);
/*
Function : writes buffer
Arguments :
buffer - has to be '1' or '2'
address - specify the address of first byte in buffer to be written
pointer_ram - pointer to array with data to be written
n - number of bytes to write
Returns : none
*/
void AT45_BufferWrite(unsigned char buffer, unsigned long address, unsigned char *pointer_ram ,unsigned long n);
/*
Function : reads buffer
Arguments : none
buffer - has to be '1' or '2'
address - specify the first byte in buffer to read
pointer_ram - pointer to array to be written with data
n - number of bytes to read
Returns : none
*/
void AT45_BufferRead(unsigned char buffer, unsigned long address, unsigned char *pointer_ram ,unsigned long n);
/*
Function : transfers data in buffer to main memory
Arguments :
erase - '1' transfers data with page erase, '0' transfers data without page erase
buffer - has to be '1' or '2'
address : PA12-PA0
PA12-PA0 - address of page in memory to be written
Returns : none
*/
void AT45_BufferToMainMemory(unsigned char erase, unsigned char buffer, unsigned long address);
/*
Function : programs main memory
Arguments :
buffer - has to be '1' or '2'
address 32bit (r,PA12-PA0,BA9-BA0)
r - reserved
PA12-PA0 - specify page to be written
BFA9-BFA0 - select the first byte in page to be written
pointer_ram - pointer to array with data to be written
n - number of bytes to write
Returns : none
*/
void AT45_MainMemoryProgram(unsigned char buffer, unsigned long address, unsigned char *pointer_ram ,unsigned long n);
/*
Function : transfers page from main memory to buffer
Arguments :
buffer - has to be '1' or '2'
address PA12-PA0
PA12-PA0 - specify page to transfer
Returns : none
*/
void AT45_MainMemoryToBufferTransfer(unsigned char buffer, unsigned long address);
/*
Function : compares buffer with selected page in main memory
Arguments :
buffer - has to be '1' or '2'
address PA12-PA0
PA12-PA0 - specify page to compare
Returns :
'1' - data in page MATCH data in buffer
'0' - data in page does NOT MATCH data in buffer
*/
unsigned char AT45_MainMemoryToBufferCompare(unsigned char buffer, unsigned long address);
/*
Function : rewrites contents in selected page
Arguments :
buffer - has to be '1' or '2'
address PA12-PA0
PA12-PA0 - specify page to be rewritten
Returns : none
*/
void AT45_AutoPageRewrite(unsigned char buffer, unsigned long address);
/*
Function : erase selected page
Arguments :
address PA12-PA0
PA12-PA0 - specify page to be erased
Returns : none
*/
void AT45_PageErase(unsigned long address);
/*
Function : erase selected block (8 pages)
Arguments :
address PA12-PA3
PA12-PA3 - specify block to be erased
Returns : none
*/
void AT45_BlockErase(unsigned long address); |
|