annotate tests/identify.py @ 13:1ea479d26fce tip

Make sure shifting phase and add bypass.py. - shifting phase is started after entering SHIFT state Transition from CAP to SHIFT does not induce shifting. - shifting phase is stoped after leaving SHIFT state. Transition from SHIFT to EXIT1 also induce a bit of shifting.
author Thinker K.F. Li <thinker@branda.to>
date Wed, 25 Feb 2009 20:08:29 +0800
parents cc106f278d7d
children
rev   line source
10
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 import sys
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 import os
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3 import fcntl
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 import jtagdev
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 if len(sys.argv) != 2:
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7 print >>sys.stderr, 'Usage: %s <UART Port>' % (sys.argv[0])
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8 sys.exit(1)
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 uart_fname = sys.argv[1]
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11 try:
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 uart_fo = file(uart_fname, 'r+b')
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 except IOError, e:
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 print e
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15 sys.exit(1)
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 pass
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18 flags = fcntl.fcntl(uart_fo, fcntl.F_GETFL)
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19 fcntl.fcntl(uart_fo, fcntl.F_SETFL, os.O_NONBLOCK | flags)
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 dev = jtagdev.jtagdev(uart_fo)
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23 print 'Reset:',
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 dev.reset()
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25 reply = dev.wait_reply()
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 print reply
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 print 'Go idle:',
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 dev.idle()
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30 reply = dev.wait_reply()
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 print reply
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 print 'Identify components:',
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
34 components = jtagdev.identify_components(dev)
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
35 for comp in components:
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
36 print '%08x' % (comp)
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
37 pass
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
38