Skip to content
Snippets Groups Projects
Commit 1f9b1586 authored by oharboe's avatar oharboe
Browse files

Dick Hollenbeck <dick@softplc.com> SVF to XSVF converter and the XSVF dumper take #2

git-svn-id: svn://svn.berlios.de/openocd/trunk@1304 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent 78d990e6
No related branches found
No related tags found
No related merge requests found
...@@ -365,8 +365,8 @@ shiftParts = ('TDI', 'TDO', 'MASK', 'SMASK') ...@@ -365,8 +365,8 @@ shiftParts = ('TDI', 'TDO', 'MASK', 'SMASK')
# the set of legal states which can trail the RUNTEST command # the set of legal states which can trail the RUNTEST command
run_state_allowed = ('IRPAUSE', 'DRPAUSE', 'RESET', 'IDLE') run_state_allowed = ('IRPAUSE', 'DRPAUSE', 'RESET', 'IDLE')
enddr_state_allowed = ('DRPAUSE', 'IDLE', 'RESET') enddr_state_allowed = ('DRPAUSE', 'IDLE')
endir_state_allowed = ('IRPAUSE', 'IDLE', 'RESET') endir_state_allowed = ('IRPAUSE', 'IDLE')
enddr_state = IDLE enddr_state = IDLE
endir_state = IDLE endir_state = IDLE
...@@ -617,7 +617,7 @@ try: ...@@ -617,7 +617,7 @@ try:
elif tokVal == 'ENDDR': elif tokVal == 'ENDDR':
nextTok() nextTok()
if tokVal not in enddr_state_allowed: if tokVal not in enddr_state_allowed:
raise ParseError( tokLn, tokVal, "Expecting 'stable_state' after ENDDR. (one of: DRPAUSE, IDLE, RESET)") raise ParseError( tokLn, tokVal, "Expecting 'stable_state' after ENDDR. (one of: DRPAUSE, IDLE)")
enddr_state = StateTxt.index(tokVal) enddr_state = StateTxt.index(tokVal)
nextTok() nextTok()
if tokVal != ';': if tokVal != ';':
...@@ -626,13 +626,16 @@ try: ...@@ -626,13 +626,16 @@ try:
writeComment( output, tokLn, 'ENDDR' ) writeComment( output, tokLn, 'ENDDR' )
obuf = bytearray(2) obuf = bytearray(2)
obuf[0] = XENDDR obuf[0] = XENDDR
obuf[1] = enddr_state # Page 10 of the March 1999 SVF spec shows that RESET is also allowed here.
# Yet the XSVF spec has no provision for that, and uses a non-standard, i.e.
# boolean argument to XENDDR which only handles two of the 3 intended states.
obuf[1] = 1 if enddr_state == DRPAUSE else 0
output.write( obuf ) output.write( obuf )
elif tokVal == 'ENDIR': elif tokVal == 'ENDIR':
nextTok() nextTok()
if tokVal not in endir_state_allowed: if tokVal not in endir_state_allowed:
raise ParseError( tokLn, tokVal, "Expecting 'stable_state' after ENDIR. (one of: IRPAUSE, IDLE, RESET)") raise ParseError( tokLn, tokVal, "Expecting 'stable_state' after ENDIR. (one of: IRPAUSE, IDLE)")
endir_state = StateTxt.index(tokVal) endir_state = StateTxt.index(tokVal)
nextTok() nextTok()
if tokVal != ';': if tokVal != ';':
...@@ -641,7 +644,10 @@ try: ...@@ -641,7 +644,10 @@ try:
writeComment( output, tokLn, 'ENDIR' ) writeComment( output, tokLn, 'ENDIR' )
obuf = bytearray(2) obuf = bytearray(2)
obuf[0] = XENDIR obuf[0] = XENDIR
obuf[1] = endir_state # Page 10 of the March 1999 SVF spec shows that RESET is also allowed here.
# Yet the XSVF spec has no provision for that, and uses a non-standard, i.e.
# boolean argument to XENDDR which only handles two of the 3 intended states.
obuf[1] = 1 if endir_state == IRPAUSE else 0
output.write( obuf ) output.write( obuf )
elif tokVal == 'STATE': elif tokVal == 'STATE':
......
...@@ -181,11 +181,11 @@ def ShowOpcode( op, f ): ...@@ -181,11 +181,11 @@ def ShowOpcode( op, f ):
elif op == XENDIR: elif op == XENDIR:
b = ReadByte( f ) b = ReadByte( f )
print("XENDIR %s" % ShowState(b)) print("XENDIR %s" % 'IRPAUSE' if b==1 else 'IDLE')
elif op == XENDDR: elif op == XENDDR:
b = ReadByte( f ) b = ReadByte( f )
print("XENDDR %s" % ShowState(b)) print("XENDDR %s" % 'DRPAUSE' if b==1 else 'IDLE')
elif op == XSIR2: elif op == XSIR2:
len = struct.unpack( '>H', f.read(2) )[0] len = struct.unpack( '>H', f.read(2) )[0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment