X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFETAVR.py;h=46efed70d86c120f85d09e6283458017dfe99821;hp=97724ca9dc0b4c1884c869d829734f71e329c67d;hb=c8701c0a1cb2ab3a1a12ac24f17619575671df76;hpb=2d6cf1279657fb40d818675dd22923744ef178fc;ds=sidebyside diff --git a/client/GoodFETAVR.py b/client/GoodFETAVR.py index 97724ca..46efed7 100644 --- a/client/GoodFETAVR.py +++ b/client/GoodFETAVR.py @@ -59,10 +59,29 @@ class GoodFETAVR(GoodFET): def start(self): """Start the connection.""" self.writecmd(self.AVRAPP,0x20,0,None); - + def erase(self): + """Erase the target chip.""" + self.writecmd(self.AVRAPP,0xF0,0,None); + def lockbits(self): + """Read the target's lockbits.""" + self.writecmd(self.AVRAPP,0x82,0,None); + return ord(self.data[0]); + def eeprompeek(self, adr): + """Read a byte of the target's EEPROM.""" + self.writecmd(self.AVRAPP,0x81 ,2, + [ (adr&0xFF), (adr>>8)] + );#little-endian address + return ord(self.data[0]); + def eeprompoke(self, adr, val): + """Write a byte of the target's EEPROM.""" + self.writecmd(self.AVRAPP,0x91 ,3, + [ (adr&0xFF), (adr>>8), val] + );#little-endian address + return ord(self.data[0]); + def identstr(self): """Return an identifying string.""" - self.writecmd(self.AVRAPP,0x83,0,None); + self.writecmd(self.AVRAPP,0x83,0, None); vendor=self.AVRVendors.get(ord(self.data[0])); deviceid=(ord(self.data[1])<<8)+ord(self.data[2]); device=self.AVRDevices.get(deviceid);