def store_attributes(self, attributes): ''' Store specific attributes from RAM into DSP EEPROM ''' xml = self.dsptk.generic_request(COMMAND_XML, COMMAND_XML_RESPONSE) if len(xml) == 0: print("can't retrieve XML file from server") sys.exit(1) xmlprofile = XmlProfile() xmlprofile.read_from_text(xml.decode("utf-8", errors="replace")) replace = {} for attribute in attributes: (addr, length) = xmlprofile.get_addr_length(attribute) if addr is None: continue while length > 0: data = self.dsptk.sigmatcp.read_data( addr, self.dsptk.dsp.WORD_LENGTH) replace[addr] = data addr += 1 length -= 1 xmlprofile.replace_eeprom_cells(replace) xmlprofile.replace_ram_cells(replace) self.write_back_xml(xmlprofile)
def store_attributes(self, attributes=None): ''' Store specific attributes from RAM into DSP EEPROM ''' xml = self.dsptk.generic_request(COMMAND_XML, COMMAND_XML_RESPONSE) if len(xml) == 0: print("can't retrieve XML file from server") sys.exit(1) xmlprofile = XmlProfile() xmlprofile.read_from_text(xml.decode("utf-8", errors="replace")) replace = {} if attributes is None: print("checking attribute tags from XML profile") attributes = xmlprofile.get_storable_registers() if len(attributes) == 0: print("no storable attributes found in XML, using default set") attributes = REGISTER_ATTRIBUTES for attribute in attributes: (addr, length) = xmlprofile.get_addr_length(attribute) if addr is None: continue while length > 0: data = self.dsptk.sigmatcp.read_data(addr, self.dsptk.dsp.WORD_LENGTH) replace[addr] = data addr += 1 length -= 1 print("storing {}".format(attribute)) xmlprofile.replace_eeprom_cells(replace) xmlprofile.replace_ram_cells(replace) self.write_back_xml(xmlprofile)