X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFET.py;h=27ea0e5e6cf794dbdcff7ab0d9e53d3dc130dfc0;hp=5236b040ef5d505d24281c4e160383fce8ea31f0;hb=5d5f93016a718c2cf7230dafbf967adcfe31a3b5;hpb=aa8eabc79a702874fbab60c6cad08c674344487b diff --git a/client/GoodFET.py b/client/GoodFET.py index 5236b04..27ea0e5 100755 --- a/client/GoodFET.py +++ b/client/GoodFET.py @@ -109,20 +109,34 @@ class GoodFET: #Debugging string; print, but wait. if self.app==0xFF and self.verb==0xFF: print "# DEBUG %s" % self.serialport.read(self.count); + sys.stdout.flush(); else: self.data=self.serialport.read(self.count); return self.data; #Glitching stuff. - def glitchAPP(self,app): + def glitchApp(self,app): """Glitch into a device by its application.""" self.data=[app&0xff]; self.writecmd(self.GLITCHAPP,0x80,1,self.data); #return ord(self.data[0]); - def glitchVERB(self,app,verb, data): - """Glitch during a transaction..""" + def glitchVerb(self,app,verb,data): + """Glitch during a transaction.""" + if data==None: data=[]; self.data=[app&0xff, verb&0xFF]+data; self.writecmd(self.GLITCHAPP,0x81,len(self.data),self.data); #return ord(self.data[0]); + def glitchstart(self): + """Glitch into the AVR application.""" + self.glitchVerb(self.APP,0x20,None); + def glitchstarttime(self): + """Measure the timer of the START verb.""" + return self.glitchTime(self.APP,0x20,None); + def glitchTime(self,app,verb,data): + """Time the execution of a verb.""" + if data==None: data=[]; + self.data=[app&0xff, verb&0xFF]+data; + self.writecmd(self.GLITCHAPP,0x82,len(self.data),self.data); + return ord(self.data[0])+(ord(self.data[1])<<8); def glitchVoltages(self,low=0x0880, high=0x0fff): """Set glitching voltages. (0x0fff is max.)""" self.data=[low&0xff, (low>>8)&0xff,