Mercurial > avr_jtag
comparison tests/identify.py @ 10:cc106f278d7d
Get identify of components
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Tue, 24 Feb 2009 13:32:04 +0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:705da39cdf91 | 10:cc106f278d7d |
---|---|
1 import sys | |
2 import os | |
3 import fcntl | |
4 import jtagdev | |
5 | |
6 if len(sys.argv) != 2: | |
7 print >>sys.stderr, 'Usage: %s <UART Port>' % (sys.argv[0]) | |
8 sys.exit(1) | |
9 uart_fname = sys.argv[1] | |
10 | |
11 try: | |
12 uart_fo = file(uart_fname, 'r+b') | |
13 except IOError, e: | |
14 print e | |
15 sys.exit(1) | |
16 pass | |
17 | |
18 flags = fcntl.fcntl(uart_fo, fcntl.F_GETFL) | |
19 fcntl.fcntl(uart_fo, fcntl.F_SETFL, os.O_NONBLOCK | flags) | |
20 | |
21 dev = jtagdev.jtagdev(uart_fo) | |
22 | |
23 print 'Reset:', | |
24 dev.reset() | |
25 reply = dev.wait_reply() | |
26 print reply | |
27 | |
28 print 'Go idle:', | |
29 dev.idle() | |
30 reply = dev.wait_reply() | |
31 print reply | |
32 | |
33 print 'Identify components:', | |
34 components = jtagdev.identify_components(dev) | |
35 for comp in components: | |
36 print '%08x' % (comp) | |
37 pass | |
38 |