etherlab/CommonEtherCATFunction.py
changeset 2361 5d6ce74f7835
parent 2360 2a3d022a7dac
child 2363 9c7da6ff6a34
equal deleted inserted replaced
2360:2a3d022a7dac 2361:5d6ce74f7835
   861         @return eeprom : "Strings" category EEPROM image data
   861         @return eeprom : "Strings" category EEPROM image data
   862         """
   862         """
   863         eeprom = []
   863         eeprom = []
   864         self.Strings = []
   864         self.Strings = []
   865         data = ""
   865         data = ""
   866         count = 0 # string counter
   866         count = 0        # string counter
   867         padflag = False # padding flag if category length is odd
   867         padflag = False  # padding flag if category length is odd
   868 
   868 
   869         # index information for General Category in EEPROM
   869         # index information for General Category in EEPROM
   870         self.GroupIdx = 0
   870         self.GroupIdx = 0
   871         self.ImgIdx = 0
   871         self.ImgIdx = 0
   872         self.OrderIdx = 0
   872         self.OrderIdx = 0
  1171         # word 2 : Device Type index and Device Name index in STRINGS Category
  1171         # word 2 : Device Type index and Device Name index in STRINGS Category
  1172         eeprom.append("{:0>2x}".format(self.OrderIdx))
  1172         eeprom.append("{:0>2x}".format(self.OrderIdx))
  1173         eeprom.append("{:0>2x}".format(self.NameIdx))
  1173         eeprom.append("{:0>2x}".format(self.NameIdx))
  1174 
  1174 
  1175         # word 3 : Physical Layer Port info. and CoE Details
  1175         # word 3 : Physical Layer Port info. and CoE Details
  1176         eeprom.append("01") # Physical Layer Port info - assume 01
  1176         eeprom.append("01")  # Physical Layer Port info - assume 01
  1177         #  CoE Details; <EtherCATInfo>-<Descriptions>-<Devices>-<Device>-<Mailbox>-<CoE>
  1177         #  CoE Details; <EtherCATInfo>-<Descriptions>-<Devices>-<Device>-<Mailbox>-<CoE>
  1178         coe_details = 0
  1178         coe_details = 0
  1179         mb = device.getMailbox()
  1179         mb = device.getMailbox()
  1180         coe_details = 1 # sdo enabled
  1180         coe_details = 1  # sdo enabled
  1181         if mb is not None :
  1181         if mb is not None :
  1182             coe = mb.getCoE()
  1182             coe = mb.getCoE()
  1183             if coe is not None:
  1183             if coe is not None:
  1184                 for bit,flag in enumerate(["SdoInfo", "PdoAssign", "PdoConfig",
  1184                 for bit,flag in enumerate(["SdoInfo", "PdoAssign", "PdoConfig",
  1185                                            "PdoUpload", "CompleteAccess"]):
  1185                                            "PdoUpload", "CompleteAccess"]):
  1212             if coe is not None :
  1212             if coe is not None :
  1213                 ds402ch = coe.getDS402Channels()
  1213                 ds402ch = coe.getDS402Channels()
  1214         eeprom.append("01" if ds402ch in [True,1] else "00")
  1214         eeprom.append("01" if ds402ch in [True,1] else "00")
  1215 
  1215 
  1216         # word 6 : SysmanClass(reserved) and Flags
  1216         # word 6 : SysmanClass(reserved) and Flags
  1217         eeprom.append("00") # reserved
  1217         eeprom.append("00")  # reserved
  1218         #  Flags
  1218         #  Flags
  1219         en_safeop = False
  1219         en_safeop = False
  1220         en_lrw = False
  1220         en_lrw = False
  1221         if device.getType().getTcCfgModeSafeOp() == True \
  1221         if device.getType().getTcCfgModeSafeOp() == True \
  1222         or device.getType().getTcCfgModeSafeOp() == 1:
  1222         or device.getType().getTcCfgModeSafeOp() == 1:
  1259         @param device : 'device' object in the slave ESI XML
  1259         @param device : 'device' object in the slave ESI XML
  1260         @return eeprom : "Strings" category EEPROM image data
  1260         @return eeprom : "Strings" category EEPROM image data
  1261         """
  1261         """
  1262         eeprom = []
  1262         eeprom = []
  1263         data = ""
  1263         data = ""
  1264         count = 0 # number of FMMU
  1264         count = 0  # number of FMMU
  1265         padflag = False
  1265         padflag = False
  1266 
  1266 
  1267         for fmmu in device.getFmmu():
  1267         for fmmu in device.getFmmu():
  1268             count += 1
  1268             count += 1
  1269             if fmmu.getcontent() == "Outputs":
  1269             if fmmu.getcontent() == "Outputs":