+ smartrfpath="/opt/smartrf7";
+ def SRF_chipdom(self,chip="cc1110", doc="register_definition.xml"):
+ fn="%s/config/xml/%s/%s" % (self.smartrfpath,chip,doc);
+ print "Opening %s" % fn;
+ return xml.dom.minidom.parse(fn)
+ def CMDrs(self,args=[]):
+ """Chip command to grab the radio state."""
+ self.SRF_radiostate();
+ def SRF_radiostate(self):
+ ident=self.CCident();
+ chip=self.CCversions.get(ident&0xFF00);
+ dom=self.SRF_chipdom(chip,"register_definition.xml");
+ for e in dom.getElementsByTagName("registerdefinition"):
+ for f in e.childNodes:
+ if f.localName=="DeviceName":
+ print "// %s RadioState" % (f.childNodes[0].nodeValue);
+ elif f.localName=="Register":
+ name="unknownreg";
+ address="0xdead";
+ description="";
+ for g in f.childNodes:
+ if g.localName=="Name":
+ name=g.childNodes[0].nodeValue;
+ elif g.localName=="Address":
+ address=g.childNodes[0].nodeValue;
+ elif g.localName=="Description":
+ description=g.childNodes[0].nodeValue;
+ #print "SFRX(%10s, %s); /* %50s */" % (name,address, description);
+ print "%10s=0x%02x; /* %50s */" % (
+ name,self.CCpeekdatabyte(eval(address)), description);