def __init__(self, chip_id, debug=False): rc = ecmd.ecmdLoadDll(os.environ['ECMD_DLL_FILE'], "ver13,ver14") if (rc): print("ERROR: problem on dll load") #setup chip target self.tgt = ecmd.ecmdChipTarget() self.tgt.chipType = "pu" self.tgt.cage = 0 self.tgt.node = 0 self.tgt.slot = 0 self.tgt.pos = chip_id self.tgt.core = 0 #self.looper = ecmd.ecmdLooperData(); #rc = ecmd.ecmdConfigLooperInit(self.tgt, ecmd.ECMD_ALL_TARGETS_LOOP, self.looper) #if (rc): # print("ERROR: problem calling ecmdConfigLooperInit") self.debug = debug
#!/usr/bin/python import ecmd tgts = ecmd.ecmdChipTargetList() tgt = ecmd.ecmdChipTarget() print("size: %d") % (tgts.size()) tgt.chipType = "chip 1" tgts.push_back(tgt) tgt.chipType = "chip 2" tgts.push_back(tgt) print("size: %d") % (tgts.size()) for tgt in tgts: print("name: %s") % (tgt.chipType) print("****") for i in range(0, tgts.size()): print("name: %s") % (tgts[i].chipType) print("****") tgt = tgts.pop() print("name: %s") % (tgt.chipType) print("****") tgts.push_back(tgt) for i in range(0, tgts.size()): print("name: %s") % (tgts[i].chipType)
print("ERROR: problem querying plugin") print("some dll info:\n"); print("dllType = %s" % dllInfo.dllType) print("dllProduct = %s" % dllInfo.dllProduct) print("dllProductType = %s" % dllInfo.dllProductType) print("dllEnv = %s" % dllInfo.dllEnv) print("dllBuildDate = %s" % dllInfo.dllBuildDate) print("dllCapiVersion = %s" % dllInfo.dllCapiVersion) print("dllBuildInfo = %s" % dllInfo.dllBuildInfo) # Pulling this test for now # It breaks builds where ring support isn't included, so some smarts would need to be put into it # JTA 11/11/2014 if (0): testNum+=1; print("dll %02d) Query Ring Info" % testNum) tgt = ecmd.ecmdChipTarget() ringInfo = ecmd.ecmdRingDataList() rc = ecmd.ecmdQueryRing(tgt, ringInfo) print("size: %d" % ringInfo.size()) for i in range(0, ringInfo.size()): for j in range(0, ringInfo[i].ringNames.size()): print("%s" % ringInfo[i].ringNames[j]) for item in ringInfo: for itemName in item.ringNames: print("%s" % itemName) for item in ringInfo: print("ringNames: "), for itemName in item.ringNames: print("%s " % itemName),
print("dllCapiVersion = %s" % dllInfo.dllCapiVersion) print("dllBuildInfo = %s" % dllInfo.dllBuildInfo) testNum += 1 print("dll %02d) Python tuple return example" % testNum) (rc, unitIdVer) = ecmd.ecmdGetUnitIdVersion() if (rc): print("ERROR: problem getting unit id version") else: print("Unit Id Version: %08x" % unitIdVer) # Make sure target hashing is working # If it is working, we can setup two different targets with the same states # The 2nd target should be able to access what was loaded for the 1st target # If it breaks, the target2 access will throw a key error target1 = ecmd.ecmdChipTarget() target2 = ecmd.ecmdChipTarget() target1.cageState = ecmd.ECMD_TARGET_FIELD_VALID target2.cageState = ecmd.ECMD_TARGET_FIELD_VALID targets = dict() targets[target1] = "hi" if (targets[target2] != "hi"): print("ERROR: target hashing broke!") # A couple deepcopy tests to make sure the defined __deepcopy__ functions work # If not, we'll take a traceback and the test will fail edborig = ecmd.ecmdDataBuffer() targetorig = ecmd.ecmdChipTarget() edbcopy = copy.deepcopy(edborig) targetcopy = copy.deepcopy(targetorig)