| | |
| | | |
| | | |
| | | #include "define_all.h" |
| | | #include "eeprom.h" |
| | | #include "e2p.h" |
| | | /***************************ÍⲿflashÈÝÁ¿µÈÐÅÏ¢¶¨Òå**********************************************/ |
| | | #define OUT_FLASH_ALL_SIZE 0x400000//4*1024*1024=4194304MB=32Mbits |
| | | #define OUT_FLASH_ALL_SIZE 0x400000// 4194304=32Mbits |
| | | #define OUT_FLASH_PAGE_SIZE 256// һҳΪ256×Ö½Ú£¬×î´ó¿ÉÁ¬Ðø±à¼Ò»Ò³ |
| | | #define OUT_FLASH_SECTOR_SIZE 4096// Ò»¸öÉÈÇø4096×Ö½Ú£¬×îС²Á³ýµ¥Î»Îª1¸öÉÈÇø |
| | | // ÍⲿFLASH×Ô¶¨ÒåµÄ¿éÊýÁ¿ |
| | |
| | | |
| | | |
| | | // FlashƬѡ2 |
| | | #define FLASH_CS_PORT EEPROM_CS2_PORT |
| | | #define FLASH_CS_PIN EEPROM_CS2_PIN |
| | | #define FLASH_CS_PORT SPI0_CS_PORT |
| | | #define FLASH_CS_PIN SPI0_CS2_PIN |
| | | |
| | | #define FLASH_CS_LOW EEPROM_CS_2_LOW |
| | | #define FLASH_CS_HIGH EEPROM_CS_2_HIGH |
| | | #define FLASH_CS_LOW GPIO_ResetBits(FLASH_CS_PORT,FLASH_CS_PIN)//CS = 0 |
| | | #define FLASH_CS_HIGH GPIO_SetBits(FLASH_CS_PORT,FLASH_CS_PIN) //CS = 1 |
| | | |
| | | #define FLASH_CS_ENABLE EEPROM_CS_2_ENABLE |
| | | #define FLASH_CS_DISABLE EEPROM_CS_2_DISABLE |
| | | |
| | | |
| | | //¿ØÖÆÊ¹ÄÜ,flash²Ù×÷ǰºóµ÷Óà |
| | | #define OUT_FLASH_CTRL_ENABLE EEPROM_2_CTRL_ENABLE |
| | | #define OUT_FLASH_CTRL_DISABLE EEPROM_2_CTRL_DISABLE |
| | | |
| | | #define FLASH_CS_ENABLE do{FLASH_CS_LOW;E2P_CS1_H;}while(0) |
| | | #define FLASH_CS_DISABLE do{FLASH_CS_HIGH;E2P_CS1_H;}while(0) |
| | | |
| | | #define FLASH_ReadWriteByte(dat) SpiWriteAndRead(dat) |
| | | //#define FLASH_ioconfig() SPI2_ioconfig() |
| | | |
| | | uint8_t Flash_ReadSR(void); |
| | | void FLASH_Write_SR(uint8_t sr); |
| | | u8 Flash_ReadSR(void); |
| | | void FLASH_Write_SR(u8 sr); |
| | | void FLASH_Write_Enable(void); |
| | | void FLASH_Write_Disable(void); |
| | | u16 Flash_ReadID(void); |
| | | |
| | | |
| | | void Flash_Write_Page(uint8_t* pBuffer,u32 WriteAddr,u16 NumByteToWrite); |
| | | void Out_Flash_MultipleRead(uint8* pBuffer,uint32 ReadAddr,uint16 NumByteToRead); |
| | | void Flash_Write_Page(u8* pBuffer,u32 WriteAddr,u16 NumByteToWrite); |
| | | uint8 Flash_data_read(uint32 ReadAddr); |
| | | //void Flash_Write_NoCheck(uint8* pBuffer,uint32 WriteAddr,uint16 NumByteToWrite); |
| | | void Out_Flash_MultipleRead(uint8* pBuffer,uint32 ReadAddr,uint16 NumByteToRead); |
| | | void Out_Flash_MultipleWrite(uint8_t* pBuffer,u32 WriteAddr,u16 NumByteToWrite); |
| | | void Out_Flash_MultipleWrite(u8* pBuffer,u32 WriteAddr,u16 NumByteToWrite); |
| | | |
| | | void Flash_Erase_Chip(void); |
| | | void Flash_OUT_Erase_Sector(u32 Dst_Addr); |
| | |
| | | void Flash_PowerDown(void); |
| | | void Flash_WAKEUP(void); |
| | | |
| | | //float Flash_data_read_float(uint32 addr16); |
| | | //void Flash_data_write_float(uint32 addr16, float data) ; |
| | | //double Flash_data_read_double(uint32 addr16) ; |
| | | //void Flash_data_write_double(uint32 addr16, double data) ; |
| | | //u32 Flash_data_read_uint32(uint32 addr16) ; |
| | | //void Flash_data_write_uint32(uint32 addr16, uint32 data) ; |
| | | //u16 Flash_data_read_uint16(uint32 addr16) ; |
| | | //void Flash_data_write_uint16(uint32 addr16, uint16 data) ; |
| | | float Flash_data_read_float(uint32 addr16); |
| | | void Flash_data_write_float(uint32 addr16, float data) ; |
| | | double Flash_data_read_double(uint32 addr16) ; |
| | | void Flash_data_write_double(uint32 addr16, double data) ; |
| | | u32 Flash_data_read_uint32(uint32 addr16) ; |
| | | void Flash_data_write_uint32(uint32 addr16, uint32 data) ; |
| | | u16 Flash_data_read_uint16(uint32 addr16) ; |
| | | void Flash_data_write_uint16(uint32 addr16, uint16 data) ; |
| | | |
| | | |
| | | void OUT_FLASH_test(void); |