Line 38... |
Line 38... |
# USPP is allmost standard now (standard USPP would work)
|
# USPP is allmost standard now (standard USPP would work)
|
# Artec USPP has serial open retry
|
# Artec USPP has serial open retry
|
# 14 Nov. 2007 Improved help.
|
# 14 Nov. 2007 Improved help.
|
# 10 Mar. 2008 Forced code to hw flow control settings made linux 1 byte read to 2 bytes
|
# 10 Mar. 2008 Forced code to hw flow control settings made linux 1 byte read to 2 bytes
|
# as dongle never reads 1 byte at the time
|
# as dongle never reads 1 byte at the time
|
|
# 18 Apr. 2008 Added file size boundary check on write to see if remaining size from
|
|
# given offset fits the file size
|
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
|
|
import os
|
import os
|
import sys
|
import sys
|
import string
|
import string
|
Line 436... |
Line 438... |
#### Dongle code starts here ##################################################################
|
#### Dongle code starts here ##################################################################
|
|
|
|
|
#### global funcs ####
|
#### global funcs ####
|
def usage(s):
|
def usage(s):
|
print "Artec USB Dongle programming utility ver. 2.51"
|
print "Artec USB Dongle programming utility ver. 2.52"
|
print "Usage:"
|
print "Usage:"
|
print "Write file : ",s," [-vq] -c <name> <file> <offset>"
|
print "Write file : ",s," [-vq] -c <name> <file> <offset>"
|
print "Readback file : ",s," [-vq] -c <name> [-vq] -r <offset> <length> <file>"
|
print "Readback file : ",s," [-vq] -c <name> [-vq] -r <offset> <length> <file>"
|
print "Options:"
|
print "Options:"
|
print " <file> <offset> When file and offset are given file will be written to dongle"
|
print " <file> <offset> When file and offset are given file will be written to dongle"
|
Line 943... |
Line 945... |
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:
|
if endBlock >= 32:
|
print "Given file does not fit into remaining space. File size is %i KB"%(size/1024)
|
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)
|
print "Space left from given offset is %i KB"%((4*1024*1024-mode.address*2)/1024)
|
sys.exit()
|
sys.exit()
|
i=startBlock
|
i=startBlock
|
print 'Erasing from block %i to %i '%(i,endBlock)
|
print 'Erasing from block %i to %i '%(i,endBlock)
|