From 1bbe7c29a95d160725815184e8db10055de5c0f4 Mon Sep 17 00:00:00 2001 From: dodge-this Date: Thu, 15 Nov 2012 05:18:37 +0000 Subject: [PATCH] yield instead of returning a list of values for ARMreadChunk. also, check out ARMreadStream and ARMwriteStream functions! way handy for dealing with strings and when you want to be byte-aligned, not 32-bit word aligned. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1336 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- client/GoodFETARM7.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/client/GoodFETARM7.py b/client/GoodFETARM7.py index 7596c60..f7f0b94 100644 --- a/client/GoodFETARM7.py +++ b/client/GoodFETARM7.py @@ -491,7 +491,8 @@ class GoodFETARM(GoodFET): self.ARM_nop( 0) # push nop into pipeline - execute self.ARMset_register(0, r0) return(val) - + + ''' def ARMreadMem(self, adr, wrdcount=1): retval = [] r0 = self.ARMget_register(0); # store R0 and R1 @@ -521,6 +522,7 @@ class GoodFETARM(GoodFET): self.ARMset_register(1, r1); # restore R0 and R1 self.ARMset_register(0, r0); return retval + ''' def ARMreadStream(self, addr, bytecount): baseaddr = addr & 0xfffffffc @@ -530,7 +532,7 @@ class GoodFETARM(GoodFET): out = [] - data = self.ARMreadChunk( baseaddr, ((endaddr-baseaddr) / 4) ) + data = [ x for x in self.ARMreadChunk( baseaddr, ((endaddr-baseaddr) / 4) ) ] #print data, hex(baseaddr), hex(diffstart), hex(endaddr), hex(diffend) if len(data) == 1: #print "single dword" @@ -551,7 +553,6 @@ class GoodFETARM(GoodFET): out.append( struct.pack(" 0): if (verbose and wordcount%64 == 0): sys.stderr.write(".") @@ -571,14 +572,17 @@ class GoodFETARM(GoodFET): #FIXME: do we need the extra nop here? self.ARMrestart() self.ARMwaitDBG() - output.extend([self.ARMget_register(x) for x in xrange(count)]) + for x in range(count): + yield self.ARMget_register(x) wordcount -= count adr += count*4 #print hex(adr) # FIXME: handle the rest of the wordcount here. self.ARMset_registers(regs,0xe) - return output + #return output + ARMreadMem = ARMreadChunk + peek = ARMreadMem '''def ARMreadStream(self, adr, bytecount): data = [struct.unpack(">sys.stderr,hex(self.ARMget_register(1)) self.ARMset_register(1, r1); # restore R0 and R1 self.ARMset_register(0, r0); + ''' + ARMwriteMem = ARMwriteChunk def ARMwriteStream(self, addr, datastr): #bytecount = len(datastr) -- 2.20.1