Skip to content

Commit

Permalink
Исправлена запись SPI флешек размером 128Mbit
Browse files Browse the repository at this point in the history
  • Loading branch information
nofeletru committed Nov 13, 2016
1 parent c4cb2ec commit 3cc0a3a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions software/main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ procedure WriteFlash25(var RomStream: TMemoryStream; StartAddress, WriteSize: ca
try

//Проверяем тип адресации 256+Mbit
if WriteSize > 16777215 then
if WriteSize > 16777216 then
begin
UsbAsp25_ReadSR(hUSBDev, sreg, $15);
if isBitSet(sreg, 0) then addr32bit4byte := true;
Expand Down Expand Up @@ -527,7 +527,7 @@ procedure WriteFlash25(var RomStream: TMemoryStream; StartAddress, WriteSize: ca
if WriteType = WT_PAGE then
begin

if WriteSize > 16777215 then //Память больше 128Мбит
if WriteSize > 16777216 then //Память больше 128Мбит
begin
if addr32bit4byte then //4 байтная адресация включена
BytesWrite := BytesWrite + UsbAsp25_Write32bitAddr(hUSBDev, $02, Address, datachunk, PageSize)
Expand All @@ -536,7 +536,7 @@ procedure WriteFlash25(var RomStream: TMemoryStream; StartAddress, WriteSize: ca
//3 байтовая адресация включена

//старший байт адреса
if Address > 16777215 then
if Address > 16777216 then
begin
UsbAsp25_WriteSR(hUSBDev, hi(hi(Address)), $c5);
UsbAsp25_WREN(hUSBDev);
Expand All @@ -561,7 +561,7 @@ procedure WriteFlash25(var RomStream: TMemoryStream; StartAddress, WriteSize: ca
if (MainForm.MenuAutoCheck.Checked) and (WriteType = WT_PAGE) then
begin

if WriteSize > 16777215 then
if WriteSize > 16777216 then
UsbAsp25_Read32bitAddr(hUSBDev, $13, Address, datachunk2, PageSize)
else
UsbAsp25_Read(hUSBDev, $03, Address, datachunk2, PageSize);
Expand Down Expand Up @@ -822,7 +822,7 @@ procedure ReadFlash25(var RomStream: TMemoryStream; StartAddress, ChipSize: card
begin
if ChunkSize > (ChipSize - Address) then ChunkSize := ChipSize - Address;

if ChipSize > 16777215 then
if ChipSize > 16777216 then
BytesRead := BytesRead + UsbAsp25_Read32bitAddr(hUSBDev, $13, Address, datachunk, ChunkSize)
else
BytesRead := BytesRead + UsbAsp25_Read(hUSBDev, $03, Address, datachunk, ChunkSize);
Expand Down Expand Up @@ -1034,7 +1034,7 @@ procedure VerifyFlash25(var RomStream: TMemoryStream; StartAddress, DataSize: ca
begin
if ChunkSize > (DataSize - Address) then ChunkSize := DataSize - Address;

if DataSize > 16777215 then
if DataSize > 16777216 then
BytesRead := BytesRead + UsbAsp25_Read32bitAddr(hUSBDev, $13, Address, datachunk, ChunkSize)
else
BytesRead := BytesRead + UsbAsp25_Read(hUSBDev, $03, Address, datachunk, ChunkSize);
Expand Down

0 comments on commit 3cc0a3a

Please sign in to comment.