Something went wrong. Try again.
Completely reimplimented in zig (eventually)
Something went wrong. Try again.
Java
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744package com.microchip.mplab.ipecmd.displays;
import com.microchip.crownking.Pair;import com.microchip.crownking.edc.DCR;import com.microchip.crownking.edc.Field;import com.microchip.crownking.edc.MemoryPartition;import com.microchip.crownking.edc.Option;import com.microchip.crownking.edc.PIC;import com.microchip.crownking.edc.RegisterMap;import com.microchip.crownking.mplabinfo.FamilyDefinitions.Family;import com.microchip.crownking.mplabinfo.FamilyDefinitions.SubFamily;import com.microchip.mplab.crownkingx.xField;import com.microchip.mplab.crownkingx.xMemoryPartition;import com.microchip.mplab.crownkingx.xPIC;import com.microchip.mplab.ipe.displays.data.ConfigBitsData;import com.microchip.mplab.ipe.displays.data.ConfigField;import com.microchip.mplab.ipe.displays.data.ConfigSetting;import com.microchip.mplab.ipe.displays.data.ConfigWord;import com.microchip.mplab.ipe.displays.data.RegistersPIC;import com.microchip.mplab.ipe.displays.data.RegistersPIC.RegPIC;import com.microchip.mplab.ipelib.common.SharedData;import com.microchip.mplab.ipelib.device.CDevice;import com.microchip.mplab.ipelib.tools.IPENotifier;import com.microchip.mplab.mdbcore.memory.MemoryModel;import com.microchip.mplab.mdbcore.memory.PhysicalMemory;import com.microchip.mplab.mdbcore.memory.MultiPartition.MODE;import com.microchip.mplab.mdbcore.memory.memorytypes.ConfigurationBits;import com.microchip.mplab.mdbcore.memory.memorytypes.ProgramMemory;import com.microchip.mplab.mdbcore.memory.memorytypes.TestMemory;import java.io.UnsupportedEncodingException;import java.util.ArrayList;import java.util.Iterator;import java.util.List;import java.util.Map;import java.util.Map.Entry;import org.openide.util.Exceptions;import org.w3c.dom.Node;
public class MemoryView { private SharedData sharedData; private CDevice deviceInfo; private IPENotifier ipeNotify = null; private ConfigBitsData m_DataConfigBits = null; private ArrayList<ConfigWord> m_Words = null; private long userIDpic32 = 0L; private String[][] Memory; private long userIDpic32_Addr = 0L; private boolean todisplayascii = true; private RegistersPIC m_RegistersPIC;
public MemoryView(CDevice device) { this.deviceInfo = device; this.ipeNotify = IPENotifier.getIPENotifierController(); this.sharedData = SharedData.getSingletonObject(); }
public boolean showProgramMemory(long startAddr, long endAddr) { boolean retVal = false; int addrInc = 0; int numberOfColumns = 0; int bytesPerWord = 0; if (this.sharedData.getAssemblySession() != null && this.sharedData.getAssemblySession().GetDevice().getFamily().compareTo(Family.SEE) != 0) { bytesPerWord = this.deviceInfo.getBytesPerWord(); if (bytesPerWord != -1) { addrInc = this.deviceInfo.getAddrInc(); numberOfColumns = 16 / bytesPerWord; this.sharedData.setPgmMemBytes(this.deviceInfo.getPgmTotalMemoryInBytes(startAddr, endAddr)); if (this.deviceInfo.isProgramMemory()) { this.sharedData.setPgmMemBytes(this.deviceInfo.getProgramMemoryData(startAddr, endAddr)); retVal = this.displayProgramMemory( "Program Memory", this.deviceInfo.getPgmTotalMemoryInBytes(startAddr, endAddr), true, addrInc, numberOfColumns, bytesPerWord, startAddr, endAddr ); } } }
return retVal; }
public boolean showProgramMemory(String id, long startAddr, long endAddr) { boolean retVal = false; int addrInc = 0; int numberOfColumns = 0; int bytesPerWord = 0; if (this.sharedData.getAssemblySession() != null && this.sharedData.getAssemblySession().GetDevice().getFamily().compareTo(Family.SEE) != 0) { bytesPerWord = this.deviceInfo.getBytesPerWord(); if (bytesPerWord != -1) { addrInc = this.deviceInfo.getAddrInc(); numberOfColumns = 16 / bytesPerWord; if (id != null) { if (!this.sharedData.getAssemblySession().GetDevice().getIDOntoPartition().isEmpty() && id == null) { id = "Single"; }
long begin_Addr; if (this.sharedData.getAssemblySession().GetDevice().getIDOntoPartition().isEmpty()) { begin_Addr = 0L; long end_Addr = (Long)this.sharedData.getAssemblySession().GetDevice().getMainPartition().getCodeRange().second; } else { begin_Addr = (Long)((MemoryPartition)this.sharedData.getAssemblySession().GetDevice().getIDOntoPartition().get(id)).getCodeRange().first; if (begin_Addr > 0L) { begin_Addr -= (Long)((MemoryPartition)this.sharedData.getAssemblySession().GetDevice().getIDOntoPartition().get("only")).getCodeRange().first; }
long end_Addr = (Long)((MemoryPartition)this.sharedData.getAssemblySession().GetDevice().getIDOntoPartition().get(id)).getCodeRange().second; }
this.sharedData.setPgmMemBytes(2L * (endAddr - begin_Addr)); if (this.deviceInfo.isProgramMemory()) { this.sharedData.setPgmMemBytes(this.deviceInfo.getProgramMemoryData(id)); retVal = this.displayProgramMemory( "Program Memory", this.sharedData.getPgmMemBytes().length, true, addrInc, numberOfColumns, bytesPerWord, startAddr, endAddr ); } } else { this.sharedData.setPgmMemBytes(this.deviceInfo.getPgmTotalMemoryInBytes(startAddr, endAddr)); if (this.deviceInfo.isProgramMemory()) { this.sharedData.setPgmMemBytes(this.deviceInfo.getProgramMemoryData(startAddr, endAddr)); retVal = this.displayProgramMemory( "Program Memory", this.deviceInfo.getPgmTotalMemoryInBytes(startAddr, endAddr), true, addrInc, numberOfColumns, bytesPerWord, startAddr, endAddr ); } } } }
return retVal; }
public boolean showDataFlashMemory(long startAddr, long endAddr) { boolean retVal = false; int addrInc = 0; int numberOfColumns = 0; int bytesPerWord = 0; if (this.sharedData.getAssemblySession() != null && this.sharedData.getAssemblySession().GetDevice().getFamily().compareTo(Family.SEE) != 0) { bytesPerWord = this.deviceInfo.getBytesPerWord(); if (bytesPerWord != -1) { addrInc = this.deviceInfo.getAddrInc(); numberOfColumns = 16 / bytesPerWord; this.sharedData.setPgmMemBytes(this.deviceInfo.getDataFlashMemory()); if (this.deviceInfo.isDataFlash()) { this.sharedData.setPgmMemBytes(this.deviceInfo.getDataFlashMemory()); retVal = this.showDataFlash(startAddr, endAddr); } } }
return retVal; }
public boolean displayProgramMemory(String typOfMemory, long totByte, boolean isMemory, int adinc, int noC, int byPW, long startAddr, long endAddr) { int count = 0; long dat = 0L; String dataDisplayOnRow = ""; String s = null; byte[] memDat = null; boolean retVal = true; long currentRangeAddr = 0L; if (!this.sharedData.getUIMode()) { long actualStartAddress = 0L; if (this.sharedData.getDeviceName().getMainPartition().hasCode()) { actualStartAddress = (Long)this.sharedData.getDeviceName().getMainPartition().getCodeRange().first; }
if (this.sharedData.getAssemblySession().GetDevice().getFamily() == Family.PIC32) { count = (int)(byPW * adinc * (startAddr - actualStartAddress)); } else if (this.sharedData.getAssemblySession().GetDeviceName().startsWith("ATSAM")) { count = 0; } else { count = (int)(byPW / adinc * startAddr); } }
memDat = this.sharedData.getPgmMemBytes(); if (memDat.length == totByte && totByte != 0L) { float remainder = (float)(totByte % 16L); totByte /= 16L; if (remainder > 0.0) { totByte++; }
if (this.todisplayascii) { this.Memory = new String[(int)totByte + 1][noC + 2]; } else { this.Memory = new String[(int)totByte + 1][noC + 1]; }
for (int ilp = 0; ilp < totByte; ilp++) { String[] buff; if (this.todisplayascii) { buff = new String[noC + 2]; } else { buff = new String[noC + 1]; }
int jlp = 0; if (adinc != 4) { buff[0] = String.format("%06X", startAddr + ilp * noC * adinc); } else { buff[0] = String.format("%08X", Long.valueOf(Long.toHexString(startAddr), 16) + ilp * noC * adinc); String tempS = buff[0].substring(4).toUpperCase(); String tempP = buff[0].substring(0, 4).toUpperCase(); if (this.sharedData.getUIMode()) { buff[0] = String.format("%s_%s", tempP, tempS); } else { buff[0] = String.format("%s%s", tempP, tempS); } }
currentRangeAddr = this.sharedData.hexToDecimal(buff[0]); String[] labelString; if (this.todisplayascii) { labelString = new String[noC + 2]; } else { labelString = new String[noC + 1]; }
labelString[0] = "Address";
for (int m = 1; m < noC + 1; m++) { if (this.sharedData.getAssemblySession().GetDevice().getMemTraits().getCodeWordTraits().getAddrInc() == 2L) { labelString[m] = ""; } else { labelString[m] = Long.toHexString(adinc * (m - 1)).toUpperCase(); } }
labelString[noC + 1] = "ASCII"; this.Memory[0] = labelString; String k1 = "";
for (int var29 = 1; var29 <= noC; var29++) { if (byPW == 4) { if (count < memDat.length) { if (count == memDat.length - 1) { break; }
dat = this.sharedData.getMSBLSB32(memDat[count + 3], memDat[count + 2], memDat[count + 1], memDat[count]); if (adinc == 2) { s = String.format("%1$06X", dat).toUpperCase(); if (s.length() > 6) { s = s.substring(s.length() - 6, s.length()); } } else { s = String.format("%08X", dat); } } else { s = "-- -- --"; }
buff[var29] = s; if (!s.equals("-- -- --")) { k1 = k1 + " " + this.getASCIIValue(memDat[count], memDat[count + 1], memDat[count + 2], memDat[count + 3]); }
if (this.todisplayascii && var29 == noC && !k1.equals("")) { buff[noC + 1] = k1; }
count += 4; } else { if (count < memDat.length) { dat = this.sharedData.getMSBLSB_Integer(memDat[count + 1], memDat[count]); s = String.format("%1$04X", dat).toUpperCase(); } else { s = "-- --"; }
buff[var29] = s; if (!s.equals("-- --")) { k1 = k1 + " " + this.getASCIIValuefor2Values(memDat[count], memDat[count + 1]); }
if (this.todisplayascii && var29 == noC && !k1.equals("")) { buff[noC + 1] = k1; }
count += 2; } }
if (this.sharedData.getUIMode()) { System.arraycopy(buff, 0, this.Memory[ilp + 1], 0, buff.length); } else { dataDisplayOnRow = "";
for (int localLoop = 0; localLoop < buff.length; localLoop++) { dataDisplayOnRow = dataDisplayOnRow + buff[localLoop] + " "; }
if (currentRangeAddr >= startAddr && currentRangeAddr <= endAddr) { this.ipeNotify.setMessageNotification(dataDisplayOnRow); } } } }
return retVal; }
private String getASCIIValuefor1Values(byte msb) { return this.validate(msb); }
private String getASCIIValuefor2Values(byte msb, byte lsb) { byte[] byteArray = new byte[]{msb, lsb}; String result = "";
for (int i = 0; i < byteArray.length; i++) { result = result + this.validate(byteArray[i]); }
return result; }
private String getASCIIValue(byte msb1, byte msb2, byte lsb1, byte lsb2) { byte[] byteArray = new byte[]{msb1, msb2, lsb1, lsb2}; String result = "";
for (int i = 0; i < byteArray.length; i++) { result = result + this.validate(byteArray[i]); }
return result; }
private String validate(byte value) { byte[] byteArray = new byte[]{value}; String result = ""; int temp = 0; String s = String.format("%x", value); temp = Integer.valueOf(s, 16); if (temp >= 32 && temp < 127) { try { result = new String(byteArray, "ASCII"); } catch (UnsupportedEncodingException var7) { Exceptions.printStackTrace(var7); }
return result; } else { return "."; } }
public String[][] getMemoryArray() { return this.Memory; }
public boolean showEEMemory(long startAddr, long endAddr) { boolean retVal = true; int addrInc = 0; int numberOfColumns = 0; int bytesPerWord = 0; int cou = 0; String s1 = null; long dat = 0L; int count = 0; long currentRangeAddr = 0L; String dataDisplayOnRow = ""; if (this.sharedData.getAssemblySession() != null) { if (!this.deviceInfo.isValidEEMemoryRange(startAddr, endAddr)) { return false; }
int var33 = 1; int var31 = 1; float remainder = (float)((endAddr - startAddr) % 16L); numberOfColumns = 16 / var33; String[] labelString = new String[numberOfColumns + 1]; labelString[0] = "Address";
for (int m = 1; m < numberOfColumns + 1; m++) { labelString[m] = Long.toHexString(var31 * (m - 1)).toUpperCase(); }
byte[] relevanBytes = null; this.sharedData.setEEMemBytes((int)(endAddr - startAddr)); if (this.deviceInfo.isEEMemory() && this.deviceInfo.getEEmemoryRange()) { byte[] dummy = this.deviceInfo.getEEMemoryData(); relevanBytes = new byte[(int)(endAddr - startAddr)]; if (startAddr > dummy.length) { startAddr -= (Long)this.sharedData.getDeviceName().getMagicEEDataRange().first; endAddr -= (Long)this.sharedData.getDeviceName().getMagicEEDataRange().first; }
System.arraycopy(dummy, (int)startAddr, relevanBytes, 0, relevanBytes.length); this.sharedData.setEEMemBytes(relevanBytes); }
long p = (endAddr - startAddr) / 16L; if (remainder > 0.0) { p++; }
byte[] eeB = relevanBytes; long il = 0L; if (this.todisplayascii) { this.Memory = new String[(int)p + 1][numberOfColumns + 2]; } else { this.Memory = new String[(int)p + 1][numberOfColumns + 1]; }
for (long var42 = 0L; var42 < p; var42++) { int jl = 0; String[] buff1; if (this.todisplayascii) { buff1 = new String[numberOfColumns + 2]; } else { buff1 = new String[numberOfColumns + 1]; }
buff1[0] = String.format("%06X", startAddr + var42 * numberOfColumns * var31); if (this.todisplayascii) { labelString = new String[numberOfColumns + 2]; } else { labelString = new String[numberOfColumns + 1]; }
labelString[0] = "Address";
for (int m = 1; m < numberOfColumns + 1; m++) { labelString[m] = Long.toHexString(var31 * (m - 1)).toUpperCase(); }
labelString[numberOfColumns + 1] = "ASCII"; this.Memory[0] = labelString; Family family = this.sharedData.getAssemblySession().GetDevice().getFamily(); if (family != Family.DSPIC30 && family != Family.DSPIC33 && family != Family.PIC24) { currentRangeAddr = this.sharedData.hexToDecimal(buff1[0]); } else { currentRangeAddr = this.sharedData.hexToDecimal(buff1[0]) + (Long)this.sharedData.getAssemblySession().GetDevice().getEEDataRange().first; }
String k1 = "";
for (int jlp = 1; jlp <= numberOfColumns; jlp++) { if (var31 == 2) { String s; if (count < eeB.length) { dat = this.sharedData.getMSBLSB_Integer(eeB[count + 1], eeB[count]); s = String.format("%04X", dat); } else { s = "--"; }
buff1[jlp] = s; if (!s.equals("--")) { k1 = k1 + " " + this.getASCIIValuefor2Values(eeB[count], eeB[count + 1]); }
if (this.todisplayascii && jlp == numberOfColumns && !k1.equals("")) { buff1[numberOfColumns + 1] = k1; } } else { String sx; if (count < eeB.length) { dat = this.sharedData.getByteasInt(eeB[count]); sx = String.format("%02X", dat); } else { sx = "--"; }
buff1[jlp] = sx; if (!sx.equals("--")) { k1 = k1 + " " + this.getASCIIValuefor1Values(eeB[count]); }
if (this.todisplayascii && jlp == numberOfColumns && !k1.equals("")) { buff1[numberOfColumns + 1] = k1; } }
count += var31; }
if (this.sharedData.getUIMode()) { for (int i = 0; i < buff1.length; i++) { this.Memory[(int)var42 + 1][i] = buff1[i]; } } else { dataDisplayOnRow = "";
for (int localLoop = 0; localLoop < buff1.length; localLoop++) { dataDisplayOnRow = dataDisplayOnRow + buff1[localLoop] + " "; }
if (family == Family.DSPIC30 || family == Family.DSPIC33 || family == Family.PIC24) { this.ipeNotify.setMessageNotification(dataDisplayOnRow); } else if (currentRangeAddr >= startAddr && currentRangeAddr <= endAddr) { this.ipeNotify.setMessageNotification(dataDisplayOnRow); } } } }
return retVal; }
public boolean showUserIDinUI() { int addrInc = 0; int numberOfColumns = 0; int bytesPerWord = 0; long dat = 0L; int count = 0; String s = ""; String UserIDtoDisplay = ""; String dataDisplayOnRow = ""; String[] elabelString = new String[]{"Address", "USER ID"}; Family family = this.sharedData.getDeviceName().getFamily(); if (this.sharedData.getAssemblySession() != null && this.sharedData.getAssemblySession().GetDevice().getFamily().compareTo(Family.SEE) != 0) { String maskset = this.sharedData.getAssemblySession().GetDevice().get("masksetid"); if (!maskset.contains("KFAB") && !maskset.contains("KFAE")) { bytesPerWord = (int)this.sharedData.getDeviceName().getMemTraits().getUserIDWordTraits().getWordSize(); } else { bytesPerWord = 2; }
if (this.deviceInfo.hasOTPMemory()) { bytesPerWord = (int)this.sharedData.getDeviceName().getMemTraits().getUserOTPWordTraits().getWordSize(); }
if (bytesPerWord != -1) { addrInc = this.deviceInfo.getAddrInc(); numberOfColumns = 16 / bytesPerWord; } }
String[] labelString = new String[numberOfColumns + 2]; labelString[0] = "Address";
for (int m = 1; m < numberOfColumns + 1; m++) { labelString[m] = Long.toHexString(addrInc * (m - 1)).toUpperCase(); }
labelString[numberOfColumns + 1] = "ASCII"; this.sharedData.setUserIDMemBytes(this.deviceInfo.getuserIDTotalBytes()); long userIDTotalBytes = this.deviceInfo.getuserIDTotalBytes(); byte[] UserIDbuf = new byte[(int)userIDTotalBytes]; if (this.deviceInfo.isUserID() || this.deviceInfo.hasOTPMemory()) { UserIDbuf = this.deviceInfo.getUserIDdata(); } else if (this.sharedData.getDeviceName().getFamily().is32Bit()) { this.initConfigWordsXML1("ACTIVE"); UserIDbuf[0] = (byte)(this.userIDpic32 & 255L); UserIDbuf[1] = (byte)(this.userIDpic32 >> 8 & 255L); }
if (this.deviceInfo.getuserIDTotalBytes() > 16L) { long totB = this.deviceInfo.getuserIDTotalBytes(); totB /= 16L; this.Memory = new String[(int)totB + 1][numberOfColumns + 2]; this.Memory[0] = labelString;
for (int ilp = 0; ilp < totB; ilp++) { String[] buff1 = new String[numberOfColumns + 2]; int jlp = 0; buff1[0] = String.format("%06X", ilp * numberOfColumns * addrInc + this.deviceInfo.getUSerIDAdd()); String k1 = "";
for (int var44 = 1; var44 <= numberOfColumns; var44++) { if (bytesPerWord == 4) { dat = this.sharedData.getMSBLSB32(UserIDbuf[count + 3], UserIDbuf[count + 2], UserIDbuf[count + 1], UserIDbuf[count]); s = String.format("%1$06X", dat); if (s.length() > 6) { s = s.substring(s.length() - 6, s.length()); }
buff1[var44] = s; k1 = k1 + " " + this.getASCIIValue(UserIDbuf[count], UserIDbuf[count + 1], UserIDbuf[count + 2], UserIDbuf[count + 3]); if (this.todisplayascii && var44 == numberOfColumns) { buff1[numberOfColumns + 1] = k1; }
count += bytesPerWord; } else { dat = this.sharedData.getMSBLSB_Integer(UserIDbuf[count + 1], UserIDbuf[count]); s = String.format("%1$04X", dat); if (s.length() > 4) { s = s.substring(s.length() - 4, s.length()); }
buff1[var44] = s; k1 = k1 + " " + this.getASCIIValuefor2Values(UserIDbuf[count], UserIDbuf[count + 1]); if (this.todisplayascii && var44 == numberOfColumns) { buff1[numberOfColumns + 1] = k1; }
count += bytesPerWord; } }
this.Memory[ilp + 1] = buff1; } } else { String[] TableRowArray = new String[2]; if (this.sharedData.getDeviceName().getFamily().is32Bit()) { this.Memory = new String[2][2]; this.Memory[0] = elabelString; TableRowArray[0] = Long.toHexString(this.userIDpic32_Addr).toUpperCase(); TableRowArray[1] = Long.toHexString(this.userIDpic32).toUpperCase(); this.Memory[1] = TableRowArray; this.displayUserID(this.Memory); return true; }
if (family == Family.PIC18) { this.Memory = new String[UserIDbuf.length + 1][2]; this.Memory[0] = elabelString;
for (int y = 0; y < UserIDbuf.length; y++) { String h = String.format("%X", UserIDbuf[y]); String[] arr = new String[]{Long.toHexString((Long)this.sharedData.getDeviceName().getUserIDRange().first + y), h.toUpperCase()}; this.Memory[y + 1] = arr; } } else { try { if (UserIDbuf.length == 2) { UserIDtoDisplay = this.sharedData.getMSBLSB(UserIDbuf[1], UserIDbuf[0]).toUpperCase(); TableRowArray[0] = Long.toHexString(this.deviceInfo.getUSerIDAdd()); TableRowArray[1] = UserIDtoDisplay; this.Memory = new String[2][1]; this.Memory[0] = elabelString; this.Memory[1] = TableRowArray; } else if (UserIDbuf.length == 4) { String[] temp = new String[]{ this.sharedData.getUserID(UserIDbuf[1]) + this.sharedData.getUserID(UserIDbuf[0]), null, this.sharedData.getUserID(UserIDbuf[3]) + this.sharedData.getUserID(UserIDbuf[2]), null }; this.Memory = new String[3][2]; this.Memory[0] = elabelString;
for (int y = 0; y < 2; y++) { String[] array = new String[]{ Long.toHexString( (Long)this.sharedData.getDeviceName().getUserIDRange().first + this.sharedData.getDeviceName().getMemTraits().getUserIDWordTraits().getAddrInc() * y ), temp[y * 2] }; this.Memory[y + 1] = array; } } else { if (UserIDbuf.length < 8) { UserIDtoDisplay = UserIDtoDisplay.concat(this.sharedData.getMSBLSB(UserIDbuf[0], UserIDbuf[2]).toUpperCase()); TableRowArray[1] = UserIDtoDisplay; TableRowArray[0] = Long.toHexString(this.deviceInfo.getUSerIDAdd()).toUpperCase(); this.Memory = new String[2][1]; this.Memory[0] = elabelString; this.Memory[1] = TableRowArray; return true; }
if (UserIDbuf.length == 8) { String[] temp = new String[8]; temp[0] = this.sharedData.getUserID(UserIDbuf[1]) + this.sharedData.getUserID(UserIDbuf[0]); temp[2] = this.sharedData.getUserID(UserIDbuf[3]) + this.sharedData.getUserID(UserIDbuf[2]); temp[4] = this.sharedData.getUserID(UserIDbuf[5]) + this.sharedData.getUserID(UserIDbuf[4]); temp[6] = this.sharedData.getUserID(UserIDbuf[7]) + this.sharedData.getUserID(UserIDbuf[6]); this.Memory = new String[5][2]; this.Memory[0] = elabelString;
for (int y = 0; y < 4; y++) { String[] array = new String[]{ Long.toHexString( (Long)this.sharedData.getDeviceName().getUserIDRange().first + this.sharedData.getDeviceName().getMemTraits().getUserIDWordTraits().getAddrInc() * y ), temp[y * 2] }; this.Memory[y + 1] = array; } } else { int mask = 255; if (this.deviceInfo.getuserIDTotalBytes() == 8L && family == Family.Midrange) { mask = 127; } else if (this.deviceInfo.getuserIDTotalBytes() == 8L && family == Family.Baseline) { mask = 15; }
UserIDbuf[0] = (byte)(UserIDbuf[0] & mask); UserIDbuf[2] = (byte)(UserIDbuf[2] & mask); UserIDbuf[4] = (byte)(UserIDbuf[4] & mask); UserIDbuf[6] = (byte)(UserIDbuf[6] & mask); this.Memory = new String[5][2]; this.Memory[0] = elabelString;
for (int y = 0; y < 4; y++) { String[] array = new String[]{ Long.toHexString( (Long)this.sharedData.getDeviceName().getUserIDRange().first + this.sharedData.getDeviceName().getMemTraits().getUserIDWordTraits().getAddrInc() * y ), this.sharedData.getUserID(UserIDbuf[y * 2]) }; this.Memory[y + 1] = array; } } } } catch (Exception var22) { } } }
this.displayUserID(this.Memory); return true; }
private void displayUserID(String[][] mem) { StringBuilder result = new StringBuilder();
for (int i = 0; i < mem.length; i++) { for (int j = 0; j < mem[i].length; j++) { if (j > 0) { result.append(mem[i][j]); result.append("\n"); } else { result.append(mem[i][j]).append(" "); } } }
this.ipeNotify.setMessageNotification(result.toString()); }
public boolean showUserID(long startAddr, long endAddr) { boolean retVal = true; int addrInc = 0; int numberOfColumns = 0; int bytesPerWord = 0; long dat = 0L; int count = 0; String s = ""; String UserIDtoDisplay = ""; String dataDisplayOnRow = ""; if (this.sharedData.getAssemblySession() != null && this.sharedData.getAssemblySession().GetDevice().getFamily().compareTo(Family.SEE) != 0) { bytesPerWord = this.deviceInfo.getBytesPerWord(); if (bytesPerWord != -1) { addrInc = this.deviceInfo.getAddrInc(); numberOfColumns = 16 / bytesPerWord; } }
String[] labelString = new String[numberOfColumns + 1]; labelString[0] = "Address";
for (int m = 1; m < numberOfColumns + 1; m++) { labelString[m] = Long.toHexString(addrInc * (m - 1)).toUpperCase(); }
if (!this.deviceInfo.isUserID()) { return false; } else { this.sharedData.setUserIDMemBytes(this.deviceInfo.getuserIDTotalBytes()); long userIDTotalBytes = this.deviceInfo.getuserIDTotalBytes(); byte[] UserIDbuf = new byte[(int)userIDTotalBytes]; if (this.deviceInfo.isUserID()) { UserIDbuf = this.deviceInfo.getUserIDdata(); } else if (this.sharedData.getAssemblySession().GetDevice().getFamily().is32Bit()) { this.initConfigWordsXML(); UserIDbuf[0] = (byte)(this.userIDpic32 & 255L); UserIDbuf[1] = (byte)(this.userIDpic32 >> 8 & 255L); }
if (this.deviceInfo.getuserIDTotalBytes() > 16L) { long totB = this.deviceInfo.getuserIDTotalBytes(); totB /= 16L;
for (int ilp = 0; ilp < totB; ilp++) { String[] buff1 = new String[numberOfColumns + 1]; int jlp = 0; buff1[0] = String.format("%06X", ilp * numberOfColumns * addrInc + this.deviceInfo.getUSerIDAdd());
for (int var40 = 1; var40 <= numberOfColumns; var40++) { dat = this.sharedData.getMSBLSB32(UserIDbuf[count + 3], UserIDbuf[count + 2], UserIDbuf[count + 1], UserIDbuf[count]); s = String.format("%1$06X", dat); if (s.length() > 6) { s = s.substring(s.length() - 6, s.length()); }
buff1[var40] = s; count += 4; }
dataDisplayOnRow = "";
for (int localLoop = 0; localLoop < buff1.length; localLoop++) { dataDisplayOnRow = dataDisplayOnRow + buff1[localLoop] + " "; }
this.ipeNotify.setMessageNotification(dataDisplayOnRow); } } else { String[] var10000 = new String[]{"Address", "USER ID"}; int totBytesToDisplay = (int)(this.deviceInfo.getuserIDTotalBytes() / this.deviceInfo.getBytesPerWord()); String[] UserIDAddsArray = new String[totBytesToDisplay]; String[] UserIDDataArray = new String[totBytesToDisplay]; if (this.sharedData.getAssemblySession().GetDevice().getFamily().is32Bit()) { UserIDAddsArray[0] = Long.toHexString(this.userIDpic32_Addr).toUpperCase(); }
UserIDtoDisplay = "";
try { int sf = UserIDbuf.length; if (this.sharedData.getAssemblySession().GetDevice().getFamily() == Family.PIC18) { for (int y = 0; y < sf; y++) { String h = String.format("%x", UserIDbuf[y]); UserIDDataArray[0] = UserIDtoDisplay.concat(Long.toHexString(Integer.valueOf(h, 16).longValue()).toUpperCase() + "\t"); } } else if (UserIDbuf.length == 2) { UserIDDataArray[0] = this.sharedData.getMSBLSB(UserIDbuf[1], UserIDbuf[0]).toUpperCase(); } else if (UserIDbuf.length < 8) { UserIDDataArray[0] = UserIDtoDisplay.concat(this.sharedData.getMSBLSB(UserIDbuf[0], UserIDbuf[2]).toUpperCase()); } else { int mask = 255; Family family = this.sharedData.getDeviceName().getFamily(); if (this.deviceInfo.getuserIDTotalBytes() == 8L && family == Family.Midrange) { mask = 255; } else if (this.deviceInfo.getuserIDTotalBytes() == 8L && family == Family.Baseline) { mask = 15; }
UserIDbuf[0] = (byte)(UserIDbuf[0] & mask); UserIDbuf[2] = (byte)(UserIDbuf[2] & mask); UserIDbuf[4] = (byte)(UserIDbuf[4] & mask); UserIDbuf[6] = (byte)(UserIDbuf[6] & mask); int index = 0;
for (int i = 0; i < UserIDbuf.length; i += 2) { UserIDDataArray[index] = UserIDtoDisplay.concat(this.sharedData.getMSBLSB(UserIDbuf[i + 1], UserIDbuf[i]).toUpperCase()); UserIDAddsArray[index] = Long.toHexString(this.deviceInfo.getUSerIDAdd() + index).toUpperCase(); index++; } } } catch (Exception var28) { }
dataDisplayOnRow = "";
for (int localLoop = 0; localLoop < UserIDAddsArray.length; localLoop++) { dataDisplayOnRow = UserIDAddsArray[localLoop] + " - " + UserIDDataArray[localLoop]; this.ipeNotify.setMessageNotification(dataDisplayOnRow); } }
return retVal; } }
public boolean initConfigWordsXML() { boolean bAdded = false; boolean bRet = false; int m_nRowFieldCount = 0; int m_nFieldDescMaxLen = 0; int m_numberOfWords = 0; if (this.deviceInfo.getConfigMemoryData() == null) { return false; } else { this.m_DataConfigBits = new ConfigBitsData(this.sharedData.getAssemblySession()); if (this.m_Words != null) { this.m_Words.clear(); }
xPIC m_pic = null; m_pic = this.sharedData.getAssemblySession().GetDevice(); if (!(m_pic instanceof PIC)) { return false; } else { byte[] config = new byte[this.deviceInfo.getConfigMemoryData().length + 10]; config = this.deviceInfo.getConfigMemoryData(); int a = 0; this.m_Words = new ArrayList<>();
for (Entry<Long, Node> entry : m_pic.getAddrOntoDCR().entrySet()) { long nAddr = entry.getKey(); Node node = entry.getValue(); DCR reg = new DCR(node); String regName = reg.getName(); long uDef = 0L; if (this.deviceInfo.getConfigBytesPerWord() == 4) { uDef = config[a + 3]; uDef &= 255L; uDef <<= 8; uDef += config[a + 2] & 255L; }
if (this.deviceInfo.getConfigBytesPerWord() != 1) { if (config.length > a) { uDef = config[a + 1]; uDef &= 255L; uDef <<= 8; uDef += config[a] & 255L; } } else { uDef += config[a] & 255L; }
a += this.deviceInfo.getConfigBytesPerWord(); ConfigWord cfgWord = new ConfigWord(); cfgWord.ConfigWordName = regName; cfgWord.address = nAddr; cfgWord.defaultValue = uDef;
for (Entry<Long, Node> bitField : reg.getPlaceOntoField().entrySet()) { ConfigField cfgField = new ConfigField(); long uBit = bitField.getKey(); Node bitNode = bitField.getValue(); Field field = new xField(bitNode); boolean bHide = field.isHidden(); String fieldNam = field.getName(); if (fieldNam.equalsIgnoreCase("userid")) { this.userIDpic32 = field.getMask(); this.userIDpic32 &= uDef; this.userIDpic32_Addr = nAddr; }
boolean debug = field.getName().equalsIgnoreCase("DEBUG") || field.getName().equalsIgnoreCase("BKBUG") || field.getName().equalsIgnoreCase("BACKBUG"); if (debug) { }
if (!bHide) { String fieldName = field.getName(); String fieldDesc = field.getDesc(); long uMask = field.getMask(); long uBitMask = uMask << (int)uBit; m_nRowFieldCount++; cfgField.FieldName = fieldName; cfgField.FieldCategory = fieldDesc; cfgField.mask = uBitMask; cfgWord.mask = uBitMask;
for (Node optionNode : field.getUniqueOptions()) { Option option = new Option(optionNode); ConfigSetting cfgSetting = new ConfigSetting(); cfgSetting.OptionName = option.getName(); cfgSetting.SettingDesc = option.getDesc(); Long optMask = option.getMask() << (int)uBit; Long optVal = option.getValue() << (int)uBit; cfgSetting.SettingValue = optVal; cfgSetting.SettingReqd = optMask; cfgField.m_Set.add(cfgSetting); int DescLen = cfgSetting.SettingDesc.length(); if (m_nFieldDescMaxLen < DescLen) { m_nFieldDescMaxLen = DescLen; } }
if (cfgField.m_Set.size() > 0 && cfgField.FieldName.length() > 0) { cfgField.CurrentSettingDesc = ((ConfigSetting)cfgField.m_Set.get(0)).SettingDesc; cfgField.CurrentOptionName = ((ConfigSetting)cfgField.m_Set.get(0)).OptionName; }
bAdded = cfgWord.m_Field.add(cfgField); } }
bAdded = this.m_Words.add(cfgWord); m_numberOfWords = Math.max(1, m_numberOfWords); }
this.m_DataConfigBits.m_Words = this.m_Words; m_pic = null; return bRet; } } }
public byte[] getConfigMemoryData(String prefix) { PhysicalMemory configMemory = this.deviceInfo.getMemory(ConfigurationBits.class); if (configMemory != null) { long begin_Addr = (Long)this.sharedData.getDeviceName().getMainPartition().getDCRRange().first; long end_Addr = (Long)this.sharedData.getDeviceName().getMainPartition().getDCRRange().second; if (!this.sharedData.getDeviceName().getIDOntoPartition().isEmpty() && !prefix.equals("bootcfg")) { if (prefix.equals("")) { prefix = "only"; }
MemoryPartition part = (MemoryPartition)this.sharedData.getDeviceName().getIDOntoPartition().get(prefix); begin_Addr = (Long)part.getDCRRange().first; end_Addr = (Long)part.getDCRRange().second; }
long memDiff = end_Addr - begin_Addr; int offset = (int)((int)memDiff * this.sharedData.getDeviceName().getMemTraits().getConfigFuseWordTraits().getWordSize()); if (offset > 0) { byte[] bytes = new byte[offset]; configMemory.RefreshFromTarget(begin_Addr, offset); configMemory.Read(begin_Addr, offset, bytes); return bytes; } else { return null; } } else { return null; } }
public boolean initConfigWordsXML1(String strRegisterPrefix) { if (this.getConfigMemoryData("") == null) { return false; } else { this.m_DataConfigBits = new ConfigBitsData(this.sharedData.getAssemblySession()); boolean bRet = false; int m_nRowFieldCount = 0; int m_nFieldDescMaxLen = 0; int m_numberOfWords = 0; if (this.m_Words != null) { this.m_Words.clear(); }
xPIC m_pic = null; m_pic = this.sharedData.getDeviceName(); RegisterMap rm = null; if (m_pic instanceof xPIC) { boolean m_bhasPartitions = !m_pic.getIDOntoPartition().isEmpty(); xMemoryPartition xmp = m_pic.getMainPartition(); if (xmp instanceof xMemoryPartition) { if (m_bhasPartitions && strRegisterPrefix.equalsIgnoreCase("bootcfg")) { rm = xmp.getRegisterMap(); } else if (m_bhasPartitions && !strRegisterPrefix.isEmpty()) { MemoryPartition part = (MemoryPartition)m_pic.getIDOntoPartition().get(strRegisterPrefix); if (part instanceof MemoryPartition) { rm = part.getRegisterMap(); } }
if (rm == null) { rm = xmp.getRegisterMap(); } } }
if (!(rm instanceof RegisterMap)) { return false; } else { this.m_Words = new ArrayList<>(); SubFamily subFamily = m_pic.getSubFamily(); boolean bPIC32MZ_FILTER = false; if (subFamily == SubFamily.PIC32MZ && 0 != strRegisterPrefix.compareTo("ACTIVE")) { bPIC32MZ_FILTER = true; }
Map<Long, Node> mapEntry; if (bPIC32MZ_FILTER) { mapEntry = rm.getAddrOntoAltDCR(); } else { mapEntry = rm.getAddrOntoDCR(); }
for (Entry<Long, Node> entry : mapEntry.entrySet()) { long nAddr = entry.getKey(); Node node = entry.getValue(); DCR reg = new DCR(node); String regName = reg.getName(); long uDef = reg.getDefault(); if (!bPIC32MZ_FILTER || regName.startsWith(strRegisterPrefix)) { ConfigWord cfgWord = new ConfigWord(); cfgWord.ConfigWordName = regName; cfgWord.address = nAddr; cfgWord.defaultValue = this.deviceInfo.getMemory(ConfigurationBits.class).GetMemoryModel().GetPhysicalMemory().ReadWord(nAddr);
for (Entry<Long, Node> bitField : reg.getPlaceOntoField().entrySet()) { ConfigField cfgField = new ConfigField(); long uBit = bitField.getKey(); Node bitNode = bitField.getValue(); Field field = new xField(bitNode); boolean bHide = field.isHidden(); String fieldNam = field.getName(); if (fieldNam.equalsIgnoreCase("userid")) { this.userIDpic32 = field.getMask(); if (this.sharedData.getAssemblySession().GetDevice().getSubFamily() == SubFamily.PIC32MM) { this.userIDpic32 = cfgWord.defaultValue >> 16; } else { this.userIDpic32 = cfgWord.defaultValue & this.userIDpic32; }
this.userIDpic32_Addr = nAddr; }
if (!bHide) { String fieldName = field.getName(); String fieldDesc = field.getDesc(); long uMask = field.getMask(); long uBitMask = uMask << (int)uBit; m_nRowFieldCount++; cfgField.FieldName = fieldName; cfgField.FieldCategory = fieldDesc; cfgField.mask = uBitMask; cfgWord.mask = uBitMask;
for (Node optionNode : field.getUniqueOptions()) { try { Option option = new Option(optionNode); cfgField.bValueRange = option.isRange(); ConfigSetting cfgSetting = new ConfigSetting(); cfgSetting.OptionName = option.getName(); cfgSetting.SettingDesc = option.getDesc(); if (cfgField.bValueRange) { Long optMinValue = cfgSetting.MinValue = option.getMinValue(); Long optMaxValue = cfgSetting.MaxValue = option.getMaxValue(); System.out.println(cfgSetting.OptionName + " : " + cfgSetting.SettingDesc); System.out.println("MinValue=0x" + Long.toHexString(optMinValue) + " : Val=0x" + Long.toHexString(optMaxValue)); } else { long optMask = option.getMask() << (int)uBit; long optVal = option.getValue() << (int)uBit; cfgSetting.SettingValue = optVal; cfgSetting.SettingReqd = optMask; }
cfgField.m_Set.add(cfgSetting); int DescLen = cfgSetting.SettingDesc.length(); if (m_nFieldDescMaxLen < DescLen) { m_nFieldDescMaxLen = DescLen; } } catch (Exception var45) { } }
if (cfgField.m_Set.size() > 0 && cfgField.FieldName.length() > 0) { cfgField.CurrentSettingDesc = ((ConfigSetting)cfgField.m_Set.get(0)).SettingDesc; cfgField.CurrentOptionName = ((ConfigSetting)cfgField.m_Set.get(0)).OptionName; }
boolean bAdded = cfgWord.m_Field.add(cfgField); } else { System.out.println(field.getName()); System.out.println(field.getMask()); System.out.println("\n"); } }
boolean bAdded = this.m_Words.add(cfgWord); m_numberOfWords = Math.max(1, m_numberOfWords); } }
this.m_DataConfigBits.m_Words = this.m_Words; m_pic = null; return bRet; } } }
boolean updateSettings(long lAddress, long lSize) { MemoryModel m_Memory = this.deviceInfo.getMemModel(); if (!(this.m_DataConfigBits instanceof ConfigBitsData)) { return false; } else { for (long K = 0L; K < lSize; K += m_Memory.WordIncrement()) { long lTargetAddr = lAddress + K; long configValue = 0L; boolean bFoundWord = false; ConfigWord cfgWord = new ConfigWord(); configValue = m_Memory.GetPhysicalMemory().ReadWord(lTargetAddr);
for (int iWord = 0; iWord < this.m_DataConfigBits.m_Words.size(); iWord++) { cfgWord = (ConfigWord)this.m_DataConfigBits.m_Words.get(iWord); if (cfgWord instanceof ConfigWord && lTargetAddr == cfgWord.address) { bFoundWord = true; ((ConfigWord)this.m_DataConfigBits.m_Words.get(iWord)).defaultValue = configValue; break; } }
if (bFoundWord) { boolean bFound = false;
for (ConfigField cfgField : cfgWord.m_Field) { for (ConfigSetting cfgSetting : cfgField.m_Set) { long requiredMask = cfgSetting.SettingReqd; if (requiredMask == 0L) { requiredMask = cfgField.mask; }
long lCurrentValue = configValue & requiredMask; if (lCurrentValue == cfgSetting.SettingValue) { cfgField.CurrentSettingDesc = cfgSetting.SettingDesc; cfgField.CurrentOptionName = cfgSetting.OptionName; bFound = true; break; } }
if (!bFound && cfgField.m_Set.size() > 0) { ConfigSetting cfgSetting = (ConfigSetting)cfgField.m_Set.get(0); cfgField.CurrentSettingDesc = cfgSetting.SettingDesc; cfgField.CurrentOptionName = cfgSetting.OptionName; } } } }
return true; } }
public boolean showConfigMemory(long startAddr, long endAddr) { boolean retVal = true; boolean addressDisplay = false; String dataDisplayOnRow = ""; String AlldataDisplayOnRow = ""; xPIC m_pic = this.sharedData.getDeviceName(); ProgramMemory mem = (ProgramMemory)this.sharedData.getAssemblySession().getLookup().lookup(ProgramMemory.class); if (m_pic.getSubFamily().equals(SubFamily.PIC32MZ)) { this.initConfigWordsXML1("ACTIVE"); } else if (!m_pic.getIDOntoPartition().isEmpty()) { if (mem.GetMode() != MODE.UNIFIED) { this.initConfigWordsXML1("first"); this.initConfigWordsXML1("second"); this.initConfigWordsXML1("bootcfg"); } else { this.initConfigWordsXML1(""); } } else { this.initConfigWordsXML1(""); }
this.updateSettings(this.deviceInfo.getConfigStart(), this.deviceInfo.getConfigSize()); String[] StringToDisplay = new String[7]; List<ConfigField> FieldCurWord = null;
for (int q = 0; q < this.m_Words.size(); q++) { ConfigWord curWord = this.m_Words.get(q); FieldCurWord = curWord.m_Field;
for (int qs = 0; qs < FieldCurWord.size(); qs++) { StringToDisplay = new String[7]; if (qs == 0) { StringToDisplay[0] = Long.toHexString(curWord.address).toUpperCase(); StringToDisplay[1] = curWord.ConfigWordName.toUpperCase(); StringToDisplay[2] = Long.toHexString(curWord.defaultValue).toUpperCase(); } else { StringToDisplay[0] = ""; StringToDisplay[1] = ""; StringToDisplay[2] = ""; }
StringToDisplay[3] = FieldCurWord.get(qs).FieldName; StringToDisplay[4] = FieldCurWord.get(qs).CurrentOptionName; StringToDisplay[5] = FieldCurWord.get(qs).FieldCategory; StringToDisplay[6] = FieldCurWord.get(qs).CurrentSettingDesc; if (!addressDisplay) { AlldataDisplayOnRow = StringToDisplay[0] + " "; addressDisplay = true; }
dataDisplayOnRow = StringToDisplay[2] + " "; if (dataDisplayOnRow.trim().length() != 0) { AlldataDisplayOnRow = AlldataDisplayOnRow + dataDisplayOnRow; } } }
this.ipeNotify.setMessageNotification(AlldataDisplayOnRow); return retVal; }
public boolean showFlashData(long startAddr, long endAddr) { boolean retVal = true; long dat = 0L; int count = 0; String s = ""; String UserIDtoDisplay = ""; String dataDisplayOnRow = ""; int cou = 0; String s1 = null; String[] labelString = new String[]{"Address", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}; String[] labelString1 = new String[]{"Address", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "ASCII"}; this.sharedData.setFlashBytes(this.deviceInfo.getFlashMemoryData().length); if (this.deviceInfo.isFlashData() && this.deviceInfo.getFlashDataRange()) { this.sharedData.setFlashBytes(this.deviceInfo.getFlashMemoryData()); }
long p = this.deviceInfo.getFlashMemoryData().length / 16; byte[] eeB = this.deviceInfo.getFlashMemoryData(); Family f = this.sharedData.getAssemblySession().GetDevice().getFamily(); if (this.todisplayascii) { this.Memory = new String[(int)p + 1][18]; this.Memory[0] = labelString1; } else { this.Memory = new String[(int)p + 1][17]; this.Memory[0] = labelString; }
for (int il = 0; il < p; il++) { int jl = 0; String[] buff1; if (this.todisplayascii) { buff1 = new String[18]; } else { buff1 = new String[17]; }
buff1[0] = String.format("%06X", il * 16); String k1 = "";
for (int jlp = 1; jlp <= 16; jlp++) { dat = this.sharedData.getByteasInt(eeB[count]); s = String.format("%02X", dat); buff1[jlp] = s; k1 = k1 + " " + this.getASCIIValuefor1Values(eeB[count]); if (this.todisplayascii && jlp == 16) { buff1[17] = k1; }
count++; }
dataDisplayOnRow = "";
for (int localLoop = 0; localLoop < buff1.length; localLoop++) { dataDisplayOnRow = dataDisplayOnRow + buff1[localLoop] + " "; }
if (this.sharedData.getUIMode()) { this.Memory[il + 1] = buff1; } else { this.ipeNotify.setMessageNotification(dataDisplayOnRow); } }
return retVal; }
public boolean showDataFlash(long startAddr, long endAddr) { boolean retVal = true; long dat = 0L; int count = 0; String s = ""; String UserIDtoDisplay = ""; String dataDisplayOnRow = ""; int cou = 0; String s1 = null; String[] labelString = new String[]{"Address", "0", "1", "2", "3", "4", "5", "6", "7"}; String[] labelString1 = new String[]{"Address", "0", "1", "2", "3", "4", "5", "6", "7", "ASCII"}; this.sharedData.setFlashBytes(this.deviceInfo.getDataFlashMemory().length); if (this.deviceInfo.isDataFlash() && this.deviceInfo.getDataFlashRange()) { this.sharedData.setFlashBytes(this.deviceInfo.getDataFlashMemory()); }
long p = this.deviceInfo.getDataFlashMemory().length / 16; byte[] eeB = this.deviceInfo.getDataFlashMemory(); Family f = this.sharedData.getAssemblySession().GetDevice().getFamily(); if (this.todisplayascii) { this.Memory = new String[(int)p + 1][10]; this.Memory[0] = labelString1; } else { this.Memory = new String[(int)p + 1][9]; this.Memory[0] = labelString; }
for (int il = 0; il < p; il++) { int jl = 0; String[] buff1; if (this.todisplayascii) { buff1 = new String[10]; } else { buff1 = new String[9]; }
buff1[0] = String.format("%03X", il * 8); String k1 = "";
for (int jlp = 1; jlp <= 8; jlp++) { dat = this.sharedData.getMSBLSB_Integer(eeB[count + 1], eeB[count]); s = String.format("%04X", dat).toUpperCase(); buff1[jlp] = s; k1 = k1 + " " + this.getASCIIValuefor2Values(eeB[count], eeB[count + 1]); if (this.todisplayascii && jlp == 8) { buff1[9] = k1; }
count += 2; }
dataDisplayOnRow = "";
for (int localLoop = 0; localLoop < buff1.length; localLoop++) { dataDisplayOnRow = dataDisplayOnRow + buff1[localLoop] + " "; }
if (this.sharedData.getUIMode()) { this.Memory[il + 1] = buff1; } else { this.ipeNotify.setMessageNotification(dataDisplayOnRow); } }
return retVal; }
public boolean showBootFlashData(long startAddr, long endAddr) { boolean retVal = true; int addrInc = 0; int numberOfColumns = 0; int count = 0; String s = ""; String dataDisplayOnRow = ""; int bytesPerWord = 0; if (this.sharedData.getAssemblySession() != null && this.sharedData.getAssemblySession().GetDevice().getFamily().compareTo(Family.SEE) != 0) { bytesPerWord = this.deviceInfo.getBytesPerWord(); if (bytesPerWord != -1) { addrInc = this.deviceInfo.getAddrInc(); numberOfColumns = 16 / bytesPerWord; } }
String[] labelString; if (this.todisplayascii) { labelString = new String[numberOfColumns + 2]; } else { labelString = new String[numberOfColumns + 1]; }
labelString[0] = "Address";
for (int m = 1; m < numberOfColumns + 1; m++) { labelString[m] = Long.toHexString(addrInc * (m - 1)).toUpperCase(); }
labelString[numberOfColumns + 1] = "ASCII"; this.sharedData.setBootFlashBytes(this.deviceInfo.getBootMemInBytes()); if (this.deviceInfo.isProgramMemory()) { this.sharedData.setBootFlashBytes(this.deviceInfo.getBootMemData()); }
byte[] boot = this.deviceInfo.getBootMemData(); long totBoot = this.deviceInfo.getBootMemInBytes(); totBoot /= 16L; if (this.todisplayascii) { this.Memory = new String[(int)totBoot + 1][numberOfColumns + 2]; } else { this.Memory = new String[(int)totBoot + 1][numberOfColumns + 1]; }
this.Memory[0] = labelString;
for (int ilp = 0; ilp < totBoot; ilp++) { String[] buff1; if (this.todisplayascii) { buff1 = new String[numberOfColumns + 2]; } else { buff1 = new String[numberOfColumns + 1]; }
int jlp = 0; buff1[0] = String.format("%08X", Long.valueOf("1FC00000", 16) + ilp * numberOfColumns * addrInc); String tempS = buff1[0].substring(4).toUpperCase(); String tempP = buff1[0].substring(0, 4).toUpperCase(); buff1[0] = String.format("%s_%s", tempP, tempS); String k1 = "";
for (int var29 = 1; var29 <= numberOfColumns; var29++) { long dat = this.sharedData.getMSBLSB32(boot[count + 3], boot[count + 2], boot[count + 1], boot[count]); s = String.format("%08X", dat); buff1[var29] = s; k1 = k1 + " " + this.getASCIIValue(boot[count], boot[count + 1], boot[count + 2], boot[count + 3]); if (this.todisplayascii && var29 == numberOfColumns) { buff1[numberOfColumns + 1] = k1; }
count += 4; }
dataDisplayOnRow = "";
for (int localLoop = 0; localLoop < buff1.length; localLoop++) { dataDisplayOnRow = dataDisplayOnRow + buff1[localLoop] + " "; }
if (this.sharedData.getUIMode()) { this.Memory[ilp + 1] = buff1; } else { this.ipeNotify.setMessageNotification(dataDisplayOnRow); } }
return retVal; }
public boolean showAuxiliaryData(long startAddr, long endAddr) { boolean retVal = true; int addrInc = 0; int numberOfColumns = 0; int count = 0; String s = ""; String dataDisplayOnRow = ""; int bytesPerWord = 0; if (this.sharedData.getAssemblySession() != null && this.sharedData.getAssemblySession().GetDevice().getFamily().compareTo(Family.SEE) != 0) { bytesPerWord = this.deviceInfo.getBytesPerWord(); if (bytesPerWord != -1) { addrInc = this.deviceInfo.getAddrInc(); numberOfColumns = 16 / bytesPerWord; } }
String[] labelString; if (this.todisplayascii) { labelString = new String[numberOfColumns + 2]; } else { labelString = new String[numberOfColumns + 1]; }
labelString[0] = "Address";
for (int m = 1; m < numberOfColumns + 1; m++) { labelString[m] = Long.toHexString(addrInc * (m - 1)).toUpperCase(); }
labelString[numberOfColumns + 1] = "ASCII"; this.sharedData.setAuxMemBytes(this.deviceInfo.getAuxMemTotalMemoryInBytes()); if (this.deviceInfo.isProgramMemory()) { this.sharedData.setAuxMemBytes(this.deviceInfo.getAuxMemData()); }
byte[] auxData = this.deviceInfo.getAuxMemData(); long tota = this.deviceInfo.getAuxMemTotalMemoryInBytes() * 2L; int countaux = 0; long dataux = 0L; tota /= 16L; if (this.todisplayascii) { this.Memory = new String[(int)tota + 1][numberOfColumns + 2]; } else { this.Memory = new String[(int)tota + 1][numberOfColumns + 1]; }
this.Memory[0] = labelString;
for (int ilp = 0; ilp < tota; ilp++) { String[] buffaux; if (this.todisplayascii) { buffaux = new String[numberOfColumns + 2]; } else { buffaux = new String[numberOfColumns + 1]; }
int jlp = 0; buffaux[0] = String.format("%06X", ilp * numberOfColumns * addrInc + this.deviceInfo.auxMemBeginAddr); String k1 = "";
for (int var30 = 1; var30 <= numberOfColumns; var30++) { dataux = this.sharedData.getMSBLSB32(auxData[countaux + 3], auxData[countaux + 2], auxData[countaux + 1], auxData[countaux]); String saux = String.format("%1$06X", dataux); if (saux.length() > 6) { saux = saux.substring(saux.length() - 6, saux.length()); }
buffaux[var30] = saux; k1 = k1 + " " + this.getASCIIValue(auxData[countaux], auxData[countaux + 1], auxData[countaux + 2], auxData[countaux + 3]); if (this.todisplayascii && var30 == numberOfColumns) { buffaux[numberOfColumns + 1] = k1; }
countaux += 4; }
dataDisplayOnRow = "";
for (int localLoop = 0; localLoop < buffaux.length; localLoop++) { dataDisplayOnRow = dataDisplayOnRow + buffaux[localLoop] + " "; }
if (this.sharedData.getUIMode()) { this.Memory[ilp + 1] = buffaux; } else { this.ipeNotify.setMessageNotification(dataDisplayOnRow); } }
return retVal; }
public boolean showDIAMemory() { String[] labelString = new String[]{"Address", "Name", "Hex"}; Pair<Long, Long> p = this.sharedData.getAssemblySession().GetDevice().getMainPartition().getDIARange(); int m_nRowCount = 0; this.m_RegistersPIC = new RegistersPIC(this.sharedData.getAssemblySession()); if (!(this.m_RegistersPIC instanceof RegistersPIC)) { return false; } else { for (RegPIC rr : this.m_RegistersPIC.m_Registers) { if (rr.m_lAddress <= (Long)p.second && rr.m_lAddress != -1L) { m_nRowCount++; } }
this.Memory = new String[m_nRowCount + 1][3]; this.Memory[0] = labelString; MemoryModel memory = (MemoryModel)this.sharedData.getAssemblySession().getLookup().lookup(TestMemory.class); int currentRow = 1;
for (RegPIC rrx : this.m_RegistersPIC.m_Registers) { if (rrx instanceof RegPIC) { if (rrx instanceof RegPIC && memory instanceof MemoryModel && rrx.m_lAddress != -1L) { try { if (rrx.m_lAddress > (Long)p.second) { break; }
rrx.m_nValue = memory.GetPhysicalMemory().ReadWord(rrx.m_lAddress); } catch (ArrayIndexOutOfBoundsException var11) { var11.printStackTrace(); } }
boolean bRegionName = rrx.m_lAddress == -1L;
for (int nCol = 0; nCol < 3; nCol++) { switch (nCol) { case 0: if (!bRegionName) { this.Memory[currentRow][nCol] = String.format("%X", rrx.m_lAddress); } break; case 1: if (!bRegionName) { this.Memory[currentRow][nCol] = rrx.RegName; } break; case 2: if (!bRegionName) { this.Memory[currentRow][nCol] = String.format("%04X", rrx.m_nValue & 16383L); } } }
if (!bRegionName) { currentRow++; } } }
int row = this.Memory.length; int col = this.Memory[0].length; StringBuilder sb = new StringBuilder();
for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { sb.append(this.Memory[i][j] + " "); }
sb.append("\n"); }
this.ipeNotify.setMessageNotification(sb.toString()); return true; } }
public boolean showDCIMemory() { String[] labelString = new String[]{"Address", "Name", "Hex"}; int m_nRowCount = 0; this.m_RegistersPIC = new RegistersPIC(this.sharedData.getAssemblySession()); if (!(this.m_RegistersPIC instanceof RegistersPIC)) { return false; } else { Pair<Long, Long> p = this.m_RegistersPIC.getRangeDCI();
for (RegPIC rr : this.m_RegistersPIC.m_Registers) { if (rr.m_lAddress >= (Long)p.first) { m_nRowCount++; } }
this.Memory = new String[m_nRowCount + 1][3]; this.Memory[0] = labelString; int currentRow = 1; Iterator var12 = this.m_RegistersPIC.m_Registers.iterator();
while (true) { RegPIC rrx; while (true) { if (!var12.hasNext()) { this.ipeNotify.setMessageNotification(""); return true; }
rrx = (RegPIC)var12.next(); if (rrx instanceof RegPIC) { MemoryModel memory = (MemoryModel)this.sharedData.getAssemblySession().getLookup().lookup(TestMemory.class); if (!(rrx instanceof RegPIC) || !(memory instanceof MemoryModel) || rrx.m_lAddress == -1L) { break; }
try { if (rrx.m_lAddress >= (Long)p.first) { rrx.m_nValue = memory.GetPhysicalMemory().ReadWord(rrx.m_lAddress); break; } } catch (ArrayIndexOutOfBoundsException var10) { var10.printStackTrace(); break; } } }
boolean bRegionName = rrx.m_lAddress == -1L;
for (int nCol = 0; nCol < 3; nCol++) { switch (nCol) { case 0: if (!bRegionName) { this.Memory[currentRow][nCol] = String.format("%X", rrx.m_lAddress); } break; case 1: if (!bRegionName) { this.Memory[currentRow][nCol] = rrx.RegName; } break; case 2: if (!bRegionName) { this.Memory[currentRow][nCol] = String.format("%04X", rrx.m_nValue & 16383L); } } }
if (!bRegionName) { currentRow++; } } } }}