- bugfix: wrong number of available flash blocks

Committed on the Free edition of March Hare Software CVSNT Server.
Upgrade to CVS Suite for more features and support:
http://march-hare.com/cvsnt/


git-svn-id: http://moon:8086/svn/vhdl/trunk@543 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
2009-10-27 23:32:10 +00:00
parent 034f28a4f6
commit 8aa77da2b1
+7 -1
View File
@@ -91,7 +91,7 @@ UINT32 cfi_find(flash_t *pObj)
for (i=0; i < size; i++)
pObj->info.wbuf_size *= 2;
pObj->info.nblocks = pObj->info.num_flash * ((UINT32)(pF16[2*0x2E] << 8 | pF16[2*0x2D]) + 1);
pObj->info.nblocks = (UINT32)(pF16[2*0x2E] << 8 | pF16[2*0x2D]) + 1;
pObj->info.blocksize = pObj->info.num_flash * ((UINT32)(pF16[2*0x30] << 8 | pF16[2*0x2F]) * 256);
*pF = 0x00FF00FF;
@@ -345,6 +345,9 @@ UINT32 flash_erase(flash_t *pObj, UINT32 offset, UINT32 size)
int i;
UINT32 offset_end, error;
if (size % 4)
size = 4*(size/4 + 1);
offset_end = offset + size;
for (i=offset; i < offset_end; i += pObj->info.blocksize)
@@ -366,6 +369,9 @@ UINT32 flash_erase(flash_t *pObj, UINT32 offset, UINT32 size)
UINT32 flash_program(flash_t *pObj, UINT32 offset, UINT8 *pData, UINT32 size)
{
if (size % 4)
size = 4*(size/4 + 1);
return cfi_program_multi(pObj, offset/4, (UINT32*)pData, size/4);
}