mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
TO BE REVERTED: Temporary patch to make the w25x driver work with the revo m25p
chip. Need to abstract out the erase commands into a general pios_spi_flash driver.
This commit is contained in:
parent
8b7aca0dcd
commit
99123372d0
@ -18,9 +18,9 @@
|
||||
#define W25X_READ_DATA 0x03
|
||||
#define W25X_FAST_READ 0x0b
|
||||
#define W25X_DEVICE_ID 0x90
|
||||
#define W25X_SECTOR_ERASE 0x20
|
||||
#define W25X_SECTOR_ERASE 0xD8
|
||||
#define W25X_PAGE_WRITE 0x02
|
||||
#define W25X_CHIP_ERASE 0x60
|
||||
#define W25X_CHIP_ERASE 0xC7
|
||||
|
||||
#define W25X_STATUS_BUSY 0x01
|
||||
#define W25X_STATUS_WRITEPROTECT 0x02
|
||||
@ -144,10 +144,7 @@ int8_t PIOS_Flash_W25X_EraseSector(uint32_t addr)
|
||||
PIOS_SPI_TransferBlock(PIOS_SPI_FLASH,out,NULL,sizeof(out),NULL);
|
||||
PIOS_Flash_W25X_ReleaseBus();
|
||||
|
||||
uint32_t i = 1;
|
||||
while(PIOS_Flash_W25X_Busy()) {
|
||||
if(++i == 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -170,10 +167,7 @@ int8_t PIOS_Flash_W25X_EraseChip()
|
||||
PIOS_SPI_TransferBlock(PIOS_SPI_FLASH,out,NULL,sizeof(out),NULL);
|
||||
PIOS_Flash_W25X_ReleaseBus();
|
||||
|
||||
uint32_t i = 1;
|
||||
while(PIOS_Flash_W25X_Busy()) {
|
||||
if(++i == 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -216,10 +210,7 @@ int8_t PIOS_Flash_W25X_WriteData(uint32_t addr, uint8_t * data, uint16_t len)
|
||||
|
||||
PIOS_Flash_W25X_ReleaseBus();
|
||||
|
||||
uint32_t i = 1;
|
||||
while(PIOS_Flash_W25X_Busy()) {
|
||||
if(++i == 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -56,11 +56,11 @@ struct fileHeader {
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
#define OBJECT_TABLE_MAGIC 0x85FB3C35
|
||||
#define OBJECT_TABLE_MAGIC 0x85FB3C33
|
||||
#define OBJ_MAGIC 0x3015AE71
|
||||
#define OBJECT_TABLE_START 0x00000010
|
||||
#define OBJECT_TABLE_END 0x00001000
|
||||
#define SECTOR_SIZE 0x00001000
|
||||
#define OBJECT_TABLE_END 0x00010000
|
||||
#define SECTOR_SIZE 0x00010000
|
||||
#define MAX_BADMAGIC 1000
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user