mirror of
https://github.com/LIV2/A4092-dev.git
synced 2025-12-06 00:32:49 +00:00
Fix verification code in a4092flash
This commit is contained in:
parent
24669ba584
commit
6048c860e7
@ -158,6 +158,21 @@ static UWORD flash_get_sectorSize(UBYTE manufacturer, UBYTE device) {
|
|||||||
return sectorSize;
|
return sectorSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** flash_readByte
|
||||||
|
*
|
||||||
|
* @brief Read a byte from Flash
|
||||||
|
* @param address Address to read from
|
||||||
|
* @return The data that was read
|
||||||
|
*/
|
||||||
|
UBYTE flash_readByte(ULONG address) {
|
||||||
|
// Mask address to ensure it is within the valid flash size.
|
||||||
|
address &= (FLASH_SIZE - 1);
|
||||||
|
|
||||||
|
return flash_read_byte(address);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** flash_writeByte
|
/** flash_writeByte
|
||||||
*
|
*
|
||||||
* @brief Write a byte to the Flash
|
* @brief Write a byte to the Flash
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
void flash_unlock_sdp();
|
void flash_unlock_sdp();
|
||||||
void flash_erase_chip();
|
void flash_erase_chip();
|
||||||
|
UBYTE flash_readByte(ULONG);
|
||||||
void flash_writeByte(ULONG, UBYTE);
|
void flash_writeByte(ULONG, UBYTE);
|
||||||
bool flash_init(UBYTE *, UBYTE *, ULONG *, UWORD *);
|
bool flash_init(UBYTE *, UBYTE *, ULONG *, UWORD *);
|
||||||
void flash_erase_sector(ULONG);
|
void flash_erase_sector(ULONG);
|
||||||
|
|||||||
@ -446,7 +446,7 @@ BOOL readFileToBuf(char *filename, void *buffer) {
|
|||||||
*/
|
*/
|
||||||
BOOL writeBufToFlash(struct scsiBoard *board, UBYTE *source, UBYTE *dest, ULONG size) {
|
BOOL writeBufToFlash(struct scsiBoard *board, UBYTE *source, UBYTE *dest, ULONG size) {
|
||||||
UBYTE *sourcePtr = NULL;
|
UBYTE *sourcePtr = NULL;
|
||||||
UBYTE *destPtr = NULL;
|
UBYTE destVal = 0;
|
||||||
|
|
||||||
int progress = 0;
|
int progress = 0;
|
||||||
int lastProgress = 1;
|
int lastProgress = 1;
|
||||||
@ -482,9 +482,9 @@ BOOL writeBufToFlash(struct scsiBoard *board, UBYTE *source, UBYTE *dest, ULONG
|
|||||||
lastProgress = progress;
|
lastProgress = progress;
|
||||||
}
|
}
|
||||||
sourcePtr = ((void *)source + i);
|
sourcePtr = ((void *)source + i);
|
||||||
destPtr = ((void *)dest + (i << 2));
|
destVal = flash_readByte(i);
|
||||||
if (*sourcePtr != *destPtr) {
|
if (*sourcePtr != destVal) {
|
||||||
printf("\nVerification failed at %06x - Expected %02X but read %02X\n",(int)destPtr,*sourcePtr,*destPtr);
|
printf("\nVerification failed at offset %06x - Expected %02X but read %02X\n",i,*sourcePtr,destVal);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user