URL
https://opencores.org/ocsvn/usb_dongle_fpga/usb_dongle_fpga/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 29 |
Rev 42 |
Line 932... |
Line 932... |
size = f.tell()
|
size = f.tell()
|
f.seek(0) #seek to start
|
f.seek(0) #seek to start
|
print 'File size %iK '%(size/1024)
|
print 'File size %iK '%(size/1024)
|
f.close()
|
f.close()
|
except IOError:
|
except IOError:
|
print "IO Error on file open"
|
print "IO Error on file open. File missing or no premission to open."
|
sys.exit()
|
sys.exit()
|
#clear blockLock bits
|
#clear blockLock bits
|
don.write_command(0x0060) # 0x0098
|
don.write_command(0x0060) # 0x0098
|
don.write_command(0x00D0) # 0x0098
|
don.write_command(0x00D0) # 0x0098
|
if mode.version < 5:
|
if mode.version < 5:
|
don.wait_on_busy()
|
don.wait_on_busy()
|
don.parse_status()
|
don.parse_status()
|
wordSize = (size+ (size&1))>> 1 # round byte count up and make word address
|
wordSize = (size+ (size&1))>> 1 # round byte count up and make word address
|
endBlock = don.get_block_no(mode.address+wordSize - 1)
|
endBlock = don.get_block_no(mode.address+wordSize - 1)
|
startBlock = don.get_block_no(mode.address)
|
startBlock = don.get_block_no(mode.address)
|
|
if endBlock > 32:
|
|
print "Given file does not fit into remaining space. File size is %i KB"%(size/1024)
|
|
print "Space left from given offset is %i KB"%((4*1024*1024-mode.address*2)/1024)
|
|
sys.exit()
|
i=startBlock
|
i=startBlock
|
print 'Erasing from block %i to %i '%(i,endBlock)
|
print 'Erasing from block %i to %i '%(i,endBlock)
|
while i <= endBlock:
|
while i <= endBlock:
|
if mode.v == 1:
|
if mode.v == 1:
|
print 'Erasing block %i '%(i)
|
print 'Erasing block %i '%(i)
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.