Mercurial > avr_jtag
annotate tests/bypasstest.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 | |
children |
rev | line source |
---|---|
13
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
1 import sys |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
2 import os |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
3 import fcntl |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
4 import jtagdev |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
5 |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
6 if len(sys.argv) != 2: |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
7 print >>sys.stderr, 'Usage: %s <UART Port>' % (sys.argv[0]) |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
8 sys.exit(1) |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
9 uart_fname = sys.argv[1] |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
10 |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
11 try: |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
12 uart_fo = file(uart_fname, 'r+b') |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
13 except IOError, e: |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
14 print e |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
15 sys.exit(1) |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
16 pass |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
17 |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
18 flags = fcntl.fcntl(uart_fo, fcntl.F_GETFL) |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
19 fcntl.fcntl(uart_fo, fcntl.F_SETFL, os.O_NONBLOCK | flags) |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
20 |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
21 jtagdev.debug_frame = 1 |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
22 |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
23 dev = jtagdev.jtagdev(uart_fo) |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
24 |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
25 dev.reset() |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
26 dev.wait_reply() |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
27 |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
28 dev.idle(); |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
29 dev.wait_reply() |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
30 |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
31 dev.go_shift_IR() |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
32 dev.wait_reply() |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
33 |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
34 dev.shift_IR_n_out('\x0f', 4) |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
35 dev.wait_reply() |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
36 |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
37 dev.go_shift_DR() |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
38 dev.wait_reply() |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
39 |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
40 dev.shift_DR_n_out('\x01' * 128, 1024) |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
41 dev.wait_reply() |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
42 |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
43 dev.go_shift_DR() |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
44 dev.wait_reply() |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
45 |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
46 dev.shift_DR_n_out('\xff\xff', 16) |
1ea479d26fce
Make sure shifting phase and add bypass.py.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
47 dev.wait_reply() |