# HG changeset patch # User lbessard # Date 1189610187 -7200 # Node ID 2721e6910f5a29980e459c92877077ebdfceab4c # Parent 59b84ab7bf8b175ab71d65a00cf024fede355b7f config_utils.py rewritten Test to check config_utils added diff -r 59b84ab7bf8b -r 2721e6910f5a plugins/canfestival/config_utils.py --- a/plugins/canfestival/config_utils.py Tue Sep 11 17:29:27 2007 +0200 +++ b/plugins/canfestival/config_utils.py Wed Sep 12 17:16:27 2007 +0200 @@ -25,22 +25,24 @@ from types import * # Translation between IEC types and Can Open types -DicoTypes = {"BOOL":0x01, "SINT":0x02, "INT":0x03,"DINT":0x04,"LINT":0x10, - "USINT":0x05,"UINT":0x06,"UDINT":0x07,"ULINT":0x1B,"REAL":0x08, - "LREAL":0x11,"STRING":0x09,"BYTE":0x05,"WORD":0x06,"DWORD":0x07, - "LWORD":0x1B,"WSTRING":0x0B} - -DictNameVariable = { "" : 1, "X": 2, "B": 3, "W": 4, "D": 5, "L": 6, "increment": 0x100, 1:("__I", 0x2000), 2:("__Q", 0x4000)} +IECToCOType = {"BOOL":0x01, "SINT":0x02, "INT":0x03,"DINT":0x04,"LINT":0x10, + "USINT":0x05,"UINT":0x06,"UDINT":0x07,"ULINT":0x1B,"REAL":0x08, + "LREAL":0x11,"STRING":0x09,"BYTE":0x05,"WORD":0x06,"DWORD":0x07, + "LWORD":0x1B,"WSTRING":0x0B} # Constants for PDO types RPDO = 1 TPDO = 2 + SlavePDOType = {"I" : TPDO, "Q" : RPDO} InvertPDOType = {RPDO : TPDO, TPDO : RPDO} -GenerateMasterMapping = lambda x:[None] + [(loc_infos["type"], name) for name, loc_infos in x] - -TrashVariableSizes = {1 : 0x01, 8 : 0x05, 16 : 0x06, 32 : 0x07, 64 : 0x1B} +VariableIncrement = 0x100 +VariableStartIndex = {TPDO : 0x2000, RPDO : 0x4000} +VariableDirText = {TPDO : "__I", RPDO : "__Q"} +VariableTypeOffset = dict(zip(["","X","B","W","D","L"], range(6))) + +TrashVariables = [(1, 0x01), (8, 0x05), (16, 0x06), (32, 0x07), (64, 0x1B)] def LE_to_BE(value, size): """ @@ -55,6 +57,7 @@ list_car.reverse() return "".join([chr(int(car, 16)) for car in list_car]) + def GetNodePDOIndexes(node, type, parameters = False): """ Find the PDO indexes of a node @@ -74,6 +77,7 @@ else: return indexes + def SearchNodePDOMapping(loc_infos, node): """ Find the PDO indexes of a node @@ -94,26 +98,53 @@ return PDOidx, subindex return None + +def GeneratePDOMappingDCF(idx, cobid, transmittype, pdomapping): + """ + Build concise DCF value for configuring a PDO + @param idx: index of PDO parameters + @param cobid: PDO generated COB ID + @param transmittype : PDO transmit type + @param pdomapping: list of PDO mappings + @return: a tuple of value and number of parameters to add to DCF + """ + + # Create entry for RPDO or TPDO parameters and Disable PDO + dcfdata = LE_to_BE(idx, 2) + LE_to_BE(0x01, 1) + LE_to_BE(0x04, 4) + LE_to_BE((0x80000000 + cobid), 4) + # Set Transmit type synchrone + dcfdata += LE_to_BE(idx, 2) + LE_to_BE(0x02, 1) + LE_to_BE(0x01, 4) + LE_to_BE(transmittype, 1) + # Re-Enable PDO + # ---- INDEX ----- --- SUBINDEX ---- ----- SIZE ------ ------ DATA ------ + dcfdata += LE_to_BE(idx, 2) + LE_to_BE(0x01, 1) + LE_to_BE(0x04, 4) + LE_to_BE(0x00000000 + cobid, 4) + nbparams = 3 + # Map Variables + for subindex, (name, loc_infos) in enumerate(pdomapping): + value = (loc_infos["index"] << 16) + (loc_infos["subindex"] << 8) + loc_infos["size"] + dcfdata += LE_to_BE(idx + 0x200, 2) + LE_to_BE(subindex + 1, 1) + LE_to_BE(0x04, 4) + LE_to_BE(value, 4) + nbparams += 1 + return dcfdata, nbparams + class ConciseDCFGenerator: def __init__(self, nodelist): # Dictionary of location informations classed by name - self.DictLocations = {} + self.IECLocations = {} + # Dictionary of location that have not been mapped yet + self.LocationsNotMapped = {} # Dictionary of location informations classed by name - self.DictCobID = {} - # Dictionary of location that have not been mapped yet - self.DictLocationsNotMapped = {} + self.MasterMapping = {} # List of COB IDs available self.ListCobIDAvailable = range(0x180, 0x580) self.SlavesPdoNumber = {} # Dictionary of mapping value where unexpected variables are stored - TrashVariableValue = {} + self.TrashVariables = {} self.NodeList = nodelist self.Manager = self.NodeList.Manager self.MasterNode = self.Manager.GetCurrentNodeCopy() self.PrepareMasterNode() + def RemoveUsedNodeCobId(self, node): """ Remove all PDO COB ID used by the given node from the list of available COB ID @@ -137,6 +168,7 @@ return len(nodeRpdoIndexes), len(nodeTpdoIndexes) + def PrepareMasterNode(self): """ Add mandatory entries for DCF generation into MasterNode. @@ -145,18 +177,18 @@ # Adding DCF entry into Master node if not self.MasterNode.IsEntry(0x1F22): self.MasterNode.AddEntry(0x1F22, 1, "") - self.Manager.AddSubentriesToCurrent(0x1F22, 127, masternode) + self.Manager.AddSubentriesToCurrent(0x1F22, 127, self.MasterNode) # Adding trash mappable variables for unused mapped datas - idxTrashVariables = 0x2000 + masternode.GetNodeID() + idxTrashVariables = 0x2000 + self.MasterNode.GetNodeID() # Add an entry for storing unexpected all variable - self.Manager.AddMapVariableToCurrent(idxTrashVariables, "trashvariables", 3, len(TrashVariableSizes), self.MasterNode) - for subidx, (size, typeidx) in enumerate(TrashVariableSizes.items()): + self.Manager.AddMapVariableToCurrent(idxTrashVariables, "trashvariables", 3, len(TrashVariables), self.MasterNode) + for subidx, (size, typeidx) in enumerate(TrashVariables): # Add a subentry for storing unexpected variable of this size self.Manager.SetCurrentEntry(idxTrashVariables, subidx + 1, "TRASH%d" % size, "name", None, self.MasterNode) self.Manager.SetCurrentEntry(idxTrashVariables, subidx + 1, typeidx, "type", None, self.MasterNode) # Store the mapping value for this entry - self.TrashVariableValue[size] = (idxTrashVariables << 16) + ((subidx + 1) << 8) + size + self.TrashVariables[size] = (idxTrashVariables << 16) + ((subidx + 1) << 8) + size RPDOnumber, TPDOnumber = self.RemoveUsedNodeCobId(self.MasterNode) @@ -164,7 +196,7 @@ self.CurrentPDOParamsIdx = {RPDO : 0x1400 + RPDOnumber, TPDO : 0x1800 + TPDOnumber} # Prepare MasterNode with all nodelist slaves - for nodeid, nodeinfos in self.NodeList.SlaveNodes.items(): + for idx, (nodeid, nodeinfos) in enumerate(self.NodeList.SlaveNodes.items()): node = nodeinfos["Node"] node.SetNodeID(nodeid) @@ -182,41 +214,23 @@ TSDO_cobid = 0x580 + nodeid # Configure Master's SDO parameters entries - self.Manager.ManageEntriesOfCurrent([0x1280 + nodeid], [], self.MasterNode) - self.MasterNode.SetEntry(0x1280 + nodeid, 0x01, RSDO_cobid) - self.MasterNode.SetEntry(0x1280 + nodeid, 0x02, TSDO_cobid) - self.MasterNode.SetEntry(0x1280 + nodeid, 0x03, nodeid) - + self.Manager.ManageEntriesOfCurrent([0x1280 + idx], [], self.MasterNode) + self.MasterNode.SetEntry(0x1280 + idx, 0x01, RSDO_cobid) + self.MasterNode.SetEntry(0x1280 + idx, 0x02, TSDO_cobid) + self.MasterNode.SetEntry(0x1280 + idx, 0x03, nodeid) + + def GetMasterNode(self): """ Return MasterNode. """ return self.MasterNode - # Build concise DCF - def GenerateMappingDCF(cobid, idx, pdomapping, mapped): - - # Create entry for RPDO or TPDO parameters and Disable PDO - dcfdata = LE_to_BE(idx, 2) + LE_to_BE(0x01, 1) + LE_to_BE(0x04, 4) + LE_to_BE((0x80000000 + cobid), 4) - # Set Transmit type synchrone - dcfdata += LE_to_BE(idx, 2) + LE_to_BE(0x02, 1) + LE_to_BE(0x01, 4) + LE_to_BE(DefaultTransmitTypeSlave, 1) - # Re-Enable PDO - # ---- INDEX ----- --- SUBINDEX ---- ----- SIZE ------ ------ DATA ------ - dcfdata += LE_to_BE(idx, 2) + LE_to_BE(0x01, 1) + LE_to_BE(0x04, 4) + LE_to_BE(0x00000000 + cobid, 4) - nbparams = 3 - if mapped == False and pdomapping != None: - # Map Variables - for subindex, (name, loc_infos) in enumerate(pdomapping): - value = (loc_infos["index"] << 16) + (loc_infos["subindex"] << 8) + loc_infos["size"] - dcfdata += LE_to_BE(idx + 0x200, 2) + LE_to_BE(subindex + 1, 1) + LE_to_BE(0x04, 4) + LE_to_BE(value, 4) - nbparams += 1 - return dcfdata, nbparams - - # Return a cobid not used + def GetNewCobID(self, nodeid, type): """ Select a COB ID from the list of those available - @param nodeid: id of the slave node + @param nodeid: id of the slave (int) @param type: type of PDO (RPDO or TPDO) @return: a tuple of the COD ID and PDO index or None """ @@ -249,7 +263,56 @@ return self.ListCobIDAvailable.pop(0), 0x1800 + nbSlavePDO return None - + + + def AddParamsToDCF(self, nodeid, data, nbparams): + """ + Select a COB ID from the list of those available + @param nodeid: id of the slave (int) + @param data: data to add to slave DCF (string) + @param nbparams: number of params added to slave DCF (int) + """ + # Get current DCF for slave + nodeDCF = self.MasterNode.GetEntry(0x1F22, nodeid) + + # Extract data and number of params in current DCF + if nodeDCF != None and nodeDCF != '': + tmpnbparams = [i for i in nodeDCF[:4]] + tmpnbparams.reverse() + nbparams += int(''.join(["%2.2x"%ord(i) for i in tmpnbparams]), 16) + data = nodeDCF[4:] + data + + # Build new DCF + dcf = LE_to_BE(nbparams, 0x04) + data + # Set new DCF for slave + self.MasterNode.SetEntry(0x1F22, nodeid, dcf) + + def AddPDOMapping(self, nodeid, pdotype, pdomapping, sync_TPDOs): + """ + Select a COB ID from the list of those available + @param nodeid: id of the slave (int) + @param pdotype: type of PDO to generated (RPDO or TPDO) + @param pdomapping: list od variables to map with PDO + """ + # Get a new cob id + result = self.GetNewCobID(nodeid, pdotype) + if result: + new_cobid, new_idx = result + + # Increment the number of PDO of this type for node + self.SlavesPdoNumber[nodeid][pdotype] += 1 + + # Add an entry to MasterMapping + self.MasterMapping[new_cobid] = {"type" : InvertPDOType[pdotype], + "mapping" : [None] + [(loc_infos["type"], name) for name, loc_infos in pdomapping]} + + # Return the data to add to DCF + if sync_TPDOs: + return GeneratePDOMappingDCF(new_idx, new_cobid, 0x01, pdomapping) + else: + return GeneratePDOMappingDCF(new_idx, new_cobid, 0xFF, pdomapping) + return 0, "" + def GenerateDCF(self, locations, current_location, sync_TPDOs): """ Generate Concise DCF of MasterNode for the locations list given @@ -258,12 +321,12 @@ @param sync_TPDOs: indicate if TPDO must be synchronous """ - # Get list of locations check if exists and mappables -> put them in DictLocations + # Get list of locations check if exists and mappables -> put them in IECLocations for location in locations: - COlocationtype = DicoTypes[location["IEC_TYPE"]] + COlocationtype = IECToCOType[location["IEC_TYPE"]] name = location["NAME"] - if name in DictLocations: - if DictLocations[name]["type"] != COlocationtype: + if name in self.IECLocations: + if self.IECLocations[name]["type"] != COlocationtype: raise ValueError, "Conflict type for location \"%s\"" % name else: # Get only the part of the location that concern this node @@ -280,11 +343,11 @@ nodeid, index, subindex = loc[:3] # Check Id is in slave node list - if nodeid not in nodelist.SlaveNodes.keys(): + if nodeid not in self.NodeList.SlaveNodes.keys(): raise ValueError, "Non existing node ID : %d (variable %s)" % (nodeid,name) # Get the model for this node (made from EDS) - node = nodelist.SlaveNodes[nodeid]["Node"] + node = self.NodeList.SlaveNodes[nodeid]["Node"] # Extract and check index and subindex if not node.IsEntry(index, subindex): @@ -307,72 +370,69 @@ raise ValueError, "Invalid type \"%s\"-> %d != %d for location\"%s\"" % (location["IEC_TYPE"], COlocationtype, entryinfos["type"] , name) typeinfos = node.GetEntryInfos(COlocationtype) - DictLocations[name] = {"type":COlocationtype, "pdotype":SlavePDOType[direction], - "nodeid": nodeid, "index": index,"subindex": subindex, - "bit": numbit, "size": typeinfos["size"], "sizelocation": sizelocation} + self.IECLocations[name] = {"type":COlocationtype, "pdotype":SlavePDOType[direction], + "nodeid": nodeid, "index": index,"subindex": subindex, + "bit": numbit, "size": typeinfos["size"], "sizelocation": sizelocation} else: raise ValueError, "Not PDO mappable variable : '%s' (ID:%d,Idx:%x,sIdx:%x))" % (name,nodeid,index,subindex) - - # Create DictCobID with variables already mapped and add them in DictValidLocations - for name, locationinfos in DictLocations.items(): + + #------------------------------------------------------------------------------- + # Search for locations already mapped + #------------------------------------------------------------------------------- + + for name, locationinfos in self.IECLocations.items(): node = self.NodeList.SlaveNodes[locationinfos["nodeid"]]["Node"] + + # Search if slave has a PDO mapping this locations result = SearchNodePDOMapping(locationinfos, node) if result != None: index, subindex = result - cobid = nodelist.GetSlaveNodeEntry(locationinfos["nodeid"], index - 0x200, 1) - - transmittype = nodelist.GetSlaveNodeEntry(locationinfos["nodeid"], index - 0x200, 2) - - if transmittype != sync_TPDOs: - if sync_TPDOs : # Change TransmitType to ASYCHRONE - node = nodelist.SlaveNodes[nodeid]["Node"] - nodeDCF = masternode.GetEntry(0x1F22, nodeid) - - if nodeDCF != None and nodeDCF != '': - tmpnbparams = [i for i in nodeDCF[:4]] - tmpnbparams.reverse() - nbparams = int(''.join(["%2.2x"%ord(i) for i in tmpnbparams]), 16) - dataparams = nodeDCF[4:] - else: - nbparams = 0 - dataparams = "" + # Get COB ID of the PDO + cobid = self.NodeList.GetSlaveNodeEntry(locationinfos["nodeid"], index - 0x200, 1) + + # Verify that PDO transmit type is conform to sync_TPDOs + transmittype = self.NodeList.GetSlaveNodeEntry(locationinfos["nodeid"], index - 0x200, 2) + if sync_TPDOs and transmittype != 0x01 or transmittype != 0xFF: + if sync_TPDOs: + # Change TransmitType to SYNCHRONE + data, nbparams = GeneratePDOMappingDCF(index - 0x200, cobid, 0x01, []) + else: + # Change TransmitType to ASYCHRONE + data, nbparams = GeneratePDOMappingDCF(index - 0x200, cobid, 0xFF, []) - else: # Change TransmitType to SYNCHRONE - pass - - - if cobid not in DictCobID.keys(): + # Add entry to slave dcf to change transmit type of + self.AddParamsToDCF(locationinfos["nodeid"], data, nbparams) + + # Add PDO to MasterMapping + if cobid not in self.MasterMapping.keys(): mapping = [None] values = node.GetEntry(index) + # Store the size of each entry mapped in PDO for value in values[1:]: mapping.append(value % 0x100) - DictCobID[cobid] = {"type" : InvertPDOType[locationinfos["pdotype"]], "mapping" : mapping} - - DictCobID[cobid]["mapping"][subindex] = (locationinfos["type"], name) + self.MasterMapping[cobid] = {"type" : InvertPDOType[locationinfos["pdotype"]], "mapping" : mapping} + + # Indicate that this PDO entry must be saved + self.MasterMapping[cobid]["mapping"][subindex] = (locationinfos["type"], name) else: - if locationinfos["nodeid"] not in DictLocationsNotMapped.keys(): - DictLocationsNotMapped[locationinfos["nodeid"]] = {TPDO : [], RPDO : []} - DictLocationsNotMapped[locationinfos["nodeid"]][locationinfos["pdotype"]].append((name, locationinfos)) + # Add location to those that haven't been mapped yet + if locationinfos["nodeid"] not in self.LocationsNotMapped.keys(): + self.LocationsNotMapped[locationinfos["nodeid"]] = {TPDO : [], RPDO : []} + self.LocationsNotMapped[locationinfos["nodeid"]][locationinfos["pdotype"]].append((name, locationinfos)) #------------------------------------------------------------------------------- # Build concise DCF for the others locations #------------------------------------------------------------------------------- - for nodeid, locations in DictLocationsNotMapped.items(): - # Get current concise DCF + for nodeid, locations in self.LocationsNotMapped.items(): node = nodelist.SlaveNodes[nodeid]["Node"] - nodeDCF = masternode.GetEntry(0x1F22, nodeid) - - if nodeDCF != None and nodeDCF != '': - tmpnbparams = [i for i in nodeDCF[:4]] - tmpnbparams.reverse() - nbparams = int(''.join(["%2.2x"%ord(i) for i in tmpnbparams]), 16) - dataparams = nodeDCF[4:] - else: - nbparams = 0 - dataparams = "" - + + # Initialize number of params and data to add to node DCF + nbparams = 0 + dataparams = "" + + # Generate the best PDO mapping for each type of PDO for pdotype in (TPDO, RPDO): pdosize = 0 pdomapping = [] @@ -380,103 +440,117 @@ pdosize += loc_infos["size"] # If pdo's size > 64 bits if pdosize > 64: - result = GetNewCobID(nodeid, pdotype) - if result: - SlavesPdoNumber[nodeid][pdotype] += 1 - new_cobid, new_idx = result - data, nbaddedparams = GenerateMappingDCF(new_cobid, new_idx, pdomapping, False) - dataparams += data - nbparams += nbaddedparams - DictCobID[new_cobid] = {"type" : InvertPDOType[pdotype], "mapping" : GenerateMasterMapping(pdomapping)} + # Generate a new PDO Mapping + data, nbaddedparams = self.AddPDOMapping(nodeid, pdotype, pdomapping, sync_TPDOs) + dataparams += data + nbparams += nbaddedparams pdosize = loc_infos["size"] pdomapping = [(name, loc_infos)] else: pdomapping.append((name, loc_infos)) + # If there isn't locations yet but there is still a PDO to generate if len(pdomapping) > 0: - result = GetNewCobID(nodeid, pdotype) - if result: - SlavesPdoNumber[nodeid][pdotype] += 1 - new_cobid, new_idx = result - data, nbaddedparams = GenerateMappingDCF(new_cobid, new_idx, pdomapping, False) - dataparams += data - nbparams += nbaddedparams - DictCobID[new_cobid] = {"type" : InvertPDOType[pdotype], "mapping" : GenerateMasterMapping(pdomapping)} - - dcf = LE_to_BE(nbparams, 0x04) + dataparams - masternode.SetEntry(0x1F22, nodeid, dcf) - - + # Generate a new PDO Mapping + data, nbaddedparams = self.AddPDOMapping(nodeid, pdotype, pdomapping, sync_TPDOs) + dataparams += data + nbparams += nbaddedparams + + # Add number of params and data to node DCF + self.AddParamsToDCF(nodeid, dataparams, nbparams) + #------------------------------------------------------------------------------- # Master Node Configuration #------------------------------------------------------------------------------- - - - # Configure Master's PDO parameters entries and set cobid, transmit type - for cobid, pdo_infos in DictCobID.items(): - current_idx = CurrentPDOParamsIdx[pdo_infos["type"]] - addinglist = [current_idx, current_idx + 0x200] - manager.ManageEntriesOfCurrent(addinglist, [], masternode) - masternode.SetEntry(current_idx, 0x01, cobid) - masternode.SetEntry(current_idx, 0x02, DefaultTransmitTypeMaster) + # Generate Master's Configuration from informations stored in MasterMapping + for cobid, pdo_infos in self.MasterMapping.items(): + # Get next PDO index in MasterNode for this PDO type + current_idx = self.CurrentPDOParamsIdx[pdo_infos["type"]] + + # Search if there is already a PDO in MasterNode with this cob id + for idx in GetNodePDOIndexes(self.MasterNode, pdo_infos["type"], True): + if self.MasterNode.GetEntry(idx, 1) == cobid: + current_idx = idx + + # Add a PDO to MasterNode if not PDO have been found + if current_idx == self.CurrentPDOParamsIdx[pdo_infos["type"]]: + addinglist = [current_idx, current_idx + 0x200] + self.Manager.ManageEntriesOfCurrent(addinglist, [], self.MasterNode) + self.MasterNode.SetEntry(current_idx, 0x01, cobid) + + # Increment the number of PDO for this PDO type + self.CurrentPDOParamsIdx[pdo_infos["type"]] += 1 + + # Change the transmit type of the PDO + if sync_TPDOs: + self.MasterNode.SetEntry(current_idx, 0x02, 0x01) + else: + self.MasterNode.SetEntry(current_idx, 0x02, 0xFF) + + # Add some subentries to PDO mapping if there is not enough if len(pdo_infos["mapping"]) > 2: - manager.AddSubentriesToCurrent(current_idx + 0x200, len(pdo_infos["mapping"]) - 2, masternode) - - # Create Master's PDO mapping + self.Manager.AddSubentriesToCurrent(current_idx + 0x200, len(pdo_infos["mapping"]) - 2, self.MasterNode) + + # Generate MasterNode's PDO mapping for subindex, variable in enumerate(pdo_infos["mapping"]): if subindex == 0: continue new_index = False - if type(variable) != IntType: + if type(variable) == IntType: + # If variable is an integer then variable is unexpected + self.MasterNode.SetEntry(current_idx + 0x200, subindex, self.TrashVariables[variable]) + else: + typeidx, varname = variable + variable_infos = self.IECLocations[varname] - typeidx, varname = variable - indexname = \ - DictNameVariable[DictLocations[variable[1]]["pdotype"]][0] + \ - DictLocations[variable[1]]["sizelocation"] + \ - '_'.join(map(str,current_location)) + \ - "_" + \ - str(DictLocations[variable[1]]["nodeid"]) - mapvariableidx = DictNameVariable[DictLocations[variable[1]]["pdotype"]][1] + DictNameVariable[DictLocations[variable[1]]["sizelocation"]] * DictNameVariable["increment"] - - #indexname = DictNameVariable[DictLocations[variable[1]]["pdotype"]][0] + DictLocations[variable[1]]["sizelocation"] + str(DictLocations[variable[1]]["prefix"]) + "_" + str(DictLocations[variable[1]]["nodeid"]) - #mapvariableidx = DictNameVariable[DictLocations[variable[1]]["pdotype"]][1] + DictNameVariable[DictLocations[variable[1]]["sizelocation"]] * DictNameVariable["increment"] + # Calculate base index for storing variable + mapvariableidx = VariableStartIndex[variable_infos["pdotype"]] + \ + VariableTypeOffset[variable_infos["sizelocation"]] * VariableIncrement + \ + variable_infos["nodeid"] - if not masternode.IsEntry(mapvariableidx): - manager.AddMapVariableToCurrent(mapvariableidx, indexname, 3, 1, masternode) - new_index = True - nbsubentries = masternode.GetEntry(mapvariableidx, 0x00) - else: - nbsubentries = masternode.GetEntry(mapvariableidx, 0x00) - mapvariableidxbase = mapvariableidx - while mapvariableidx < (mapvariableidxbase + 0x1FF) and nbsubentries == 0xFF: - mapvariableidx += 0x800 - if not manager.IsCurrentEntry(mapvariableidx): - manager.AddMapVariableToCurrent(mapvariableidx, indexname, 3, 1, masternode) - new_index = True - nbsubentries = masternode.GetEntry(mapvariableidx, 0x00) - - if mapvariableidx < 0x6000: - if DictLocations[variable[1]]["bit"] != None: - subindexname = str(DictLocations[variable[1]]["index"]) + "_" + str(DictLocations[variable[1]]["subindex"]) + "_" + str(DictLocations[variable[1]]["bit"]) + # Search for an entry that has an empty subindex + while mapvariableidx < VariableStartIndex[variable_infos["pdotype"]] + 0x2000: + # Entry doesn't exist + if not self.MasterNode.IsEntry(mapvariableidx): + # Generate entry name + indexname = "%s%s%s_%d"%(VariableDirText[variable_infos["pdotype"]], + variable_infos["sizelocation"], + '_'.join(map(str,current_location)), + variable_infos["nodeid"]) + # Add entry to MasterNode + self.Manager.AddMapVariableToCurrent(mapvariableidx, indexname, 3, 1, self.MasterNode) + new_index = True + nbsubentries = self.MasterNode.GetEntry(mapvariableidx, 0x00) else: - subindexname = str(DictLocations[variable[1]]["index"]) + "_" + str(DictLocations[variable[1]]["subindex"]) + # Get Number of subentries already defined + nbsubentries = self.MasterNode.GetEntry(mapvariableidx, 0x00) + # if entry is full, go to next entry possible or stop now + if nbsubentries == 0xFF: + mapvariableidx += 8 * VariableIncrement + else: + break + + # Verify that a not full entry has been found + if mapvariableidx < VariableStartIndex[variable_infos["pdotype"]] + 0x2000: + # Generate subentry name + if variable_infos["bit"] != None: + subindexname = "%(index)d_%(subindex)d_%(bit)d"%variable_infos + else: + subindexname = "%(index)d_%(subindex)d"%variable_infos + # If entry have just been created, no subentry have to be added if not new_index: - manager.AddSubentriesToCurrent(mapvariableidx, 1, masternode) + self.Manager.AddSubentriesToCurrent(mapvariableidx, 1, self.MasterNode) nbsubentries += 1 - masternode.SetMappingEntry(mapvariableidx, nbsubentries, values = {"name" : subindexname}) - masternode.SetMappingEntry(mapvariableidx, nbsubentries, values = {"type" : typeidx}) + # Add informations to the new subentry created + self.MasterNode.SetMappingEntry(mapvariableidx, nbsubentries, values = {"name" : subindexname}) + self.MasterNode.SetMappingEntry(mapvariableidx, nbsubentries, values = {"type" : typeidx}) - # Map Variable - typeinfos = manager.GetEntryInfos(typeidx) + # Set value of the PDO mapping + typeinfos = self.Manager.GetEntryInfos(typeidx) if typeinfos != None: value = (mapvariableidx << 16) + ((nbsubentries) << 8) + typeinfos["size"] - masternode.SetEntry(current_idx + 0x200, subindex, value) - else: - masternode.SetEntry(current_idx + 0x200, subindex, TrashVariableValue[variable]) - - CurrentPDOParamsIdx[pdo_infos["type"]] += 1 - + self.MasterNode.SetEntry(current_idx + 0x200, subindex, value) def GenerateConciseDCF(locations, current_location, nodelist, sync_TPDOs): """ @@ -496,31 +570,56 @@ dcfgenerator.GenerateDCF(locations, current_location, sync_TPDOs) return dcfgenerator.GetMasterNode() -if __name__ == "__main__": +if __name__ == "__main__": + import os, sys + + base_folder = sys.path[0] + for i in xrange(3): + base_folder = os.path.split(base_folder)[0] + sys.path.append(os.path.join(base_folder, "CanFestival-3", "objdictgen")) + from nodemanager import * from nodelist import * - import sys - - manager = NodeManager(sys.path[0]) + + manager = NodeManager() nodelist = NodeList(manager) - result = nodelist.LoadProject("/home/deobox/Desktop/TestMapping") - -## if result != None: -## print result -## else: -## print "MasterNode :" -## manager.CurrentNode.Print() -## for nodeid, node in nodelist.SlaveNodes.items(): -## print "SlaveNode name=%s id=0x%2.2X :"%(node["Name"], nodeid) -## node["Node"].Print() - - #filepath = "/home/deobox/beremiz/test_nodelist/listlocations.txt" - filepath = "/home/deobox/Desktop/TestMapping/listlocations.txt" - - file = open(filepath,'r') - locations = [location.split(' ') for location in [line.strip() for line in file.readlines() if len(line) > 0]] + result = nodelist.LoadProject("test_config") + + locations = [{"IEC_TYPE":"BYTE","NAME":"__IB0_1_64_24576_1","DIR":"I","SIZE":"B","LOC":(0,1,64,24576,1)}, + {"IEC_TYPE":"INT","NAME":"__IW0_1_64_25601_2","DIR":"I","SIZE":"W","LOC":(0,1,64,25601,2)}, + {"IEC_TYPE":"INT","NAME":"__IW0_1_64_25601_3","DIR":"I","SIZE":"W","LOC":(0,1,64,25601,3)}, + {"IEC_TYPE":"INT","NAME":"__QW0_1_64_25617_2","DIR":"Q","SIZE":"W","LOC":(0,1,64,25617,1)}, + {"IEC_TYPE":"BYTE","NAME":"__IB0_1_64_24578_1","DIR":"I","SIZE":"B","LOC":(0,1,64,24578,1)}, + {"IEC_TYPE":"UDINT","NAME":"__ID0_1_64_25638_1","DIR":"I","SIZE":"D","LOC":(0,1,64,25638,1)}, + {"IEC_TYPE":"UDINT","NAME":"__ID0_1_64_25638_2","DIR":"I","SIZE":"D","LOC":(0,1,64,25638,2)}, + {"IEC_TYPE":"UDINT","NAME":"__ID0_1_64_25638_3","DIR":"I","SIZE":"D","LOC":(0,1,64,25638,3)}, + {"IEC_TYPE":"UDINT","NAME":"__ID0_1_64_25638_4","DIR":"I","SIZE":"D","LOC":(0,1,64,25638,4)}] + + masternode = GenerateConciseDCF(locations, (0, 1), nodelist, True) + #masternode.Print() + result = [line.rstrip() for line in masternode.PrintString().splitlines()] + + file = open("test_config/result.txt", "r") + model = [line.rstrip() for line in file.readlines()] file.close() - GenerateConciseDCF(locations, 32, nodelist) - print "MasterNode :" - manager.CurrentNode.Print() - #masternode.Print() \ No newline at end of file + + errors = 0 + for i, line in enumerate(model): + if i >= len(result): + errors += 1 + print "Line %d disappear :"%(i + 1) + print line + elif line != result[i]: + errors += 1 + print "Error on line %d :"%(i + 1) + print "\t%s"%result[i] + print "Instead of :\n\t%s"%line + for i in xrange(len(model), len(result)): + errors += 1 + print "Line %d appear :"%(i + 1) + print result[i] + + if errors > 0: + print "Test Failed!" + else: + print "Test Successful!" \ No newline at end of file diff -r 59b84ab7bf8b -r 2721e6910f5a plugins/canfestival/test_config/eds/PEAK MicroMod.eds --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/canfestival/test_config/eds/PEAK MicroMod.eds Wed Sep 12 17:16:27 2007 +0200 @@ -0,0 +1,1289 @@ +[FileInfo] +CreatedBy=ESAcademy +ModifiedBy=ESAcademy +Description=PEAK MicroMod CANopenIA Generic +CreationTime=09:41PM +CreationDate=05-05-2003 +ModificationTime=05:05PM +ModificationDate=03-23-2005 +FileName=C:\CANopenCT\Tests\PEAK MicroMod.eds +FileVersion=1 +FileRevision=1 +EDSVersion=4 + +[DeviceInfo] +VendorName=PEAK System Technik +VendorNumber=0x00000175 +ProductName=PEAK MicroMod CANopenIA Generic +ProductNumber=0x00100000 +RevisionNumber=0x00010001 +OrderCode=na +BaudRate_10=0 +BaudRate_20=0 +BaudRate_50=1 +BaudRate_125=1 +BaudRate_250=1 +BaudRate_500=1 +BaudRate_800=1 +BaudRate_1000=1 +SimpleBootUpMaster=0 +SimpleBootUpSlave=1 +Granularity=0 +DynamicChannelsSupported=0 +CompactPDO=0 +GroupMessaging=0 +NrOfRXPDO=4 +NrOfTXPDO=4 +LSS_Supported=0 + +[DummyUsage] +Dummy0001=0 +Dummy0002=0 +Dummy0003=0 +Dummy0004=0 +Dummy0005=1 +Dummy0006=1 +Dummy0007=1 + +[Comments] +Lines=0 + +[MandatoryObjects] +SupportedObjects=3 +1=0x1000 +2=0x1001 +3=0x1018 + +[1000] +ParameterName=Device Type +ObjectType=0x7 +DataType=0x0007 +AccessType=ro +DefaultValue=0x000F0191 +PDOMapping=0 + +[1001] +ParameterName=Error Register +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=0 +PDOMapping=0 + +[1018] +ParameterName=Identity Object +ObjectType=0x9 +SubNumber=4 + +[1018sub0] +ParameterName=number of entries +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=3 +PDOMapping=0 + +[1018sub1] +ParameterName=Vendor ID +ObjectType=0x7 +DataType=0x0007 +AccessType=ro +DefaultValue=0x00000175 +PDOMapping=0 + +[1018sub2] +ParameterName=Product Code +ObjectType=0x7 +DataType=0x0007 +AccessType=ro +DefaultValue=0x00100000 +PDOMapping=0 + +[1018sub3] +ParameterName=Revision number +ObjectType=0x7 +DataType=0x0007 +AccessType=ro +DefaultValue=0x00010001 +PDOMapping=0 + +[OptionalObjects] +SupportedObjects=41 +1=0x1002 +2=0x1005 +3=0x1008 +4=0x1009 +5=0x100A +6=0x100C +7=0x100D +8=0x1010 +9=0x1011 +10=0x1016 +11=0x1017 +12=0x1020 +13=0x1400 +14=0x1401 +15=0x1402 +16=0x1403 +17=0x1600 +18=0x1601 +19=0x1602 +20=0x1603 +21=0x1800 +22=0x1801 +23=0x1802 +24=0x1803 +25=0x1A00 +26=0x1A01 +27=0x1A02 +28=0x1A03 +29=0x1F50 +30=0x6000 +31=0x6002 +32=0x6200 +33=0x6202 +34=0x6206 +35=0x6207 +36=0x6401 +37=0x6411 +38=0x6423 +39=0x6426 +40=0x6443 +41=0x6444 + +[1002] +ParameterName=PEAK Status Register +ObjectType=0x7 +DataType=0x0007 +AccessType=ro +PDOMapping=0 + +[1005] +ParameterName=COB-ID SYNC +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0x00000080 +PDOMapping=0 + +[1008] +ParameterName=Manufacturer Device Name +ObjectType=0x7 +DataType=0x0009 +AccessType=const +PDOMapping=0 + +[1009] +ParameterName=Manufacturer Hardware Version +ObjectType=0x7 +DataType=0x0009 +AccessType=const +PDOMapping=0 + +[100a] +ParameterName=Manufacturer Software Version +ObjectType=0x7 +DataType=0x0009 +AccessType=const +PDOMapping=0 + +[100c] +ParameterName=Guard Time +ObjectType=0x7 +DataType=0x0006 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[100d] +ParameterName=Life Time Factor +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=0x00 +PDOMapping=0 + +[1010] +ParameterName=Store Parameter Field +ObjectType=0x8 +SubNumber=2 + +[1010sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=1 +PDOMapping=0 + +[1010sub1] +ParameterName=Save all Parameters +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +PDOMapping=0 + +[1011] +ParameterName=Restore Default Parameters +ObjectType=0x8 +SubNumber=2 + +[1011sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=1 +PDOMapping=0 + +[1011sub1] +ParameterName=Restore all Default Parameters +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +PDOMapping=0 + +[1016] +ParameterName=Consumer Heartbeat Time +ObjectType=0x8 +SubNumber=4 + +[1016sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=3 +PDOMapping=0 +LowLimit=0x1 + +[1016sub1] +ParameterName=Consumer Heartbeat Time +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[1016sub2] +ParameterName=Consumer Heartbeat Time +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[1016sub3] +ParameterName=Consumer Heartbeat Time +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[1017] +ParameterName=Producer Heartbeat Time +ObjectType=0x7 +DataType=0x0006 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[1020] +ParameterName=Verify Configuration +ObjectType=0x8 +SubNumber=3 + +[1020sub0] +ParameterName=Number of entries +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=2 +PDOMapping=0 + +[1020sub1] +ParameterName=Configuration date +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +PDOMapping=0 + +[1020sub2] +ParameterName=Configuration time +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +PDOMapping=0 + +[1400] +ParameterName=Receive PDO Communication Parameter +ObjectType=0x9 +SubNumber=3 + +[1400sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=2 +PDOMapping=0 + +[1400sub1] +ParameterName=COB-ID +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=$NODEID+0x200 +PDOMapping=0 +LowLimit=0x00000001 +HighLimit=0xFFFFFFFF + +[1400sub2] +ParameterName=Transmission Type +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=255 +PDOMapping=0 + +[1401] +ParameterName=Receive PDO Communication Parameter +ObjectType=0x9 +SubNumber=3 + +[1401sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=2 +PDOMapping=0 + +[1401sub1] +ParameterName=COB-ID +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=$NODEID+0x300 +PDOMapping=0 +LowLimit=0x00000001 +HighLimit=0xFFFFFFFF + +[1401sub2] +ParameterName=Transmission Type +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=255 +PDOMapping=0 + +[1402] +ParameterName=Receive PDO Communication Parameter +ObjectType=0x9 +SubNumber=3 + +[1402sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=2 +PDOMapping=0 +LowLimit=0x02 +HighLimit=0x05 + +[1402sub1] +ParameterName=COB-ID +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=$NODEID+0x80000400 +PDOMapping=0 +LowLimit=0x00000001 +HighLimit=0xFFFFFFFF + +[1402sub2] +ParameterName=Transmission Type +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=255 +PDOMapping=0 + +[1403] +ParameterName=Receive PDO Communication Parameter +ObjectType=0x9 +SubNumber=3 + +[1403sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=2 +PDOMapping=0 +LowLimit=0x02 +HighLimit=0x05 + +[1403sub1] +ParameterName=COB-ID +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=$NODEID+0x80000500 +PDOMapping=0 +LowLimit=0x00000001 +HighLimit=0xFFFFFFFF + +[1403sub2] +ParameterName=Transmission Type +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=255 +PDOMapping=0 + +[1600] +ParameterName=Receive PDO Mapping Parameter +ObjectType=0x9 +SubNumber=2 + +[1600sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=1 +PDOMapping=0 + +[1600sub1] +ParameterName=PDO Mapping Entry +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0x62000108 +PDOMapping=0 + +[1601] +ParameterName=Receive PDO Mapping Parameter +ObjectType=0x9 +SubNumber=5 + +[1601sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=4 +PDOMapping=0 + +[1601sub1] +ParameterName=PDO Mapping Entry +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0x64110110 +PDOMapping=0 + +[1601sub2] +ParameterName=PDO Mapping Entry +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0x64110210 +PDOMapping=0 + +[1601sub3] +ParameterName=PDO Mapping Entry +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0x64110310 +PDOMapping=0 + +[1601sub4] +ParameterName=PDO Mapping Entry +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0x64110410 +PDOMapping=0 + +[1602] +ParameterName=Receive PDO Mapping Parameter +ObjectType=0x9 +SubNumber=1 + +[1602sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[1603] +ParameterName=Receive PDO Mapping Parameter +ObjectType=0x9 +SubNumber=1 + +[1603sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[1800] +ParameterName=Transmit PDO Communication Parameter +ObjectType=0x9 +SubNumber=5 + +[1800sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=5 +PDOMapping=0 +LowLimit=0x02 +HighLimit=0x05 + +[1800sub1] +ParameterName=COB-ID +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=$NODEID+0x180 +PDOMapping=0 +LowLimit=0x00000001 +HighLimit=0xFFFFFFFF + +[1800sub2] +ParameterName=Transmission Type +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=255 +PDOMapping=0 + +[1800sub3] +ParameterName=Inhibit Time +ObjectType=0x7 +DataType=0x0006 +AccessType=rw +DefaultValue=0x0000 +PDOMapping=0 + +[1800sub5] +ParameterName=Event Timer +ObjectType=0x7 +DataType=0x0006 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[1801] +ParameterName=Transmit PDO Communication Parameter +ObjectType=0x9 +SubNumber=5 + +[1801sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=5 +PDOMapping=0 +LowLimit=0x02 +HighLimit=0x05 + +[1801sub1] +ParameterName=COB-ID +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=$NODEID+0x280 +PDOMapping=0 +LowLimit=0x00000001 +HighLimit=0xFFFFFFFF + +[1801sub2] +ParameterName=Transmission Type +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=255 +PDOMapping=0 + +[1801sub3] +ParameterName=Inhibit Time +ObjectType=0x7 +DataType=0x0006 +AccessType=rw +DefaultValue=0x0000 +PDOMapping=0 + +[1801sub5] +ParameterName=Event Timer +ObjectType=0x7 +DataType=0x0006 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[1802] +ParameterName=Transmit PDO Communication Parameter +ObjectType=0x9 +SubNumber=5 + +[1802sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=5 +PDOMapping=0 +LowLimit=0x02 +HighLimit=0x05 + +[1802sub1] +ParameterName=COB-ID +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=$NODEID+0x380 +PDOMapping=0 +LowLimit=0x00000001 +HighLimit=0xFFFFFFFF + +[1802sub2] +ParameterName=Transmission Type +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=255 +PDOMapping=0 + +[1802sub3] +ParameterName=Inhibit Time +ObjectType=0x7 +DataType=0x0006 +AccessType=rw +DefaultValue=0x0000 +PDOMapping=0 + +[1802sub5] +ParameterName=Event Timer +ObjectType=0x7 +DataType=0x0006 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[1803] +ParameterName=Transmit PDO Communication Parameter +ObjectType=0x9 +SubNumber=5 + +[1803sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=5 +PDOMapping=0 +LowLimit=0x02 +HighLimit=0x05 + +[1803sub1] +ParameterName=COB-ID +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=$NODEID+0x80000480 +PDOMapping=0 +LowLimit=0x00000001 +HighLimit=0xFFFFFFFF + +[1803sub2] +ParameterName=Transmission Type +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=255 +PDOMapping=0 + +[1803sub3] +ParameterName=Inhibit Time +ObjectType=0x7 +DataType=0x0006 +AccessType=rw +DefaultValue=0x0000 +PDOMapping=0 + +[1803sub5] +ParameterName=Event Timer +ObjectType=0x7 +DataType=0x0006 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[1a00] +ParameterName=Transmit PDO Mapping Parameter +ObjectType=0x9 +SubNumber=2 + +[1a00sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=1 +PDOMapping=0 + +[1a00sub1] +ParameterName=PDO Mapping Entry +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0x60000108 +PDOMapping=0 + +[1a01] +ParameterName=Transmit PDO Mapping Parameter +ObjectType=0x9 +SubNumber=5 + +[1a01sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=4 +PDOMapping=0 + +[1a01sub1] +ParameterName=PDO Mapping Entry +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0x64010110 +PDOMapping=0 + +[1a01sub2] +ParameterName=PDO Mapping Entry +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0x64010210 +PDOMapping=0 + +[1a01sub3] +ParameterName=PDO Mapping Entry +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0x64010310 +PDOMapping=0 + +[1a01sub4] +ParameterName=PDO Mapping Entry +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0x64010410 +PDOMapping=0 + +[1a02] +ParameterName=Transmit PDO Mapping Parameter +ObjectType=0x9 +SubNumber=5 + +[1a02sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=4 +PDOMapping=0 + +[1a02sub1] +ParameterName=PDO Mapping Entry +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0x64010510 +PDOMapping=0 + +[1a02sub2] +ParameterName=PDO Mapping Entry +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0x64010610 +PDOMapping=0 + +[1a02sub3] +ParameterName=PDO Mapping Entry +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0x64010710 +PDOMapping=0 + +[1a02sub4] +ParameterName=PDO Mapping Entry +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0x64010810 +PDOMapping=0 + +[1a03] +ParameterName=Transmit PDO Mapping Parameter +ObjectType=0x9 +SubNumber=1 + +[1a03sub0] +ParameterName=Number of Entries +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[1f50] +ParameterName=Download Program Data +ObjectType=0x8 +SubNumber=2 + +[1f50sub0] +ParameterName=Number of elements +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=3 +PDOMapping=0 + +[1f50sub3] +ParameterName=Download Program Data - HW Settings +ObjectType=0x7 +DataType=0x000F +AccessType=rw +PDOMapping=0 + +[6000] +ParameterName=Read Digital Input 8-bit +ObjectType=0x8 +SubNumber=2 + +[6000sub0] +ParameterName=Number of Elements +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=1 +PDOMapping=0 + +[6000sub1] +ParameterName=DigInput8_1 +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +PDOMapping=1 + +[6002] +ParameterName=Polarity Digital Input +ObjectType=0x8 +SubNumber=2 + +[6002sub0] +ParameterName=Number of Elements +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=1 +PDOMapping=0 + +[6002sub1] +ParameterName=Polarity8_1 +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6200] +ParameterName=Write Digital Output 8-bit +ObjectType=0x8 +SubNumber=2 + +[6200sub0] +ParameterName=Number of elements +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=1 +PDOMapping=0 + +[6200sub1] +ParameterName=DigOutput8_1 +ObjectType=0x7 +DataType=0x0005 +AccessType=rww +PDOMapping=1 + +[6202] +ParameterName=Polarity Digital Output +ObjectType=0x8 +SubNumber=2 + +[6202sub0] +ParameterName=Number of Elements +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=1 +PDOMapping=0 + +[6202sub1] +ParameterName=Polarity8_1 +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6206] +ParameterName=Error Mode Digital Output +ObjectType=0x8 +SubNumber=2 + +[6206sub0] +ParameterName=Number of elements +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=1 +PDOMapping=0 + +[6206sub1] +ParameterName=Error Mode 1 +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6207] +ParameterName=Error Value Digital Output +ObjectType=0x8 +SubNumber=2 + +[6207sub0] +ParameterName=Number of elements +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=1 +PDOMapping=0 + +[6207sub1] +ParameterName=Error Value 1 +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6401] +ParameterName=Read Analog Input 16-bit +ObjectType=0x8 +SubNumber=9 + +[6401sub0] +ParameterName=Number of elements +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=8 +PDOMapping=0 + +[6401sub1] +ParameterName=AnalogInput16_1 +ObjectType=0x7 +DataType=0x0003 +AccessType=ro +PDOMapping=1 + +[6401sub2] +ParameterName=AnalogInput16_2 +ObjectType=0x7 +DataType=0x0003 +AccessType=ro +PDOMapping=1 + +[6401sub3] +ParameterName=AnalogInput16_3 +ObjectType=0x7 +DataType=0x0003 +AccessType=ro +PDOMapping=1 + +[6401sub4] +ParameterName=AnalogInput16_4 +ObjectType=0x7 +DataType=0x0003 +AccessType=ro +PDOMapping=1 + +[6401sub5] +ParameterName=AnalogInput16_5 +ObjectType=0x7 +DataType=0x0003 +AccessType=ro +PDOMapping=1 + +[6401sub6] +ParameterName=AnalogInput16_6 +ObjectType=0x7 +DataType=0x0003 +AccessType=ro +PDOMapping=1 + +[6401sub7] +ParameterName=AnalogInput16_7 +ObjectType=0x7 +DataType=0x0003 +AccessType=ro +PDOMapping=1 + +[6401sub8] +ParameterName=AnalogInput16_8 +ObjectType=0x7 +DataType=0x0003 +AccessType=ro +PDOMapping=1 + +[6411] +ParameterName=Write Analog Output 16-bit +ObjectType=0x8 +SubNumber=5 + +[6411sub0] +ParameterName=Number of elements +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=4 +PDOMapping=0 + +[6411sub1] +ParameterName=AnalogOutput16_1 +ObjectType=0x7 +DataType=0x0003 +AccessType=rww +PDOMapping=1 + +[6411sub2] +ParameterName=AnalogOutput16_2 +ObjectType=0x7 +DataType=0x0003 +AccessType=rww +PDOMapping=1 + +[6411sub3] +ParameterName=AnalogOutput16_3 +ObjectType=0x7 +DataType=0x0003 +AccessType=rww +PDOMapping=1 + +[6411sub4] +ParameterName=AnalogOutput16_4 +ObjectType=0x7 +DataType=0x0003 +AccessType=rww +PDOMapping=1 + +[6423] +ParameterName=Analog Input Global Interrupt +ObjectType=0x7 +DataType=0x0001 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6426] +ParameterName=Analog Input Interrupt Delta +ObjectType=0x8 +SubNumber=9 + +[6426sub0] +ParameterName=NrOfObjects +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=8 +PDOMapping=0 + +[6426sub1] +ParameterName=Analog Input Delta 1 +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6426sub2] +ParameterName=Analog Input Delta 2 +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6426sub3] +ParameterName=Analog Input Delta 3 +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6426sub4] +ParameterName=Analog Input Delta 4 +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6426sub5] +ParameterName=Analog Input Delta 5 +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6426sub6] +ParameterName=Analog Input Delta 6 +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6426sub7] +ParameterName=Analog Input Delta 7 +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6426sub8] +ParameterName=Analog Input Delta 8 +ObjectType=0x7 +DataType=0x0007 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6443] +ParameterName=Error Mode Analog Output +ObjectType=0x8 +SubNumber=5 + +[6443sub0] +ParameterName=Number of elements +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=4 +PDOMapping=0 + +[6443sub1] +ParameterName=Error Mode 1 +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6443sub2] +ParameterName=Error Mode 2 +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6443sub3] +ParameterName=Error Mode 3 +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6443sub4] +ParameterName=Error Mode 4 +ObjectType=0x7 +DataType=0x0005 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6444] +ParameterName=Error Value Analog Output +ObjectType=0x8 +SubNumber=5 + +[6444sub0] +ParameterName=Number of elements +ObjectType=0x7 +DataType=0x0005 +AccessType=ro +DefaultValue=4 +PDOMapping=0 + +[6444sub1] +ParameterName=Error Value 1 +ObjectType=0x7 +DataType=0x0004 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6444sub2] +ParameterName=Error Value 2 +ObjectType=0x7 +DataType=0x0004 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6444sub3] +ParameterName=Error Value 3 +ObjectType=0x7 +DataType=0x0004 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[6444sub4] +ParameterName=Error Value 4 +ObjectType=0x7 +DataType=0x0004 +AccessType=rw +DefaultValue=0 +PDOMapping=0 + +[ManufacturerObjects] +SupportedObjects=0 diff -r 59b84ab7bf8b -r 2721e6910f5a plugins/canfestival/test_config/master.od --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/canfestival/test_config/master.od Wed Sep 12 17:16:27 2007 +0200 @@ -0,0 +1,314 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Read Inputs + + + + + + + Read Inputs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +master + +TestMaster + diff -r 59b84ab7bf8b -r 2721e6910f5a plugins/canfestival/test_config/nodelist.cpj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/canfestival/test_config/nodelist.cpj Wed Sep 12 17:16:27 2007 +0200 @@ -0,0 +1,7 @@ +[TOPOLOGY] +NetName=None +Nodes=0x01 +Node64Present=0x01 +Node64Name=micromod +Node64DCFName=PEAK MicroMod.eds +EDSBaseName=eds diff -r 59b84ab7bf8b -r 2721e6910f5a plugins/canfestival/test_config/result.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/canfestival/test_config/result.txt Wed Sep 12 17:16:27 2007 +0200 @@ -0,0 +1,253 @@ +1000 (Device Type): 302 +1001 (Error Register): 0 +1005 (SYNC COB ID): 1073741952 +1006 (Communication / Cycle Period): 50000 +1016 (Consumer Heartbeat Time): + 001 (Consumer Heartbeat Time): 4005DC +1018 (Identity): + 001 (Vendor ID): 0 + 002 (Product Code): 0 + 003 (Revision Number): 0 + 004 (Serial Number): 0 +1280 (Client SDO 1 Parameter): + 001 (COB ID Client to Server (Transmit SDO)): 640 + 002 (COB ID Server to Client (Receive SDO)): 5C0 + 003 (Node ID of the SDO Server): 40 +1400 (Receive PDO 1 Parameter): + 001 (COB ID used by PDO): 1C0 + 002 (Transmission Type): 1 + 003 (Inhibit Time): 0 + 004 (Compatibility Entry): 0 + 005 (Event Timer): 0 +1401 (Receive PDO 2 Parameter): + 001 (COB ID used by PDO): 2C0 + 002 (Transmission Type): 1 + 003 (Inhibit Time): 0 + 004 (Compatibility Entry): 0 + 005 (Event Timer): 0 +1402 (Receive PDO 3 Parameter): + 001 (COB ID used by PDO): 182 + 002 (Transmission Type): 1 + 003 (Inhibit Time): 0 + 004 (Compatibility Entry): 0 + 005 (Event Timer): 0 +1403 (Receive PDO 4 Parameter): + 001 (COB ID used by PDO): 183 + 002 (Transmission Type): 1 + 003 (Inhibit Time): 0 + 004 (Compatibility Entry): 0 + 005 (Event Timer): 0 +1404 (Receive PDO 5 Parameter): + 001 (COB ID used by PDO): 180 + 002 (Transmission Type): 1 + 003 (Inhibit Time): 0 + 004 (Compatibility Entry): 0 + 005 (Event Timer): 0 +1600 (Receive PDO 1 Mapping): + 001 (PDO 1 Mapping for an application object 1): 22400108 +1601 (Receive PDO 2 Mapping): + 001 (PDO 2 Mapping for an application object 1): 20010310 + 002 (PDO 2 Mapping for an application object 2): 23400110 + 003 (PDO 2 Mapping for an application object 3): 23400210 + 004 (PDO 2 Mapping for an application object 4): 20010310 +1602 (Receive PDO 3 Mapping): + 001 (PDO 3 Mapping for an application object 1): 24400120 + 002 (PDO 3 Mapping for an application object 2): 24400220 +1603 (Receive PDO 4 Mapping): + 001 (PDO 4 Mapping for an application object 1): 24400320 +1604 (Receive PDO 5 Mapping): + 001 (PDO 5 Mapping for an application object 1): 22400208 + 002 (PDO 5 Mapping for an application object 2): 24400420 +1800 (Transmit PDO 1 Parameter): + 001 (COB ID used by PDO): {True:self.ID+(base+1)*0x100+0x80,False:0}[base<4] + 002 (Transmission Type): 0 + 003 (Inhibit Time): 0 + 004 (Compatibility Entry): 0 + 005 (Event Timer): 0 +1801 (Transmit PDO 2 Parameter): + 001 (COB ID used by PDO): 340 + 002 (Transmission Type): 1 + 003 (Inhibit Time): 0 + 004 (Compatibility Entry): 0 + 005 (Event Timer): 0 +1A00 (Transmit PDO 1 Mapping): + 001 (PDO 1 Mapping for a process data variable 1): 10010008 +1A01 (Transmit PDO 2 Mapping): + 001 (PDO 2 Mapping for a process data variable 1): 43400110 + 002 (PDO 2 Mapping for a process data variable 2): 20010310 + 003 (PDO 2 Mapping for a process data variable 3): 20010310 + 004 (PDO 2 Mapping for a process data variable 4): 20010310 +1F22 (Concise DCF): + 001 (Concise DCF for Node 1): + 002 (Concise DCF for Node 2): + 003 (Concise DCF for Node 3): + 004 (Concise DCF for Node 4): + 005 (Concise DCF for Node 5): + 006 (Concise DCF for Node 6): + 007 (Concise DCF for Node 7): + 008 (Concise DCF for Node 8): + 009 (Concise DCF for Node 9): + 010 (Concise DCF for Node 10): + 011 (Concise DCF for Node 11): + 012 (Concise DCF for Node 12): + 013 (Concise DCF for Node 13): + 014 (Concise DCF for Node 14): + 015 (Concise DCF for Node 15): + 016 (Concise DCF for Node 16): + 017 (Concise DCF for Node 17): + 018 (Concise DCF for Node 18): + 019 (Concise DCF for Node 19): + 020 (Concise DCF for Node 20): + 021 (Concise DCF for Node 21): + 022 (Concise DCF for Node 22): + 023 (Concise DCF for Node 23): + 024 (Concise DCF for Node 24): + 025 (Concise DCF for Node 25): + 026 (Concise DCF for Node 26): + 027 (Concise DCF for Node 27): + 028 (Concise DCF for Node 28): + 029 (Concise DCF for Node 29): + 030 (Concise DCF for Node 30): + 031 (Concise DCF for Node 31): + 032 (Concise DCF for Node 32): + 033 (Concise DCF for Node 33): + 034 (Concise DCF for Node 34): + 035 (Concise DCF for Node 35): + 036 (Concise DCF for Node 36): + 037 (Concise DCF for Node 37): + 038 (Concise DCF for Node 38): + 039 (Concise DCF for Node 39): + 040 (Concise DCF for Node 40): + 041 (Concise DCF for Node 41): + 042 (Concise DCF for Node 42): + 043 (Concise DCF for Node 43): + 044 (Concise DCF for Node 44): + 045 (Concise DCF for Node 45): + 046 (Concise DCF for Node 46): + 047 (Concise DCF for Node 47): + 048 (Concise DCF for Node 48): + 049 (Concise DCF for Node 49): + 050 (Concise DCF for Node 50): + 051 (Concise DCF for Node 51): + 052 (Concise DCF for Node 52): + 053 (Concise DCF for Node 53): + 054 (Concise DCF for Node 54): + 055 (Concise DCF for Node 55): + 056 (Concise DCF for Node 56): + 057 (Concise DCF for Node 57): + 058 (Concise DCF for Node 58): + 059 (Concise DCF for Node 59): + 060 (Concise DCF for Node 60): + 061 (Concise DCF for Node 61): + 062 (Concise DCF for Node 62): + 063 (Concise DCF for Node 63): + 064 (Concise DCF for Node 64): 26 + 1800 01 00000004 800001C0 + 1800 02 00000001 01 + 1800 01 00000004 000001C0 + 1801 01 00000004 800002C0 + 1801 02 00000001 01 + 1801 01 00000004 000002C0 + 1801 01 00000004 800002C0 + 1801 02 00000001 01 + 1801 01 00000004 000002C0 + 1401 01 00000004 80000340 + 1401 02 00000001 01 + 1401 01 00000004 00000340 + 1804 01 00000004 80000180 + 1804 02 00000001 01 + 1804 01 00000004 00000180 + 1A04 01 00000004 60020108 + 1A04 02 00000004 64260120 + 1805 01 00000004 80000182 + 1805 02 00000001 01 + 1805 01 00000004 00000182 + 1A05 01 00000004 64260220 + 1A05 02 00000004 64260320 + 1806 01 00000004 80000183 + 1806 02 00000001 01 + 1806 01 00000004 00000183 + 1A06 01 00000004 64260420 + 065 (Concise DCF for Node 65): + 066 (Concise DCF for Node 66): + 067 (Concise DCF for Node 67): + 068 (Concise DCF for Node 68): + 069 (Concise DCF for Node 69): + 070 (Concise DCF for Node 70): + 071 (Concise DCF for Node 71): + 072 (Concise DCF for Node 72): + 073 (Concise DCF for Node 73): + 074 (Concise DCF for Node 74): + 075 (Concise DCF for Node 75): + 076 (Concise DCF for Node 76): + 077 (Concise DCF for Node 77): + 078 (Concise DCF for Node 78): + 079 (Concise DCF for Node 79): + 080 (Concise DCF for Node 80): + 081 (Concise DCF for Node 81): + 082 (Concise DCF for Node 82): + 083 (Concise DCF for Node 83): + 084 (Concise DCF for Node 84): + 085 (Concise DCF for Node 85): + 086 (Concise DCF for Node 86): + 087 (Concise DCF for Node 87): + 088 (Concise DCF for Node 88): + 089 (Concise DCF for Node 89): + 090 (Concise DCF for Node 90): + 091 (Concise DCF for Node 91): + 092 (Concise DCF for Node 92): + 093 (Concise DCF for Node 93): + 094 (Concise DCF for Node 94): + 095 (Concise DCF for Node 95): + 096 (Concise DCF for Node 96): + 097 (Concise DCF for Node 97): + 098 (Concise DCF for Node 98): + 099 (Concise DCF for Node 99): + 100 (Concise DCF for Node 100): + 101 (Concise DCF for Node 101): + 102 (Concise DCF for Node 102): + 103 (Concise DCF for Node 103): + 104 (Concise DCF for Node 104): + 105 (Concise DCF for Node 105): + 106 (Concise DCF for Node 106): + 107 (Concise DCF for Node 107): + 108 (Concise DCF for Node 108): + 109 (Concise DCF for Node 109): + 110 (Concise DCF for Node 110): + 111 (Concise DCF for Node 111): + 112 (Concise DCF for Node 112): + 113 (Concise DCF for Node 113): + 114 (Concise DCF for Node 114): + 115 (Concise DCF for Node 115): + 116 (Concise DCF for Node 116): + 117 (Concise DCF for Node 117): + 118 (Concise DCF for Node 118): + 119 (Concise DCF for Node 119): + 120 (Concise DCF for Node 120): + 121 (Concise DCF for Node 121): + 122 (Concise DCF for Node 122): + 123 (Concise DCF for Node 123): + 124 (Concise DCF for Node 124): + 125 (Concise DCF for Node 125): + 126 (Concise DCF for Node 126): + 127 (Concise DCF for Node 127): +2000 (Read Inputs): 0 +2001 (trashvariables): + 001 (TRASH1): 0 + 002 (TRASH8): 0 + 003 (TRASH16): 0 + 004 (TRASH32): 0 + 005 (TRASH64): 0 +2240 (__IB0_1_64): + 001 (24576_1): 0 + 002 (24578_1): 0 +2340 (__IW0_1_64): + 001 (25601_2): 0 + 002 (25601_3): 0 +2440 (__ID0_1_64): + 001 (25638_2): 0 + 002 (25638_3): 0 + 003 (25638_4): 0 + 004 (25638_1): 0 +4340 (__QW0_1_64): + 001 (25617_1): 0