| | |
| | | |
| | | |
| | | #include "define_all.h" |
| | | #include "eeprom.h" |
| | | #include "e2p.h" |
| | | /***************************ÍⲿflashÈÝÁ¿µÈÐÅÏ¢¶¨Òå**********************************************/ |
| | | #define OUT_FLASH_ALL_SIZE 0x400000// 4194304=32Mbits |
| | | #define OUT_FLASH_PAGE_SIZE 256// һҳΪ256×Ö½Ú£¬×î´ó¿ÉÁ¬Ðø±à¼Ò»Ò³ |
| | |
| | | |
| | | |
| | | // 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 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_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 do{FLASH_CS_LOW;EEPROM_CS_HIGH;}while(0) |
| | | //#define FLASH_CS_DISABLE do{FLASH_CS_HIGH;EEPROM_CS_HIGH;}while(0) |
| | | |
| | | #define FLASH_CS_ENABLE do{GPIO_ResetBits(FLASH_CS_PORT,FLASH_CS_PIN);GPIO_SetBits(EEPROM_CS1_PORT,EEPROM_CS1_PIN);}while(0) |
| | | #define FLASH_CS_DISABLE do{GPIO_SetBits(FLASH_CS_PORT,FLASH_CS_PIN);GPIO_SetBits(EEPROM_CS1_PORT,EEPROM_CS1_PIN);}while(0) |
| | | #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 Out_Flash_MultipleRead(uint8* pBuffer,uint32 ReadAddr,uint16 NumByteToRead); |
| | | void Flash_Write_Page(uint8_t* pBuffer,u32 WriteAddr,u16 NumByteToWrite); |
| | | 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_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); |