projects
/
calu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
bcc2ce2
)
dtprog: support for optional baudrate
author
Bernhard Urban
<lewurm@gmail.com>
Tue, 11 Jan 2011 23:59:27 +0000
(
00:59
+0100)
committer
Bernhard Urban
<lewurm@gmail.com>
Tue, 11 Jan 2011 23:59:27 +0000
(
00:59
+0100)
tools/dtprog.py
patch
|
blob
|
history
diff --git
a/tools/dtprog.py
b/tools/dtprog.py
index de4633bb0e4202110b797196b55c9a91964132af..f0917ac11120e70d06ca0b337aa5e405e8e132bf 100755
(executable)
--- a/
tools/dtprog.py
+++ b/
tools/dtprog.py
@@
-1,7
+1,7
@@
-#!/usr/bin/env python
+#!/usr/bin/env python
2
"""
Aufruf:
"""
Aufruf:
-./dtprog.py <dthexfile> [-d /dev/ttyXXX]
+./dtprog.py <dthexfile> [-d /dev/ttyXXX]
[-b <baudrate>]
bootROM, a very small bootloader for $NAME
bootROM, a very small bootloader for $NAME
@@
-32,7
+32,6
@@
value/cmd | direction | comment
import sys, time
from SerialPort_linux import SerialPort, SerialPortException
import sys, time
from SerialPort_linux import SerialPort, SerialPortException
-BAUDRATE = 9600
SPLIT = 30
class RAMSequence(object):
SPLIT = 30
class RAMSequence(object):
@@
-136,7
+135,8
@@
def usage(execf):
"""
print usage of dtprog
"""
"""
print usage of dtprog
"""
- print "Usage: " + execf + " <target dthex-file> [-d DEVICE]"
+ print "Usage: " + execf + " <target dthex-file> [-d DEVICE] [-b BAUDRATE]"
+ print "maybe arg-eval fail. fix the source!"
def main(argv=None):
"""
def main(argv=None):
"""
@@
-150,21
+150,32
@@
def main(argv=None):
print "Version: lulz"
return 0
print "Version: lulz"
return 0
- if len(argv) != 2 and len(argv) != 4:
+ if len(argv) != 2 and len(argv) != 4
and len(argv) != 6
:
usage(argv[0])
return 1
usage(argv[0])
return 1
+ # standard baudrate
+ baudrate = 9200
# standard serial device to communicate with
device = "/dev/ttyS0"
# standard serial device to communicate with
device = "/dev/ttyS0"
+ print "argv: ", argv
# overrule standard device if provided with -d
# overrule standard device if provided with -d
- if len(argv)
=
= 4:
+ if len(argv)
>
= 4:
if argv[2] == "-d":
device = argv[3]
else:
usage(argv[0])
return 1
if argv[2] == "-d":
device = argv[3]
else:
usage(argv[0])
return 1
+ # overrule standard baudrate if provided with -b
+ if len(argv) == 6:
+ if argv[4] == "-b":
+ baudrate = int(argv[5],10)
+ else:
+ usage(argv[0])
+ return 1
+
# read in data from mhx-files before starting
try:
ramseqs = readdthexfile(argv[1])
# read in data from mhx-files before starting
try:
ramseqs = readdthexfile(argv[1])
@@
-174,7
+185,7
@@
def main(argv=None):
print "Initializing serial port... (", device, ")"
global tty
print "Initializing serial port... (", device, ")"
global tty
- tty = SerialPort(device, 100,
BAUDRATE
)
+ tty = SerialPort(device, 100,
baudrate
)
while True:
tty.write('H')
while True:
tty.write('H')