From ecbc5c4b77368e340a96bfd5ab4b4c3d0c873293 Mon Sep 17 00:00:00 2001 From: schlaepfer Date: Fri, 17 Feb 2006 17:05:23 +0000 Subject: [PATCH] - structural changes (Device, BDI, IMCBTargetBoard as instances) git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@102 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c --- mcdp/src/ch/ntb/mcdp/bdi/MC68332.java | 136 +++-- mcdp/src/ch/ntb/mcdp/bdi/MPC555.java | 142 ++--- .../src/ch/ntb/mcdp/bdi/blackbox/MC68332.java | 256 +++++++++ mcdp/src/ch/ntb/mcdp/bdi/blackbox/MPC555.java | 253 +++++++++ mcdp/src/ch/ntb/mcdp/bdi/test/BDI332test.java | 186 +++---- mcdp/src/ch/ntb/mcdp/bdi/test/BDI555App.java | 2 + mcdp/src/ch/ntb/mcdp/bdi/test/BDI555test.java | 121 ++-- mcdp/src/ch/ntb/mcdp/bdi/test/FillTest.java | 516 +++++++++--------- .../ch/ntb/mcdp/mc68332/IMCBTargetBoard.java | 37 +- 9 files changed, 1103 insertions(+), 546 deletions(-) create mode 100644 mcdp/src/ch/ntb/mcdp/bdi/blackbox/MC68332.java create mode 100644 mcdp/src/ch/ntb/mcdp/bdi/blackbox/MPC555.java diff --git a/mcdp/src/ch/ntb/mcdp/bdi/MC68332.java b/mcdp/src/ch/ntb/mcdp/bdi/MC68332.java index 2e99d6f..e2a0844 100644 --- a/mcdp/src/ch/ntb/mcdp/bdi/MC68332.java +++ b/mcdp/src/ch/ntb/mcdp/bdi/MC68332.java @@ -6,6 +6,7 @@ import ch.ntb.mcdp.usb.DispatchException; import ch.ntb.mcdp.usb.USBDevice; import ch.ntb.mcdp.utils.logger.LogUtil; import ch.ntb.mcdp.utils.logger.McdpLogger; +import ch.ntb.usb.Device; import ch.ntb.usb.USB; import ch.ntb.usb.USBException; @@ -199,33 +200,37 @@ public class MC68332 { * download (fill) or read (dump).
* Note that no status bit is used. Therefore one data entity is only 16 * bits wide (not 17 bits like normal commands).
- * MAX_NOF_WORDS_FAST_DOWNLOAD is a multiple of 4 (FILLB/W + + * maxNofWordsFastDownload is a multiple of 4 (FILLB/W + * data). */ - public static final int MAX_NOF_BYTES_WORDS = (USB.MAX_DATA_SIZE - - DataPacket.PACKET_MIN_LENGTH - 2) / 4; + private int maxNofBytesWords; /** * Maximal number of longs (4 bytes) for one usb-packet to download (fill) * or read (dump).
* Note that no status bit is used. Therefore one data entity is only 16 * bits wide (not 17 bits like normal commands).
- * MAX_NOF_WORDS_FAST_DOWNLOAD is a multiple of 6 (FILLW + MS - * data + LS data). + * maxNofLongs is a multiple of 6 (FILLW + MS data + LS + * data). */ - public static final int MAX_NOF_LONGS = (USB.MAX_DATA_SIZE - - DataPacket.PACKET_MIN_LENGTH - 2) / 6; + private int maxNofLongs; - private static boolean targetInDebugMode = false; + private boolean targetInDebugMode = false; - private static byte[] sendData; + private byte[] sendData; - private static int readMemSize = 0, writeMemSize = 0; + private int readMemSize, writeMemSize; - private static boolean ignoreResult = false; + private boolean ignoreResult; - static { - sendData = new byte[USB.MAX_DATA_SIZE]; + public MC68332(Device device) { + ignoreResult = false; + readMemSize = 0; + writeMemSize = 0; + sendData = new byte[USB.HIGHSPEED_MAX_BULK_PACKET_SIZE]; + maxNofLongs = (device.getMaxPacketSize() - DataPacket.PACKET_MIN_LENGTH - 2) / 6; + maxNofBytesWords = (device.getMaxPacketSize() + - DataPacket.PACKET_MIN_LENGTH - 2) / 4; } /** @@ -241,7 +246,7 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - private static DataPacket transmit(byte STYPE, int dataLength) + private DataPacket transmit(byte STYPE, int dataLength) throws USBException, DispatchException, BDIException { // initialize packet sendData[0] = DataPacket.PACKET_HEADER; @@ -271,7 +276,7 @@ public class MC68332 { * @param offset * the offset from the beginning of the data */ - private static void fillPacket(int data, int offset) { + private void fillPacket(int data, int offset) { // refer to CPU32 Reference Manual, Section 7.2.7 // bit16 = 0 + 16 bits of data (bit15 .. bit0) @@ -290,7 +295,7 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - public static DataPacket transfer(int data) throws USBException, + public DataPacket transfer(int data) throws USBException, DispatchException, BDIException { fillPacket(data, 0); @@ -309,7 +314,7 @@ public class MC68332 { * @throws USBException * @throws DispatchException */ - private static int parseResult17(DataPacket data) throws BDIException, + private int parseResult17(DataPacket data) throws BDIException, USBException, DispatchException { if (data.subtype != STYPE_BDI_17OUT) { throw new BDIException("wrong subtype: " + data.subtype); @@ -360,7 +365,7 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - private static int transferAndParse17(int data) throws USBException, + private int transferAndParse17(int data) throws USBException, DispatchException, BDIException { return parseResult17(transfer(data)); } @@ -373,7 +378,7 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - public static void nopsToLegalCmd() throws USBException, DispatchException, + public void nopsToLegalCmd() throws USBException, DispatchException, BDIException { final int NOF_NOPS_TO_LEGAL_CMD = 4; for (int i = 0; i < NOF_NOPS_TO_LEGAL_CMD; i++) { @@ -392,8 +397,7 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - public static void break_() throws USBException, DispatchException, - BDIException { + public void break_() throws USBException, DispatchException, BDIException { // FIXME: this may be wrong, but works // ignore the result of the first transaction ignoreResult = true; @@ -411,8 +415,7 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - public static void go() throws USBException, DispatchException, - BDIException { + public void go() throws USBException, DispatchException, BDIException { if (!targetInDebugMode) { throw new BDIException("target not in debug mode"); } @@ -428,7 +431,7 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - private static void hard_reset() throws USBException, DispatchException, + private void hard_reset() throws USBException, DispatchException, BDIException { DataPacket data = transmit(STYPE_BDI_HARD_RESET_332, 0); if (data == null) { @@ -446,7 +449,7 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - public static void reset_target() throws USBException, DispatchException, + public void reset_target() throws USBException, DispatchException, BDIException { // hard reset hard_reset(); @@ -461,8 +464,8 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - public static void reset_peripherals() throws USBException, - DispatchException, BDIException { + public void reset_peripherals() throws USBException, DispatchException, + BDIException { // hard reset transferAndParse17(RST); // wait for 50ms @@ -484,8 +487,8 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - public static boolean isFreezeAsserted() throws USBException, - DispatchException, BDIException { + public boolean isFreezeAsserted() throws USBException, DispatchException, + BDIException { DataPacket data = transmit(STYPE_BDI_GET_FREEZE, 0); if (data == null) { throw new BDIException("no data from device"); @@ -520,7 +523,7 @@ public class MC68332 { * @throws DispatchException * @throws USBException */ - public static void fillMem(int[] downloadData, int dataLength) + public void fillMem(int[] downloadData, int dataLength) throws BDIException, USBException, DispatchException { // check if data fits into USB-packet int currentIndex = 0; @@ -528,7 +531,7 @@ public class MC68332 { logger.finer("dataLength: " + dataLength); switch (writeMemSize) { case 1: - if (dataLength > MAX_NOF_BYTES_WORDS) { + if (dataLength > maxNofBytesWords) { throw new BDIException( "data larger than MAX_NOF_WORDS_FAST_DOWNLOAD_BYTE_WORD"); } @@ -547,7 +550,7 @@ public class MC68332 { data = transmit(STYPE_BDI_17FILL_BYTE_WORD, dataLength * 4 + 2); break; case 2: - if (dataLength > MAX_NOF_BYTES_WORDS) { + if (dataLength > maxNofBytesWords) { throw new BDIException( "data larger than MAX_NOF_WORDS_FAST_DOWNLOAD_BYTE_WORD"); } @@ -566,7 +569,7 @@ public class MC68332 { data = transmit(STYPE_BDI_17FILL_BYTE_WORD, dataLength * 4 + 2); break; case 4: - if (dataLength > (MAX_NOF_LONGS)) { + if (dataLength > (maxNofLongs)) { throw new BDIException( "data larger than MAX_NOF_WORDS_FAST_DOWNLOAD_LONG"); } @@ -623,15 +626,15 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - public static int[] dumpMem(int nofData) throws USBException, - DispatchException, BDIException { + public int[] dumpMem(int nofData) throws USBException, DispatchException, + BDIException { // TODO: adjust MAX_NOF_XX_DUMP int dataSize; switch (readMemSize) { case 1: - if (nofData > MAX_NOF_BYTES_WORDS) - nofData = MAX_NOF_BYTES_WORDS; + if (nofData > maxNofBytesWords) + nofData = maxNofBytesWords; // fill the packet with {DUMPB} + 1 NOP at the end int i; for (i = 0; i < nofData; i++) { @@ -643,8 +646,8 @@ public class MC68332 { dataSize = i * 2 + 2; break; case 2: - if (nofData > MAX_NOF_BYTES_WORDS) - nofData = MAX_NOF_BYTES_WORDS; + if (nofData > maxNofBytesWords) + nofData = maxNofBytesWords; // fill the packet with {DUMPW} + 1 NOP at the end for (i = 0; i < nofData; i++) { sendData[DataPacket.PACKET_DATA_OFFSET + i * 2] = (byte) ((DUMPW >>> 8) & 0xFF); @@ -655,8 +658,8 @@ public class MC68332 { dataSize = i * 2 + 2; break; case 4: - if (nofData > MAX_NOF_LONGS) - nofData = MAX_NOF_LONGS; + if (nofData > maxNofLongs) + nofData = maxNofLongs; // fill the packet with {DUMPL + NOP} + 1 NOP at the end for (i = 0; i < nofData; i++) { sendData[DataPacket.PACKET_DATA_OFFSET + i * 4] = (byte) ((DUMPL >>> 8) & 0xFF); @@ -732,8 +735,8 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - public static void writeMem(int addr, int value, int size) - throws USBException, DispatchException, BDIException { + public void writeMem(int addr, int value, int size) throws USBException, + DispatchException, BDIException { if (!targetInDebugMode) { throw new BDIException("target not in debug mode"); @@ -800,7 +803,7 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - public static int readMem(int addr, int size) throws USBException, + public int readMem(int addr, int size) throws USBException, DispatchException, BDIException { if (!targetInDebugMode) { @@ -860,8 +863,8 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - public static int readUserReg(int reg) throws USBException, - DispatchException, BDIException { + public int readUserReg(int reg) throws USBException, DispatchException, + BDIException { if (!targetInDebugMode) { throw new BDIException("target not in debug mode"); @@ -888,7 +891,7 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - public static void writeUserReg(int reg, int value) throws USBException, + public void writeUserReg(int reg, int value) throws USBException, DispatchException, BDIException { if (!targetInDebugMode) { @@ -919,8 +922,8 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - public static int readSysReg(int reg) throws USBException, - DispatchException, BDIException { + public int readSysReg(int reg) throws USBException, DispatchException, + BDIException { if (!targetInDebugMode) { throw new BDIException("target not in debug mode"); @@ -947,7 +950,7 @@ public class MC68332 { * @throws DispatchException * @throws BDIException */ - public static void writeSysReg(int reg, int value) throws USBException, + public void writeSysReg(int reg, int value) throws USBException, DispatchException, BDIException { if (!targetInDebugMode) { @@ -972,8 +975,7 @@ public class MC68332 { } // TODO: remove - public static void nop() throws USBException, DispatchException, - BDIException { + public void nop() throws USBException, DispatchException, BDIException { logger .info("result: 0x" + Integer.toHexString(transferAndParse17(NOP))); @@ -988,7 +990,35 @@ public class MC68332 { * * @return the last known state of the freeze signal */ - public static boolean isTargetInDebugMode() { + public boolean isTargetInDebugMode() { return targetInDebugMode; } + + /** + * Maximal number of words or bytes (1 or 2 bytes) for one usb-packet to + * download (fill) or read (dump).
+ * Note that no status bit is used. Therefore one data entity is only 16 + * bits wide (not 17 bits like normal commands).
+ * maxNofWordsFastDownload is a multiple of 4 (FILLB/W + + * data). + * + * @return + */ + public int getMaxNofBytesWords() { + return maxNofBytesWords; + } + + /** + * Maximal number of longs (4 bytes) for one usb-packet to download (fill) + * or read (dump).
+ * Note that no status bit is used. Therefore one data entity is only 16 + * bits wide (not 17 bits like normal commands).
+ * maxNofLongs is a multiple of 6 (FILLW + MS data + LS + * data). + * + * @return + */ + public int getMaxNofLongs() { + return maxNofLongs; + } } diff --git a/mcdp/src/ch/ntb/mcdp/bdi/MPC555.java b/mcdp/src/ch/ntb/mcdp/bdi/MPC555.java index 30b15a8..cdc9e45 100644 --- a/mcdp/src/ch/ntb/mcdp/bdi/MPC555.java +++ b/mcdp/src/ch/ntb/mcdp/bdi/MPC555.java @@ -6,6 +6,7 @@ import ch.ntb.mcdp.usb.DispatchException; import ch.ntb.mcdp.usb.USBDevice; import ch.ntb.mcdp.utils.logger.LogUtil; import ch.ntb.mcdp.utils.logger.McdpLogger; +import ch.ntb.usb.Device; import ch.ntb.usb.USB; import ch.ntb.usb.USBException; @@ -74,6 +75,9 @@ public class MPC555 { */ private static final byte STYPE_BDI_ERROR_TIMEOUT = 0x73; + /** + * number of bytes per BDI transfer (35 bits) + */ private static final int BDI_DATA35_LENGTH = 5; /** @@ -111,23 +115,29 @@ public class MPC555 { */ private static final int MTBRTR30 = 0x7FC002E6; + /** + * Null indication result of a BDI transaction + */ private static final int NULL_INDICATION = -1; - public static final int MAX_NOF_WORDS_FAST_DOWNLOAD = ((USB.MAX_DATA_SIZE - DataPacket.PACKET_MIN_LENGTH) / BDI_DATA35_LENGTH); + private final int maxNofWordsFastDownload; - private static boolean fastDownloadStarted = false; + private boolean fastDownloadStarted; - private static boolean targetInDebugMode = false; + private boolean targetInDebugMode; - private static byte[] sendData; + private byte[] sendData; - private static int gpr30, gpr31, ecr; + private int gpr30, gpr31, ecr; - static { - sendData = new byte[USB.MAX_DATA_SIZE]; + public MPC555(Device device) { + targetInDebugMode = false; + fastDownloadStarted = false; + maxNofWordsFastDownload = ((device.getMaxPacketSize() - DataPacket.PACKET_MIN_LENGTH) / BDI_DATA35_LENGTH); + sendData = new byte[USB.HIGHSPEED_MAX_BULK_PACKET_SIZE]; } - private static void initPacket(byte STYPE, int dataLength) { + private void initPacket(byte STYPE, int dataLength) { logger.finest("initPacket(0x" + Integer.toHexString(STYPE) + ", " + dataLength + ")"); sendData[0] = DataPacket.PACKET_HEADER; @@ -138,7 +148,7 @@ public class MPC555 { sendData[DataPacket.PACKET_DATA_OFFSET + dataLength] = DataPacket.PACKET_END; } - private static DataPacket transmit(int dataLength) throws USBException, + private DataPacket transmit(int dataLength) throws USBException, DispatchException, BDIException { // write USB-command USBDevice @@ -156,8 +166,8 @@ public class MPC555 { return data; } - private static void fillPacket(boolean modeBit, boolean controlBit, - int data, int offset) { + private void fillPacket(boolean modeBit, boolean controlBit, int data, + int offset) { // startBit = 1 | modeBit | controlBit | 32 bits of data byte b = (byte) 0x80; @@ -175,8 +185,8 @@ public class MPC555 { sendData[DataPacket.PACKET_DATA_OFFSET + offset + 4] = (byte) ((data & 0x07) << 5); } - private static DataPacket transfer(boolean modeBit, boolean controlBit, - int data) throws USBException, DispatchException, BDIException { + private DataPacket transfer(boolean modeBit, boolean controlBit, int data) + throws USBException, DispatchException, BDIException { initPacket(STYPE_BDI_35IN, BDI_DATA35_LENGTH); @@ -185,7 +195,7 @@ public class MPC555 { return transmit(BDI_DATA35_LENGTH); } - private static int parseResult35(DataPacket data) throws BDIException { + private int parseResult35(DataPacket data) throws BDIException { if (data.subtype != STYPE_BDI_35OUT) { throw new BDIException("wrong subtype: " + data.subtype); } @@ -219,12 +229,12 @@ public class MPC555 { } } - private static int transferAndParse35(boolean modeBit, boolean controlBit, - int data) throws USBException, DispatchException, BDIException { + private int transferAndParse35(boolean modeBit, boolean controlBit, int data) + throws USBException, DispatchException, BDIException { return parseResult35(transfer(modeBit, controlBit, data)); } - private static void epilogue() throws USBException, DispatchException, + private void epilogue() throws USBException, DispatchException, BDIException { logger.fine("epilogue()"); @@ -249,7 +259,7 @@ public class MPC555 { transferAndParse35(false, false, RFI); } - private static void prologue() throws USBException, DispatchException, + private void prologue() throws USBException, DispatchException, BDIException { final int EBRK_bit = 1; @@ -293,8 +303,7 @@ public class MPC555 { * @throws DispatchException * @throws BDIException */ - public static void break_() throws USBException, DispatchException, - BDIException { + public void break_() throws USBException, DispatchException, BDIException { logger.fine("break_()"); // assert maskable breakpoint if (transferAndParse35(true, true, 0x7E000000) == NULL_INDICATION) { @@ -313,8 +322,7 @@ public class MPC555 { * @throws DispatchException * @throws BDIException */ - public static void go() throws USBException, DispatchException, - BDIException { + public void go() throws USBException, DispatchException, BDIException { logger.fine("go()"); if (!targetInDebugMode) { throw new BDIException("target not in debug mode"); @@ -332,7 +340,7 @@ public class MPC555 { * @throws DispatchException * @throws BDIException */ - private static void hard_reset() throws USBException, DispatchException, + private void hard_reset() throws USBException, DispatchException, BDIException { initPacket(STYPE_BDI_HARD_RESET_555, 0); DataPacket data = transmit(0); @@ -352,7 +360,7 @@ public class MPC555 { * @throws DispatchException * @throws BDIException */ - public static void reset_target() throws USBException, DispatchException, + public void reset_target() throws USBException, DispatchException, BDIException { logger.fine("reset_target()"); // hard reset @@ -383,8 +391,8 @@ public class MPC555 { * @throws DispatchException * @throws BDIException */ - public static boolean isFreezeAsserted() throws USBException, - DispatchException, BDIException { + public boolean isFreezeAsserted() throws USBException, DispatchException, + BDIException { initPacket(STYPE_BDI_GET_FREEZE, 0); logger.fine("isFreezeAsserted()"); DataPacket data = transmit(0); @@ -410,7 +418,7 @@ public class MPC555 { * @throws DispatchException * @throws BDIException */ - public static void startFastDownload(int startAddr) throws USBException, + public void startFastDownload(int startAddr) throws USBException, DispatchException, BDIException { logger.fine("startFastDownload(" + startAddr + ")"); if (!targetInDebugMode) { @@ -433,7 +441,7 @@ public class MPC555 { /** * Fill one USB-Packet with data to download. The maximal number of words is - * defined by MAX_NOF_WORDS_FAST_DOWNLOAD
+ * defined by maxNofWordsFastDownload
* startFastDownload has to be called before to set up the * start address. * @@ -445,16 +453,15 @@ public class MPC555 { * @throws DispatchException * @throws USBException */ - public static void fastDownload(int[] downloadData, int dataLength) + public void fastDownload(int[] downloadData, int dataLength) throws BDIException, USBException, DispatchException { logger.fine("fastDownload(int[], " + dataLength + ")"); if (!fastDownloadStarted) { throw new BDIException("start fast download first"); } // check if data fits into USB-packet - if (dataLength > MAX_NOF_WORDS_FAST_DOWNLOAD) { - throw new BDIException( - "data larger than MAX_NOF_WORDS_FAST_DOWNLOAD"); + if (dataLength > maxNofWordsFastDownload) { + throw new BDIException("data larger than maxNofWordsFastDownload"); } int currentIndex = 0; initPacket(STYPE_BDI_35FD_DATA, dataLength * BDI_DATA35_LENGTH); @@ -491,8 +498,8 @@ public class MPC555 { * @throws DispatchException * @throws BDIException */ - public static void stopFastDownload() throws USBException, - DispatchException, BDIException { + public void stopFastDownload() throws USBException, DispatchException, + BDIException { fastDownloadStarted = false; logger.fine("stopFastDownload()"); // stop fast download @@ -507,8 +514,8 @@ public class MPC555 { transferAndParse35(false, true, 0x0); } - public static void writeMem(int addr, int value, int size) - throws USBException, DispatchException, BDIException { + public void writeMem(int addr, int value, int size) throws USBException, + DispatchException, BDIException { logger.fine("writeMem(0x" + Integer.toHexString(addr) + ", 0x" + Integer.toHexString(value) + ", " + size + ")"); if (!targetInDebugMode) { @@ -542,7 +549,7 @@ public class MPC555 { } } - public static int readMem(int addr, int size) throws USBException, + public int readMem(int addr, int size) throws USBException, DispatchException, BDIException { logger.fine("readMem(0x" + Integer.toHexString(addr) + ", " + size + ")"); @@ -577,7 +584,7 @@ public class MPC555 { return transferAndParse35(false, false, NOP); } - public static void writeMemSeq(int value, int size) throws USBException, + public void writeMemSeq(int value, int size) throws USBException, DispatchException, BDIException { logger.fine("writeMemSeq(int, int)"); if (!targetInDebugMode) { @@ -607,8 +614,8 @@ public class MPC555 { } } - public static int readMemSeq(int size) throws USBException, - DispatchException, BDIException { + public int readMemSeq(int size) throws USBException, DispatchException, + BDIException { logger.fine("readMemSeq(int)"); if (!targetInDebugMode) { throw new BDIException("target not in debug mode"); @@ -637,7 +644,7 @@ public class MPC555 { return transferAndParse35(false, false, NOP); } - public static int readGPR(int gpr) throws USBException, DispatchException, + public int readGPR(int gpr) throws USBException, DispatchException, BDIException { logger.fine("readGPR(" + gpr + ")"); if (!targetInDebugMode) { @@ -657,7 +664,7 @@ public class MPC555 { return transferAndParse35(false, false, NOP); } - public static void writeGPR(int gpr, int value) throws USBException, + public void writeGPR(int gpr, int value) throws USBException, DispatchException, BDIException { logger.fine("writeGPR(" + gpr + ", 0x" + Integer.toHexString(value) + ")"); @@ -680,7 +687,7 @@ public class MPC555 { transferAndParse35(false, true, value); } - public static int readSPR(int spr) throws USBException, DispatchException, + public int readSPR(int spr) throws USBException, DispatchException, BDIException { logger.fine("readSPR(" + spr + ")"); if (!targetInDebugMode) { @@ -702,7 +709,7 @@ public class MPC555 { return transferAndParse35(false, false, NOP); } - public static void writeSPR(int spr, int value) throws USBException, + public void writeSPR(int spr, int value) throws USBException, DispatchException, BDIException { logger.fine("writeSPR(" + spr + ", 0x" + Integer.toHexString(value) + ")"); @@ -719,8 +726,7 @@ public class MPC555 { transferAndParse35(false, false, cmd); } - public static int readMSR() throws USBException, DispatchException, - BDIException { + public int readMSR() throws USBException, DispatchException, BDIException { logger.fine("readMSR()"); if (!targetInDebugMode) { throw new BDIException("target not in debug mode"); @@ -734,8 +740,8 @@ public class MPC555 { return transferAndParse35(false, false, NOP); } - public static void writeMSR(int value) throws USBException, - DispatchException, BDIException { + public void writeMSR(int value) throws USBException, DispatchException, + BDIException { logger.fine("writeMSR(0x" + Integer.toHexString(value) + ")"); if (!targetInDebugMode) { throw new BDIException("target not in debug mode"); @@ -748,7 +754,7 @@ public class MPC555 { transferAndParse35(false, false, 0x7FC00124); } - public static long readFPR(int fpr, int tmpMemAddr) throws USBException, + public long readFPR(int fpr, int tmpMemAddr) throws USBException, DispatchException, BDIException { logger.fine("readFPR(" + fpr + ", 0x" + Integer.toHexString(tmpMemAddr) + ")"); @@ -771,7 +777,7 @@ public class MPC555 { + readMem(tmpMemAddr + 4, 4); } - public static void writeFPR(int fpr, int tmpMemAddr, long value) + public void writeFPR(int fpr, int tmpMemAddr, long value) throws USBException, DispatchException, BDIException { logger.fine("writeFPR(" + fpr + ", 0x" + Integer.toHexString(tmpMemAddr) + ", 0x" @@ -798,8 +804,7 @@ public class MPC555 { transferAndParse35(false, false, NOP); } - public static int readCR() throws USBException, DispatchException, - BDIException { + public int readCR() throws USBException, DispatchException, BDIException { logger.fine("readCR()"); if (!targetInDebugMode) { throw new BDIException("target not in debug mode"); @@ -813,8 +818,8 @@ public class MPC555 { return transferAndParse35(false, false, NOP); } - public static void writeCR(int value) throws USBException, - DispatchException, BDIException { + public void writeCR(int value) throws USBException, DispatchException, + BDIException { logger.fine("writeCR(0x" + Integer.toHexString(value) + ")"); if (!targetInDebugMode) { throw new BDIException("target not in debug mode"); @@ -828,8 +833,7 @@ public class MPC555 { transferAndParse35(false, false, 0x7FCFF120); } - public static int readFPSCR() throws USBException, DispatchException, - BDIException { + public int readFPSCR() throws USBException, DispatchException, BDIException { logger.fine("readFPSCR()"); if (!targetInDebugMode) { throw new BDIException("target not in debug mode"); @@ -859,8 +863,8 @@ public class MPC555 { return retVal; } - public static void writeFPSCR(int value) throws USBException, - DispatchException, BDIException { + public void writeFPSCR(int value) throws USBException, DispatchException, + BDIException { logger.fine("writeFPSCR(0x" + Integer.toHexString(value) + ")"); if (!targetInDebugMode) { throw new BDIException("target not in debug mode"); @@ -884,7 +888,7 @@ public class MPC555 { * * @return the last known state of the freeze signal */ - public static boolean isTargetInDebugMode() { + public boolean isTargetInDebugMode() { return targetInDebugMode; } @@ -894,7 +898,7 @@ public class MPC555 { * * @return the store value of this register */ - public static int getGpr30() { + public int getGpr30() { return gpr30; } @@ -906,9 +910,9 @@ public class MPC555 { * @param value * value to write to the register */ - public static void setGpr30(int value) { + public void setGpr30(int value) { logger.fine("gpr30: 0x" + Integer.toHexString(value)); - MPC555.gpr30 = value; + gpr30 = value; } /** @@ -917,7 +921,7 @@ public class MPC555 { * * @return the store value of this register */ - public static int getGpr31() { + public int getGpr31() { return gpr31; } @@ -929,8 +933,16 @@ public class MPC555 { * @param value * value to write to the register */ - public static void setGpr31(int value) { + public void setGpr31(int value) { logger.fine("gpr31: 0x" + Integer.toHexString(value)); - MPC555.gpr31 = value; + gpr31 = value; + } + + /** + * @return number of maximal words used in the fastDownload + * procedure + */ + public int getMaxNofWordsFastDownload() { + return maxNofWordsFastDownload; } } diff --git a/mcdp/src/ch/ntb/mcdp/bdi/blackbox/MC68332.java b/mcdp/src/ch/ntb/mcdp/bdi/blackbox/MC68332.java new file mode 100644 index 0000000..31b705d --- /dev/null +++ b/mcdp/src/ch/ntb/mcdp/bdi/blackbox/MC68332.java @@ -0,0 +1,256 @@ +package ch.ntb.mcdp.bdi.blackbox; + +import ch.ntb.mcdp.bdi.BDIException; +import ch.ntb.mcdp.usb.DispatchException; +import ch.ntb.mcdp.usb.USBDevice; +import ch.ntb.usb.USBException; + +public class MC68332 { + + private static ch.ntb.mcdp.bdi.MC68332 bdi; + + /** + * Create a new BDI instance. This procedure has to be called AFTER opening + * the USB device and BEFORE using any BDI commands. + */ + public static void initialise() { + bdi = new ch.ntb.mcdp.bdi.MC68332(USBDevice.getDevice()); + } + + /** + * Sends NOPs to the target until a STATUS_OK result is + * received. + * + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static void nopsToLegalCmd() throws USBException, DispatchException, + BDIException { + bdi.nopsToLegalCmd(); + } + + /** + * Signals a breakpoint and enters debug mode. + * + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static void break_() throws USBException, DispatchException, + BDIException { + bdi.break_(); + } + + /** + * Resume from debug mode. + * + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static void go() throws USBException, DispatchException, + BDIException { + bdi.go(); + } + + /** + * Reset the target and put it into debug mode. + * + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static void reset_target() throws USBException, DispatchException, + BDIException { + bdi.reset_target(); + } + + /** + * Send the RST command (reset peripherals) to the microcontroller. + * + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static void reset_peripherals() throws USBException, + DispatchException, BDIException { + bdi.reset_peripherals(); + } + + /** + * Check if the freeze signal is asserted.
+ * The freeze siganl is asserted if the target is in debug mode. + * + * @return + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static boolean isFreezeAsserted() throws USBException, + DispatchException, BDIException { + return bdi.isFreezeAsserted(); + } + + /** + * Fill large blocks of memory.
+ * Fill is used in conjunction with the writeMem command. The + * maximal number of words is defined by + * MAX_NOF_WORDS_FAST_DOWNLOAD for 1 and 2 byte (word) data. + * For 4 byte (long) data, only half the size of + * MAX_NOF_WORDS_FAST_DOWNLOAD is available as 4 bytes of + * data has to be split in two packets (2 x 2 bytes).
+ * Befor using fillMem, writeMem has to be + * called to set up the start address and size. + * + * @param downloadData + * Data to be downloaded (size depending on size set up with + * writeMem) + * @param dataLength + * Number of bytes, words or longs (1, 2, 4 bytes) + * @throws BDIException + * @throws DispatchException + * @throws USBException + */ + public static void fillMem(int[] downloadData, int dataLength) + throws BDIException, USBException, DispatchException { + bdi.fillMem(downloadData, dataLength); + } + + /** + * Dump large blocks of memory.
+ * Dump is used in conjunction with the readMem(...) command. + * The size depends on the size set up with readMem(...) and + * is internally stored. + * + * @param nofData + * number of bytes/words/longs to read (depends on the size set + * up with readMem(...)) + * @return read values + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static int[] dumpMem(int nofData) throws USBException, + DispatchException, BDIException { + return bdi.dumpMem(nofData); + } + + /** + * Write to a specified memory address.
+ * + * @param addr + * address to write + * @param value + * value to write + * @param size + * number of bytes to read + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static void writeMem(int addr, int value, int size) + throws USBException, DispatchException, BDIException { + bdi.writeMem(addr, value, size); + } + + /** + * Read the value of a specified memory address.
+ * + * @param addr + * address to read + * @param size + * number of bytes to read + * @return value of this memory address + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static int readMem(int addr, int size) throws USBException, + DispatchException, BDIException { + return bdi.readMem(addr, size); + } + + /** + * Read a specified value from a user register.
+ * See the registerDictionary.xml file for valid registers. This + * file can be found in the mc68332 resource-section. + * + * @param reg + * register to read + * @return value of register + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static int readUserReg(int reg) throws USBException, + DispatchException, BDIException { + return bdi.readUserReg(reg); + } + + /** + * Write a specified value to user register.
+ * See the registerDictionary.xml file for valid registers. This + * file can be found in the mc68332 resource-section. + * + * @param reg + * register to write + * @param value + * value to write to register + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static void writeUserReg(int reg, int value) throws USBException, + DispatchException, BDIException { + bdi.writeUserReg(reg, value); + } + + /** + * Read a specified value from a system register.
+ * See the registerDictionary.xml file for valid registers. This + * file can be found in the mc68332 resource-section. + * + * @param reg + * register to read + * @return value of register + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static int readSysReg(int reg) throws USBException, + DispatchException, BDIException { + return bdi.readSysReg(reg); + } + + /** + * Write a specified value to system register.
+ * See the registerDictionary.xml file for valid registers. This + * file can be found in the mc68332 resource-section. + * + * @param reg + * register to write + * @param value + * value to write to register + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static void writeSysReg(int reg, int value) throws USBException, + DispatchException, BDIException { + bdi.writeSysReg(reg, value); + } + + /** + * Return the last known state of the freeze signal.
+ * This value may not be up to date as the target state may have changed + * meanwhile. To get the up to date value use isFreezeAsserted + * which will issue an USB request, read the freeze signal and update the + * internal value returned by this method. + * + * @return the last known state of the freeze signal + */ + public static boolean isTargetInDebugMode() { + return bdi.isTargetInDebugMode(); + } +} diff --git a/mcdp/src/ch/ntb/mcdp/bdi/blackbox/MPC555.java b/mcdp/src/ch/ntb/mcdp/bdi/blackbox/MPC555.java new file mode 100644 index 0000000..ef62634 --- /dev/null +++ b/mcdp/src/ch/ntb/mcdp/bdi/blackbox/MPC555.java @@ -0,0 +1,253 @@ +package ch.ntb.mcdp.bdi.blackbox; + +import ch.ntb.mcdp.bdi.BDIException; +import ch.ntb.mcdp.usb.DispatchException; +import ch.ntb.mcdp.usb.USBDevice; +import ch.ntb.usb.USBException; + +public class MPC555 { + + private static ch.ntb.mcdp.bdi.MPC555 bdi; + + /** + * Create a new BDI instance. This procedure has to be called AFTER opening + * the USB device and BEFORE using any BDI commands. + */ + public static void initialise() { + bdi = new ch.ntb.mcdp.bdi.MPC555(USBDevice.getDevice()); + } + + /** + * Signals a breakpoint and enters debug mode. + * + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static void break_() throws USBException, DispatchException, + BDIException { + bdi.break_(); + } + + /** + * Resume from debug mode. + * + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static void go() throws USBException, DispatchException, + BDIException { + bdi.go(); + } + + /** + * Reset the target and put it into debug mode. + * + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static void reset_target() throws USBException, DispatchException, + BDIException { + bdi.reset_target(); + } + + /** + * Check if the freeze signal is asserted.
+ * The freeze siganl is asserted if the target is in debug mode. + * + * @return + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static boolean isFreezeAsserted() throws USBException, + DispatchException, BDIException { + return bdi.isFreezeAsserted(); + } + + /** + * Called to start the fast download procedure. + * + * @param startAddr + * Address to which the data will be downloaded. + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static void startFastDownload(int startAddr) throws USBException, + DispatchException, BDIException { + bdi.startFastDownload(startAddr); + } + + /** + * Fill one USB-Packet with data to download. The maximal number of words is + * defined by MAX_NOF_WORDS_FAST_DOWNLOAD
+ * startFastDownload has to be called before to set up the + * start address. + * + * @param downloadData + * Data to be downloaded (32 bit wide) + * @param dataLength + * Length of the data to download (words) + * @throws BDIException + * @throws DispatchException + * @throws USBException + */ + public static void fastDownload(int[] downloadData, int dataLength) + throws BDIException, USBException, DispatchException { + bdi.fastDownload(downloadData, dataLength); + } + + /** + * Stop the fast download procedure.
+ * Use this command after startFastDownload(...) and + * fastDownload(...). + * + * @throws USBException + * @throws DispatchException + * @throws BDIException + */ + public static void stopFastDownload() throws USBException, + DispatchException, BDIException { + bdi.stopFastDownload(); + } + + public static void writeMem(int addr, int value, int size) + throws USBException, DispatchException, BDIException { + bdi.writeMem(addr, value, size); + } + + public static int readMem(int addr, int size) throws USBException, + DispatchException, BDIException { + return bdi.readMem(addr, size); + } + + public static void writeMemSeq(int value, int size) throws USBException, + DispatchException, BDIException { + bdi.writeMemSeq(value, size); + } + + public static int readMemSeq(int size) throws USBException, + DispatchException, BDIException { + return bdi.readMemSeq(size); + } + + public static int readGPR(int gpr) throws USBException, DispatchException, + BDIException { + return bdi.readGPR(gpr); + } + + public static void writeGPR(int gpr, int value) throws USBException, + DispatchException, BDIException { + bdi.writeGPR(gpr, value); + } + + public static int readSPR(int spr) throws USBException, DispatchException, + BDIException { + return bdi.readSPR(spr); + } + + public static void writeSPR(int spr, int value) throws USBException, + DispatchException, BDIException { + bdi.writeSPR(spr, value); + } + + public static int readMSR() throws USBException, DispatchException, + BDIException { + return bdi.readMSR(); + } + + public static void writeMSR(int value) throws USBException, + DispatchException, BDIException { + bdi.writeMSR(value); + } + + public static long readFPR(int fpr, int tmpMemAddr) throws USBException, + DispatchException, BDIException { + return bdi.readFPR(fpr, tmpMemAddr); + } + + public static void writeFPR(int fpr, int tmpMemAddr, long value) + throws USBException, DispatchException, BDIException { + bdi.writeFPR(fpr, tmpMemAddr, value); + } + + public static int readCR() throws USBException, DispatchException, + BDIException { + return bdi.readCR(); + } + + public static void writeCR(int value) throws USBException, + DispatchException, BDIException { + bdi.writeCR(value); + } + + public static int readFPSCR() throws USBException, DispatchException, + BDIException { + return bdi.readFPSCR(); + } + + public static void writeFPSCR(int value) throws USBException, + DispatchException, BDIException { + bdi.writeFPSCR(value); + } + + /** + * Return the last known state of the freeze signal. This value may not be + * up to date as the target state may have changed meanwhile. To get the up + * to date value use isFreezeAsserted which will issue an USB + * request, read the freeze signal and update the internal value returned by + * this method. + * + * @return the last known state of the freeze signal + */ + public static boolean isTargetInDebugMode() { + return bdi.isTargetInDebugMode(); + } + + /** + * Read the currently stored value of the GPR 30 register.
+ * This value is updated when entering debug mode (break -> prologue). + * + * @return the store value of this register + */ + public static int getGpr30() { + return bdi.getGpr30(); + } + + /** + * Set the value of the GPR 30 register.
+ * This value is written to the GPR30 register when the microcontroller + * resumes from debug mode (go -> epilogue). + * + * @param value + * value to write to the register + */ + public static void setGpr30(int value) { + bdi.setGpr30(value); + } + + /** + * Read the currently stored value of the GPR 31 register.
+ * This value is updated when entering debug mode (break -> prologue). + * + * @return the store value of this register + */ + public static int getGpr31() { + return bdi.getGpr31(); + } + + /** + * Set the value of the GPR 31 register.
+ * This value is written to the GPR31 register when the microcontroller + * resumes from debug mode (go -> epilogue). + * + * @param value + * value to write to the register + */ + public static void setGpr31(int value) { + bdi.setGpr31(value); + } +} diff --git a/mcdp/src/ch/ntb/mcdp/bdi/test/BDI332test.java b/mcdp/src/ch/ntb/mcdp/bdi/test/BDI332test.java index fca72ae..51e5658 100644 --- a/mcdp/src/ch/ntb/mcdp/bdi/test/BDI332test.java +++ b/mcdp/src/ch/ntb/mcdp/bdi/test/BDI332test.java @@ -1,11 +1,5 @@ package ch.ntb.mcdp.bdi.test; -import java.io.IOException; - -import javax.xml.parsers.ParserConfigurationException; - -import org.xml.sax.SAXException; - import ch.ntb.mcdp.bdi.BDIException; import ch.ntb.mcdp.bdi.MC68332; import ch.ntb.mcdp.mc68332.IMCBTargetBoard; @@ -20,11 +14,13 @@ public class BDI332test { private static McdpLogger logger = LogUtil.ch_ntb_mcdp_bdi_test; + public static MC68332 bdi; + private static void testBdiTransaction() { // test bdi transaction DataPacket result = null; try { - result = MC68332.transfer(0x0C00); + result = bdi.transfer(0x0C00); } catch (USBException e1) { // TODO Auto-generated catch block e1.printStackTrace(); @@ -42,7 +38,7 @@ public class BDI332test { private static void reset_target() { try { - MC68332.reset_target(); + bdi.reset_target(); } catch (USBException e1) { // TODO Auto-generated catch block e1.printStackTrace(); @@ -57,7 +53,7 @@ public class BDI332test { private static void freeze() { try { - logger.info("isFreezeAsserted: " + MC68332.isFreezeAsserted()); + logger.info("isFreezeAsserted: " + bdi.isFreezeAsserted()); } catch (USBException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -73,7 +69,7 @@ public class BDI332test { private static void break_() { try { - MC68332.break_(); + bdi.break_(); } catch (USBException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -88,7 +84,7 @@ public class BDI332test { private static void go() { try { - MC68332.go(); + bdi.go(); } catch (USBException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -104,9 +100,9 @@ public class BDI332test { private static void writeMem() { final int BASE_ADDR = 0x105624; try { - MC68332.writeMem(BASE_ADDR, 0x123456, 4); - MC68332.writeMem(BASE_ADDR + 4, 0x123457, 4); - MC68332.writeMem(BASE_ADDR + 8, 0x123458, 4); + bdi.writeMem(BASE_ADDR, 0x123456, 4); + bdi.writeMem(BASE_ADDR + 4, 0x123457, 4); + bdi.writeMem(BASE_ADDR + 8, 0x123458, 4); } catch (USBException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -123,12 +119,10 @@ public class BDI332test { final int BASE_ADDR = 0x105624; try { StringBuffer sb = new StringBuffer("0x" - + Integer.toHexString(MC68332.readMem(BASE_ADDR, 4)) + "\n"); - sb.append("0x" - + Integer.toHexString(MC68332.readMem(BASE_ADDR + 4, 4)) + + Integer.toHexString(bdi.readMem(BASE_ADDR, 4)) + "\n"); + sb.append("0x" + Integer.toHexString(bdi.readMem(BASE_ADDR + 4, 4)) + "\n"); - sb.append("0x" - + Integer.toHexString(MC68332.readMem(BASE_ADDR + 8, 4)) + sb.append("0x" + Integer.toHexString(bdi.readMem(BASE_ADDR + 8, 4)) + "\n"); logger.info(sb.toString()); } catch (USBException e) { @@ -229,8 +223,8 @@ public class BDI332test { logger.info("dump()"); try { logger.info("Data: 0x" - + Integer.toHexString(MC68332.readMem(BASE_ADDR, 4)) + " "); - result = MC68332.dumpMem(MC68332.MAX_NOF_LONGS); + + Integer.toHexString(bdi.readMem(BASE_ADDR, 4)) + " "); + result = bdi.dumpMem(bdi.getMaxNofLongs()); StringBuffer sb = new StringBuffer(); for (int i = 0; i < result.length; i++) { sb.append("0x" + Integer.toHexString(result[i]) + " "); @@ -251,7 +245,7 @@ public class BDI332test { public static void button9() { try { - MC68332.nop(); + bdi.nop(); } catch (USBException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -270,12 +264,12 @@ public class BDI332test { logger.info("fill"); try { - MC68332.writeMem(BASE_ADDR, 0, 4); - int[] data = new int[MC68332.MAX_NOF_LONGS]; + bdi.writeMem(BASE_ADDR, 0, 4); + int[] data = new int[bdi.getMaxNofLongs()]; for (int i = 0; i < data.length; i++) { data[i] = i; } - MC68332.fillMem(data, data.length); + bdi.fillMem(data, data.length); } catch (USBException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -291,7 +285,8 @@ public class BDI332test { public static void button11() { logger.info("initTarget()"); try { - IMCBTargetBoard.init(); + IMCBTargetBoard imcb = new IMCBTargetBoard(bdi); + imcb.init(); } catch (Exception e) { e.printStackTrace(); } @@ -306,24 +301,24 @@ public class BDI332test { try { logger.info("Fill (1 to data.length)"); - MC68332.writeMem(BASE_ADDR, 0, 4); - int[] data = new int[MC68332.MAX_NOF_LONGS]; + bdi.writeMem(BASE_ADDR, 0, 4); + int[] data = new int[bdi.getMaxNofLongs()]; for (int i = 0; i < data.length; i++) { data[i] = i + 1; } - MC68332.fillMem(data, data.length); + bdi.fillMem(data, data.length); logger.info("writing byte " + (OFFSET / 4) + " to " + ((OFFSET / 4) + LENGTH) + " with 0x" + Integer.toHexString(DATA)); - MC68332.writeMem(BASE_ADDR + OFFSET, DATA, 4); + bdi.writeMem(BASE_ADDR + OFFSET, DATA, 4); for (int i = 0; i < LENGTH; i++) { data[i] = DATA; } - MC68332.fillMem(data, LENGTH); + bdi.fillMem(data, LENGTH); logger.info((LENGTH + 1) + " bytes written"); logger.info("dump data"); - int firstInt = MC68332.readMem(BASE_ADDR, 4); - int[] result = MC68332.dumpMem(MC68332.MAX_NOF_LONGS); + int firstInt = bdi.readMem(BASE_ADDR, 4); + int[] result = bdi.dumpMem(bdi.getMaxNofLongs()); StringBuffer sb = new StringBuffer(); for (int i = 0; i < result.length; i++) { sb.append("0x" + Integer.toHexString(result[i]) + " "); @@ -346,23 +341,23 @@ public class BDI332test { try { logger.info("initialize data"); - MC68332.writeMem(BASE_ADDR, FIRST_VAL, 4); - int[] data = new int[MC68332.MAX_NOF_LONGS]; + bdi.writeMem(BASE_ADDR, FIRST_VAL, 4); + int[] data = new int[bdi.getMaxNofLongs()]; for (int i = 0; i < data.length; i++) { data[i] = 5; } - MC68332.fillMem(data, data.length); + bdi.fillMem(data, data.length); logger.info("write data"); - MC68332.writeMem(BASE_ADDR, FIRST_VAL, 4); + bdi.writeMem(BASE_ADDR, FIRST_VAL, 4); data = new int[10]; for (int i = 0; i < data.length; i++) { data[i] = i; } - MC68332.fillMem(data, data.length); + bdi.fillMem(data, data.length); logger.info("Fill done"); logger.info("read back data"); - int firstResult = MC68332.readMem(BASE_ADDR, 4); + int firstResult = bdi.readMem(BASE_ADDR, 4); if (firstResult != FIRST_VAL) { logger.warning("Error at 0: 0x" + Integer.toHexString(firstResult) + " instead of 0x" @@ -370,7 +365,7 @@ public class BDI332test { } logger.fine("Compare first 0x" + Integer.toHexString(firstResult) + " == 0x" + Integer.toHexString(FIRST_VAL)); - int[] result = MC68332.dumpMem(MC68332.MAX_NOF_LONGS); + int[] result = bdi.dumpMem(bdi.getMaxNofLongs()); for (int i = 0; i < result.length; i++) { logger.fine("Compare " + i + ": 0x" + Integer.toHexString(result[i])); @@ -395,15 +390,15 @@ public class BDI332test { logger.info("write data"); try { - MC68332.writeMem(BASE_ADDR, FIRST_VAL, 4); - int[] data = new int[MC68332.MAX_NOF_LONGS]; + bdi.writeMem(BASE_ADDR, FIRST_VAL, 4); + int[] data = new int[bdi.getMaxNofLongs()]; for (int i = 0; i < data.length; i++) { data[i] = i; } - MC68332.fillMem(data, data.length); + bdi.fillMem(data, data.length); logger.info("Fill done"); logger.info("read back data"); - int firstResult = MC68332.readMem(BASE_ADDR, 4); + int firstResult = bdi.readMem(BASE_ADDR, 4); if (firstResult != FIRST_VAL) { logger.warning("Error at 0: 0x" + Integer.toHexString(firstResult) + " instead of 0x" @@ -411,7 +406,7 @@ public class BDI332test { } logger.fine("Compare first 0x" + Integer.toHexString(firstResult) + " == 0x" + Integer.toHexString(FIRST_VAL)); - int[] result = MC68332.dumpMem(MC68332.MAX_NOF_LONGS); + int[] result = bdi.dumpMem(bdi.getMaxNofLongs()); for (int i = 0; i < result.length; i++) { if (data[i] != result[i]) { logger.warning("Error at " + i + ": 0x" @@ -454,28 +449,28 @@ public class BDI332test { public static void button16() { final int BASE_ADDR = 0x105624; final int DATA = 0x00ff00ff; - final int OFFSET = (MC68332.MAX_NOF_LONGS - 2) * 4; + final int OFFSET = (bdi.getMaxNofLongs() - 2) * 4; final int LENGTH = 0x04; - final int DUMP_BASE = BASE_ADDR + (MC68332.MAX_NOF_LONGS / 2) * 4; + final int DUMP_BASE = BASE_ADDR + (bdi.getMaxNofLongs() / 2) * 4; try { logger.info("REPLACE at the end"); logger.info("Fill first"); - MC68332.writeMem(BASE_ADDR, 0, 4); - int[] data = new int[MC68332.MAX_NOF_LONGS]; + bdi.writeMem(BASE_ADDR, 0, 4); + int[] data = new int[bdi.getMaxNofLongs()]; for (int i = 0; i < data.length; i++) { data[i] = i + 1; } - MC68332.fillMem(data, data.length); + bdi.fillMem(data, data.length); logger.info("Fill second"); - MC68332.writeMem(BASE_ADDR + (MC68332.MAX_NOF_LONGS + 1) * 4, 0, 4); + bdi.writeMem(BASE_ADDR + (bdi.getMaxNofLongs() + 1) * 4, 0, 4); for (int i = 0; i < data.length; i++) { - data[i] = MC68332.MAX_NOF_LONGS + i + 2; + data[i] = bdi.getMaxNofLongs() + i + 2; } - MC68332.fillMem(data, data.length); + bdi.fillMem(data, data.length); logger.info("Dump from base: 0x" + Integer.toHexString(DUMP_BASE)); - int firstInt = MC68332.readMem(DUMP_BASE, 4); - int[] result = MC68332.dumpMem(MC68332.MAX_NOF_LONGS); + int firstInt = bdi.readMem(DUMP_BASE, 4); + int[] result = bdi.dumpMem(bdi.getMaxNofLongs()); StringBuffer sb = new StringBuffer(); for (int i = 0; i < result.length; i++) { sb.append("0x" + Integer.toHexString(result[i]) + " "); @@ -486,16 +481,16 @@ public class BDI332test { logger.info("writing byte " + (OFFSET / 4) + " to " + ((OFFSET / 4) + LENGTH) + " with 0x" + Integer.toHexString(DATA)); - MC68332.writeMem(BASE_ADDR + OFFSET, DATA, 4); + bdi.writeMem(BASE_ADDR + OFFSET, DATA, 4); for (int i = 0; i < LENGTH; i++) { data[i] = DATA; } - MC68332.fillMem(data, LENGTH); + bdi.fillMem(data, LENGTH); logger.info((LENGTH + 1) + " bytes written"); logger.info("dump data from base: 0x" + Integer.toHexString(DUMP_BASE)); - firstInt = MC68332.readMem(DUMP_BASE, 4); - result = MC68332.dumpMem(MC68332.MAX_NOF_LONGS); + firstInt = bdi.readMem(DUMP_BASE, 4); + result = bdi.dumpMem(bdi.getMaxNofLongs()); sb = new StringBuffer(); for (int i = 0; i < result.length; i++) { sb.append("0x" + Integer.toHexString(result[i]) + " "); @@ -521,31 +516,31 @@ public class BDI332test { try { logger.info("read 4 bytes at: 0x" + Integer.toHexString(BASE_ADDR) + ", value: 0x" - + Integer.toHexString(MC68332.readMem(BASE_ADDR, 4))); + + Integer.toHexString(bdi.readMem(BASE_ADDR, 4))); logger.info("read 2 bytes at: 0x" + Integer.toHexString(BASE_ADDR) + ", value: 0x" - + Integer.toHexString(MC68332.readMem(BASE_ADDR, 2))); + + Integer.toHexString(bdi.readMem(BASE_ADDR, 2))); logger.info("read 1 byte at: 0x" + Integer.toHexString(BASE_ADDR) + ", value: 0x" - + Integer.toHexString(MC68332.readMem(BASE_ADDR, 1))); + + Integer.toHexString(bdi.readMem(BASE_ADDR, 1))); logger.info("write 1 byte at: 0x" + Integer.toHexString(BASE_ADDR) + ", value: 0x" + Integer.toHexString(DATA)); - MC68332.writeMem(BASE_ADDR, DATA, 1); + bdi.writeMem(BASE_ADDR, DATA, 1); logger.info("read 4 bytes at: 0x" + Integer.toHexString(BASE_ADDR) + ", value: 0x" - + Integer.toHexString(MC68332.readMem(BASE_ADDR, 4))); + + Integer.toHexString(bdi.readMem(BASE_ADDR, 4))); logger.info("write 2 byte at: 0x" + Integer.toHexString(BASE_ADDR) + ", value: 0x" + Integer.toHexString(DATA)); - MC68332.writeMem(BASE_ADDR, DATA, 2); + bdi.writeMem(BASE_ADDR, DATA, 2); logger.info("read 4 bytes at: 0x" + Integer.toHexString(BASE_ADDR) + ", value: 0x" - + Integer.toHexString(MC68332.readMem(BASE_ADDR, 4))); + + Integer.toHexString(bdi.readMem(BASE_ADDR, 4))); logger.info("write 4 byte at: 0x" + Integer.toHexString(BASE_ADDR) + ", value: 0x" + Integer.toHexString(DATA)); - MC68332.writeMem(BASE_ADDR, DATA, 4); + bdi.writeMem(BASE_ADDR, DATA, 4); logger.info("read 4 bytes at: 0x" + Integer.toHexString(BASE_ADDR) + ", value: 0x" - + Integer.toHexString(MC68332.readMem(BASE_ADDR, 4))); + + Integer.toHexString(bdi.readMem(BASE_ADDR, 4))); } catch (USBException e) { e.printStackTrace(); } catch (DispatchException e) { @@ -560,14 +555,14 @@ public class BDI332test { DispatchException, BDIException { int dumpSize = 0; if (size > 2) { - dumpSize = MC68332.MAX_NOF_LONGS; + dumpSize = bdi.getMaxNofLongs(); } else { - dumpSize = MC68332.MAX_NOF_BYTES_WORDS; + dumpSize = bdi.getMaxNofBytesWords(); } logger.info("read " + size + " byte(s) at 0x" + Integer.toHexString(baseAddr) + ", value: " - + Integer.toHexString(MC68332.readMem(baseAddr, size))); - int[] result = MC68332.dumpMem(dumpSize); + + Integer.toHexString(bdi.readMem(baseAddr, size))); + int[] result = bdi.dumpMem(dumpSize); StringBuffer sb = new StringBuffer("data: "); for (int i = 0; i < result.length; i++) { sb.append("0x" + Integer.toHexString(result[i]) + " "); @@ -579,9 +574,9 @@ public class BDI332test { DispatchException, BDIException { int fillSize = 0; if (size > 2) { - fillSize = MC68332.MAX_NOF_LONGS; + fillSize = bdi.getMaxNofLongs(); } else { - fillSize = MC68332.MAX_NOF_BYTES_WORDS; + fillSize = bdi.getMaxNofBytesWords(); } int[] data = new int[fillSize]; for (int i = 0; i < data.length; i++) { @@ -589,30 +584,31 @@ public class BDI332test { } logger.info("fill " + data.length + " integers with size " + size + " byte(s)"); - MC68332.writeMem(baseAddr, 0, size); - MC68332.fillMem(data, data.length); + bdi.writeMem(baseAddr, 0, size); + bdi.fillMem(data, data.length); } public static void button18() { final int BASE_ADDR = 0x105624; - int[] data = new int[MC68332.MAX_NOF_BYTES_WORDS]; + int[] data = new int[bdi.getMaxNofBytesWords()]; for (int i = 0; i < data.length; i++) { data[i] = i; } try { - IMCBTargetBoard.init(); + IMCBTargetBoard imcb = new IMCBTargetBoard(bdi); + imcb.init(); fill(BASE_ADDR, 4); // TODO: this does produce an error why??? - IMCBTargetBoard.init(); + imcb.init(); dump(BASE_ADDR, 4); - IMCBTargetBoard.init(); + imcb.init(); fill(BASE_ADDR, 2); - IMCBTargetBoard.init(); + imcb.init(); dump(BASE_ADDR, 2); - IMCBTargetBoard.init(); + imcb.init(); fill(BASE_ADDR, 1); - IMCBTargetBoard.init(); + imcb.init(); dump(BASE_ADDR, 1); } catch (Exception e) { @@ -628,28 +624,28 @@ public class BDI332test { int REG = 0x8; int VALUE = 0x12345; logger.info("test SysReg (ATEMP)"); - MC68332.writeSysReg(REG, VALUE); - int result = MC68332.readSysReg(REG); + bdi.writeSysReg(REG, VALUE); + int result = bdi.readSysReg(REG); checkResult(VALUE, result); REG = 0x5; logger.info("test UserReg (D5)"); - MC68332.writeUserReg(REG, VALUE); - result = MC68332.readUserReg(REG); + bdi.writeUserReg(REG, VALUE); + result = bdi.readUserReg(REG); checkResult(VALUE, result); REG = 0xD; logger.info("test UserReg (A5)"); - MC68332.writeUserReg(REG, VALUE); - result = MC68332.readUserReg(REG); + bdi.writeUserReg(REG, VALUE); + result = bdi.readUserReg(REG); checkResult(VALUE, result); // Does only work after LoadRam! // // REG = 0xFFFFFA00; // logger.info("test ctrlReg (SIMCR)"); - // MC68332.writeMem(REG, VALUE, 4); - // result = MC68332.readMem(REG, 4); + // bdi.writeMem(REG, VALUE, 4); + // result = bdi.readMem(REG, 4); // checkResult(VALUE, result); } catch (USBException e) { @@ -677,12 +673,10 @@ public class BDI332test { final int BASE_ADDR = 0x01004E0; try { StringBuffer sb = new StringBuffer("0x" - + Integer.toHexString(MC68332.readMem(BASE_ADDR, 4)) + "\n"); - sb.append("0x" - + Integer.toHexString(MC68332.readMem(BASE_ADDR + 4, 4)) + + Integer.toHexString(bdi.readMem(BASE_ADDR, 4)) + "\n"); + sb.append("0x" + Integer.toHexString(bdi.readMem(BASE_ADDR + 4, 4)) + "\n"); - sb.append("0x" - + Integer.toHexString(MC68332.readMem(BASE_ADDR + 8, 4)) + sb.append("0x" + Integer.toHexString(bdi.readMem(BASE_ADDR + 8, 4)) + "\n"); logger.info(sb.toString()); } catch (USBException e) { diff --git a/mcdp/src/ch/ntb/mcdp/bdi/test/BDI555App.java b/mcdp/src/ch/ntb/mcdp/bdi/test/BDI555App.java index a5bba9e..18c2c4f 100644 --- a/mcdp/src/ch/ntb/mcdp/bdi/test/BDI555App.java +++ b/mcdp/src/ch/ntb/mcdp/bdi/test/BDI555App.java @@ -6,6 +6,7 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; +import ch.ntb.mcdp.bdi.MPC555; import ch.ntb.mcdp.usb.USBDevice; import ch.ntb.usb.USBException; @@ -197,6 +198,7 @@ public class BDI555App { try { USBDevice.open(); + BDI555test.bdi = new MPC555(USBDevice.getDevice()); } catch (USBException e) { e.printStackTrace(); return; diff --git a/mcdp/src/ch/ntb/mcdp/bdi/test/BDI555test.java b/mcdp/src/ch/ntb/mcdp/bdi/test/BDI555test.java index bc774f4..0caa092 100644 --- a/mcdp/src/ch/ntb/mcdp/bdi/test/BDI555test.java +++ b/mcdp/src/ch/ntb/mcdp/bdi/test/BDI555test.java @@ -13,6 +13,8 @@ public class BDI555test { private static McdpLogger logger = LogUtil.ch_ntb_mcdp_bdi_test; + public static MPC555 bdi; + // private static void testBdiTransaction() { // // test bdi transaction // DataPacket result = null; @@ -36,14 +38,14 @@ public class BDI555test { private static void reset_target() { try { - MPC555.reset_target(); + bdi.reset_target(); // assign pin to Freeze output - MPC555.writeMem(0x02FC000, 0x40000, 4); + bdi.writeMem(0x02FC000, 0x40000, 4); // enable bus monitor, disable watchdog timer - MPC555.writeMem(0x02FC004, 0x0FFFFFF83, 4); + bdi.writeMem(0x02FC004, 0x0FFFFFF83, 4); // SCCR, switch off EECLK for download - MPC555.writeMem(0x02FC280, 0x08121C100, 4); - logger.info("Is freeze asserted: " + MPC555.isFreezeAsserted()); + bdi.writeMem(0x02FC280, 0x08121C100, 4); + logger.info("Is freeze asserted: " + bdi.isFreezeAsserted()); } catch (USBException e1) { // TODO Auto-generated catch block e1.printStackTrace(); @@ -58,7 +60,7 @@ public class BDI555test { private static void freeze() { try { - logger.info("isFreezeAsserted: " + MPC555.isFreezeAsserted()); + logger.info("isFreezeAsserted: " + bdi.isFreezeAsserted()); } catch (USBException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -74,7 +76,7 @@ public class BDI555test { private static void break_() { try { - MPC555.break_(); + bdi.break_(); logger.info("break"); } catch (USBException e) { // TODO Auto-generated catch block @@ -90,7 +92,7 @@ public class BDI555test { private static void go() { try { - MPC555.go(); + bdi.go(); logger.info("go"); } catch (USBException e) { // TODO Auto-generated catch block @@ -107,7 +109,7 @@ public class BDI555test { private static void writeMem() { final int BASE_ADDR = 0x800000, VALUE = 0x123456; try { - MPC555.writeMem(BASE_ADDR, VALUE, 4); + bdi.writeMem(BASE_ADDR, VALUE, 4); logger.info("writeMem: BASE_ADDR = 0x" + Integer.toHexString(BASE_ADDR) + ", value = 0x" + Integer.toHexString(VALUE)); @@ -130,8 +132,9 @@ public class BDI555test { + Integer.toHexString(BASE_ADDR) + ", value = "); for (int i = 0; i < 10; i++) { sb.append("0x" - + Integer.toHexString(MPC555.readMem(BASE_ADDR + i * 4, - 4)) + "\n"); + + Integer + .toHexString(bdi.readMem(BASE_ADDR + i * 4, 4)) + + "\n"); } logger.info(sb.toString()); } catch (USBException e) { @@ -148,17 +151,17 @@ public class BDI555test { private static void fastDownload() { final int BASE_ADDR = 0x800000; - int[] testData = new int[MPC555.MAX_NOF_WORDS_FAST_DOWNLOAD]; + int[] testData = new int[bdi.getMaxNofWordsFastDownload()]; for (int i = 0; i < testData.length; i++) { testData[i] = i; } try { logger.info("fastDownload at BASE_ADDR = 0x" + Integer.toHexString(BASE_ADDR) + ", length = " - + MPC555.MAX_NOF_WORDS_FAST_DOWNLOAD); - MPC555.startFastDownload(BASE_ADDR); - MPC555.fastDownload(testData, MPC555.MAX_NOF_WORDS_FAST_DOWNLOAD); - MPC555.stopFastDownload(); + + bdi.getMaxNofWordsFastDownload()); + bdi.startFastDownload(BASE_ADDR); + bdi.fastDownload(testData, bdi.getMaxNofWordsFastDownload()); + bdi.stopFastDownload(); } catch (USBException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -176,10 +179,10 @@ public class BDI555test { try { StringBuffer sb = new StringBuffer("readMemSeq: BASE_ADDR = 0x" + Integer.toHexString(BASE_ADDR) + "\n" + 0 + "\tData: 0x" - + Integer.toHexString(MPC555.readMem(BASE_ADDR, 4)) + "\n"); + + Integer.toHexString(bdi.readMem(BASE_ADDR, 4)) + "\n"); for (int i = 1; i < 120; i++) { sb.append(i + "\tData: 0x" - + Integer.toHexString(MPC555.readMemSeq(4)) + "\n"); + + Integer.toHexString(bdi.readMemSeq(4)) + "\n"); } logger.info(sb.toString()); } catch (USBException e) { @@ -231,13 +234,13 @@ public class BDI555test { final int SPR = 158; final int VALUE = 0x12345; try { - int result = MPC555.readSPR(SPR); + int result = bdi.readSPR(SPR); logger.info("readSPR(" + SPR + ") = 0x" + Integer.toHexString(result)); - MPC555.writeSPR(SPR, VALUE); + bdi.writeSPR(SPR, VALUE); logger.info("writeSPR(" + SPR + ", 0x" + Integer.toHexString(VALUE) + ")"); - result = MPC555.readSPR(SPR); + result = bdi.readSPR(SPR); logger.info("readSPR(" + SPR + ") = 0x" + Integer.toHexString(result)); } catch (USBException e) { @@ -255,7 +258,7 @@ public class BDI555test { // logger.info("hard_reset()"); // try { - // MPC555.hard_reset(); + // bdi.hard_reset(); // } catch (USBException e) { // e.printStackTrace(); // } catch (DispatchException e) { @@ -290,21 +293,21 @@ public class BDI555test { int REG = 152; int VALUE = 0x12345; - MPC555.writeSPR(REG, VALUE); - int result = MPC555.readSPR(REG); + bdi.writeSPR(REG, VALUE); + int result = bdi.readSPR(REG); checkResult(VALUE, result); logger.info("test GPR"); REG = 5; - MPC555.writeGPR(REG, VALUE); - result = MPC555.readGPR(REG); + bdi.writeGPR(REG, VALUE); + result = bdi.readGPR(REG); checkResult(VALUE, result); logger.info("test FPR"); int TMP_MEM_ADDR = 0x800000; long LONG_VAL = 0x12345012345L; - MPC555.writeFPR(REG, TMP_MEM_ADDR, LONG_VAL); - long fprResult = MPC555.readFPR(REG, TMP_MEM_ADDR); + bdi.writeFPR(REG, TMP_MEM_ADDR, LONG_VAL); + long fprResult = bdi.readFPR(REG, TMP_MEM_ADDR); if (fprResult != LONG_VAL) { logger.severe("value: 0x" + Long.toHexString(LONG_VAL) + ", result: 0x" + Long.toHexString(fprResult)); @@ -315,19 +318,19 @@ public class BDI555test { } logger.info("test MSR"); - MPC555.writeMSR(VALUE); - result = MPC555.readMSR(); + bdi.writeMSR(VALUE); + result = bdi.readMSR(); checkResult(VALUE, result); logger.info("test CR"); - MPC555.writeCR(VALUE); - result = MPC555.readCR(); + bdi.writeCR(VALUE); + result = bdi.readCR(); checkResult(VALUE, result); logger.info("test CtrlReg"); int MEM_ADDR = 0x2FC100; - MPC555.writeMem(MEM_ADDR, VALUE, 4); - result = MPC555.readMem(MEM_ADDR, 4); + bdi.writeMem(MEM_ADDR, VALUE, 4); + result = bdi.readMem(MEM_ADDR, 4); checkResult(VALUE, result); } catch (USBException e) { @@ -356,7 +359,7 @@ public class BDI555test { public static void button12() { final int BASE_ADDR = 0x3f9bf0; - int[] data = new int[MPC555.MAX_NOF_WORDS_FAST_DOWNLOAD]; + int[] data = new int[bdi.getMaxNofWordsFastDownload()]; data[0] = 0x9421ffb0; data[1] = 0xbf810040; @@ -463,26 +466,26 @@ public class BDI555test { try { StringBuffer sb = new StringBuffer("dumpData: BASE_ADDR = 0x" + Integer.toHexString(BASE_ADDR) + "\n" + 0 + "\tData: 0x" - + Integer.toHexString(MPC555.readMem(BASE_ADDR, 4)) + "\n"); + + Integer.toHexString(bdi.readMem(BASE_ADDR, 4)) + "\n"); for (int i = 1; i < 120; i++) { sb.append(i + "\tData: 0x" - + Integer.toHexString(MPC555.readMemSeq(4)) + "\n"); + + Integer.toHexString(bdi.readMemSeq(4)) + "\n"); } logger.info(sb.toString()); logger.info("fastDownload at BASE_ADDR = 0x" + Integer.toHexString(BASE_ADDR) + ", length = " - + MPC555.MAX_NOF_WORDS_FAST_DOWNLOAD); - MPC555.startFastDownload(BASE_ADDR); - MPC555.fastDownload(data, MPC555.MAX_NOF_WORDS_FAST_DOWNLOAD); - MPC555.stopFastDownload(); + + bdi.getMaxNofWordsFastDownload()); + bdi.startFastDownload(BASE_ADDR); + bdi.fastDownload(data, bdi.getMaxNofWordsFastDownload()); + bdi.stopFastDownload(); sb = new StringBuffer("dumpData: BASE_ADDR = 0x" + Integer.toHexString(BASE_ADDR) + "\n" + 0 + "\tData: 0x" - + Integer.toHexString(MPC555.readMem(BASE_ADDR, 4)) + "\n"); + + Integer.toHexString(bdi.readMem(BASE_ADDR, 4)) + "\n"); for (int i = 1; i < 120; i++) { sb.append(i + "\tData: 0x" - + Integer.toHexString(MPC555.readMemSeq(4)) + "\n"); + + Integer.toHexString(bdi.readMemSeq(4)) + "\n"); } logger.info(sb.toString()); } catch (USBException e) { @@ -509,20 +512,20 @@ public class BDI555test { private static void testFill(int baseAddr) throws USBException, DispatchException, BDIException { // int length = (int) (1 + Math.random() - // * (MPC555.MAX_NOF_WORDS_FAST_DOWNLOAD - 1)); + // * (bdi.getMaxNofWordsFastDownload() - 1)); int length = 101; int[] data = getSampleData(length); logger.info("BaseAddr: 0x" + Integer.toHexString(baseAddr) + ", dataLength: " + data.length); // download data - MPC555.startFastDownload(baseAddr); - MPC555.fastDownload(data, data.length); - MPC555.stopFastDownload(); + bdi.startFastDownload(baseAddr); + bdi.fastDownload(data, data.length); + bdi.stopFastDownload(); // read back data int[] compare = new int[data.length]; - compare[0] = MPC555.readMem(baseAddr, 4); + compare[0] = bdi.readMem(baseAddr, 4); for (int i = 1; i < compare.length; i++) { - compare[i] = MPC555.readMemSeq(4); + compare[i] = bdi.readMemSeq(4); } StringBuffer sb = new StringBuffer(); for (int i = 0; i < compare.length; i++) { @@ -551,16 +554,16 @@ public class BDI555test { // DER = 031C7400FH(* 835141647*) // SRR1 = 03802H(* 14338*) - MPC555.writeMem(0x2FC100, 0x01000003, 4); - MPC555.writeMem(0x2FC104, 0x0FFC00020, 4); - MPC555.writeMem(0x2FC108, 0x0800003, 4); - MPC555.writeMem(0x2FC10C, 0x0FFE00020, 4); - MPC555.writeMem(0x2FC140, 3, 4); - MPC555.writeMem(0x2FC144, 0x7E000000, 4); - MPC555.writeSPR(158, 0x07); - MPC555.writeMem(0x2FC288, -1, 4); - MPC555.writeSPR(149, 0x031C7400F); - MPC555.writeSPR(27, 0x03802); + bdi.writeMem(0x2FC100, 0x01000003, 4); + bdi.writeMem(0x2FC104, 0x0FFC00020, 4); + bdi.writeMem(0x2FC108, 0x0800003, 4); + bdi.writeMem(0x2FC10C, 0x0FFE00020, 4); + bdi.writeMem(0x2FC140, 3, 4); + bdi.writeMem(0x2FC144, 0x7E000000, 4); + bdi.writeSPR(158, 0x07); + bdi.writeMem(0x2FC288, -1, 4); + bdi.writeSPR(149, 0x031C7400F); + bdi.writeSPR(27, 0x03802); for (int i = 0; i < nofRuns; i++) { testFill(0x03F9800); diff --git a/mcdp/src/ch/ntb/mcdp/bdi/test/FillTest.java b/mcdp/src/ch/ntb/mcdp/bdi/test/FillTest.java index 0f2afbe..7aecaa8 100644 --- a/mcdp/src/ch/ntb/mcdp/bdi/test/FillTest.java +++ b/mcdp/src/ch/ntb/mcdp/bdi/test/FillTest.java @@ -11,6 +11,8 @@ public class FillTest { private static McdpLogger logger = LogUtil.ch_ntb_mcdp_bdi_test; + public static MPC555 bdi; + static int[] addr = new int[10000]; static int[] val = new int[10000]; static int index, baseAddr; @@ -29,7 +31,7 @@ public class FillTest { public static void doCompare() throws USBException, DispatchException, BDIException { for (int i = 0; i < index; i++) { - int result = MPC555.readMem(addr[i], 4); + int result = bdi.readMem(addr[i], 4); if (val[i] != result) { logger.severe("Error at " + i + ", addr: 0x" + Integer.toHexString(addr[i]) + ", expected: 0x" @@ -43,22 +45,22 @@ public class FillTest { BDIException { index = 0; - MPC555.writeMem(0x2FC100, 0x01000003, 4); - MPC555.writeMem(0x2FC104, 0x0FFC00020, 4); - MPC555.writeMem(0x2FC108, 0x0800003, 4); - MPC555.writeMem(0x2FC10C, 0x0FFE00020, 4); - MPC555.writeMem(0x2FC140, 3, 4); - MPC555.writeMem(0x2FC144, 0x7E000000, 4); - MPC555.writeSPR(158, 0x07); - MPC555.writeMem(0x2FC288, -1, 4); - MPC555.writeSPR(149, 0x031C7400F); - MPC555.writeSPR(27, 0x03802); + bdi.writeMem(0x2FC100, 0x01000003, 4); + bdi.writeMem(0x2FC104, 0x0FFC00020, 4); + bdi.writeMem(0x2FC108, 0x0800003, 4); + bdi.writeMem(0x2FC10C, 0x0FFE00020, 4); + bdi.writeMem(0x2FC140, 3, 4); + bdi.writeMem(0x2FC144, 0x7E000000, 4); + bdi.writeSPR(158, 0x07); + bdi.writeMem(0x2FC288, -1, 4); + bdi.writeSPR(149, 0x031C7400F); + bdi.writeSPR(27, 0x03802); int length; - int[] data = new int[MPC555.MAX_NOF_WORDS_FAST_DOWNLOAD]; + int[] data = new int[bdi.getMaxNofWordsFastDownload()]; baseAddr = 0x3F9800; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 42; data[0] = 0x0; data[1] = 0x0; @@ -103,10 +105,10 @@ public class FillTest { data[40] = 0x0; data[41] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3F98A8; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 27; data[0] = 0x0; data[1] = 0x3F98E4; @@ -136,10 +138,10 @@ public class FillTest { data[25] = 0x0; data[26] = 0xE9ACBB39; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3F9BF0; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421FFB0; data[1] = 0xBF810040; @@ -243,7 +245,7 @@ public class FillTest { data[99] = 0x6D9C0810; data[100] = 0x57830801; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x4182000C; data[1] = 0x6B844000; @@ -347,7 +349,7 @@ public class FillTest { data[99] = 0x90E50000; data[100] = 0x3D000030; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 54; data[0] = 0x3928C104; data[1] = 0x3D40FFC0; @@ -404,8 +406,8 @@ public class FillTest { data[52] = 0x39072000; data[53] = 0x3926FFFC; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); } @@ -413,22 +415,22 @@ public class FillTest { DispatchException { index = 0; - MPC555.writeMem(0x2FC100, 0x01000003, 4); - MPC555.writeMem(0x2FC104, 0x0FFC00020, 4); - MPC555.writeMem(0x2FC108, 0x0800003, 4); - MPC555.writeMem(0x2FC10C, 0x0FFE00020, 4); - MPC555.writeMem(0x2FC140, 3, 4); - MPC555.writeMem(0x2FC144, 0x7E000000, 4); - MPC555.writeSPR(158, 0x07); - MPC555.writeMem(0x2FC288, -1, 4); - MPC555.writeSPR(149, 0x031C7400F); - MPC555.writeSPR(27, 0x03802); + bdi.writeMem(0x2FC100, 0x01000003, 4); + bdi.writeMem(0x2FC104, 0x0FFC00020, 4); + bdi.writeMem(0x2FC108, 0x0800003, 4); + bdi.writeMem(0x2FC10C, 0x0FFE00020, 4); + bdi.writeMem(0x2FC140, 3, 4); + bdi.writeMem(0x2FC144, 0x7E000000, 4); + bdi.writeSPR(158, 0x07); + bdi.writeMem(0x2FC288, -1, 4); + bdi.writeSPR(149, 0x031C7400F); + bdi.writeSPR(27, 0x03802); int length; - int[] data = new int[MPC555.MAX_NOF_WORDS_FAST_DOWNLOAD]; + int[] data = new int[bdi.getMaxNofWordsFastDownload()]; baseAddr = 0x3F9800; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 42; data[0] = 0x0; data[1] = 0x0; @@ -473,10 +475,10 @@ public class FillTest { data[40] = 0x0; data[41] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3F98A8; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 27; data[0] = 0x0; data[1] = 0x3F98E4; @@ -506,10 +508,10 @@ public class FillTest { data[25] = 0x0; data[26] = 0xE9ACBB39; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3F9BF0; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421FFB0; data[1] = 0xBF810040; @@ -613,7 +615,7 @@ public class FillTest { data[99] = 0x6D9C0810; data[100] = 0x57830801; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x4182000C; data[1] = 0x6B844000; @@ -717,7 +719,7 @@ public class FillTest { data[99] = 0x90E50000; data[100] = 0x3D000030; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 54; data[0] = 0x3928C104; data[1] = 0x3D40FFC0; @@ -774,10 +776,10 @@ public class FillTest { data[52] = 0x39072000; data[53] = 0x3926FFFC; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3F9FF0; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x3948FFFC; data[1] = 0x562BE8FF; @@ -881,7 +883,7 @@ public class FillTest { data[99] = 0x91280000; data[100] = 0x3D400030; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 46; data[0] = 0x396AC010; data[1] = 0x3D80FFFF; @@ -930,10 +932,10 @@ public class FillTest { data[44] = 0x4E800020; data[45] = 0xECF41B66; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3F9914; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x0; data[1] = 0x3F9950; @@ -1037,7 +1039,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 9; data[0] = 0x0; data[1] = 0x0; @@ -1049,10 +1051,10 @@ public class FillTest { data[7] = 0x0; data[8] = 0xEA187BE9; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3FA23C; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421FF90; data[1] = 0x7C000026; @@ -1156,7 +1158,7 @@ public class FillTest { data[99] = 0x7C821A14; data[100] = 0x80A40414; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x90BC0008; data[1] = 0xE9C0000; @@ -1260,7 +1262,7 @@ public class FillTest { data[99] = 0x4E800020; data[100] = 0x9421FFC0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 54; data[0] = 0xBFE1003C; data[1] = 0x3BE10038; @@ -1317,10 +1319,10 @@ public class FillTest { data[52] = 0xE930000; data[53] = 0xE930000; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3FA63C; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 39; data[0] = 0x38D30004; data[1] = 0x90D30000; @@ -1362,10 +1364,10 @@ public class FillTest { data[37] = 0x4E800020; data[38] = 0x340DD8B; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3F9ACC; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 73; data[0] = 0x10; data[1] = 0x3FABA0; @@ -1441,10 +1443,10 @@ public class FillTest { data[71] = 0x0; data[72] = 0xEBD013B6; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x0; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421FFC0; data[1] = 0xBFC10038; @@ -1548,7 +1550,7 @@ public class FillTest { data[99] = 0x800100C0; data[100] = 0x382100DC; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x4C000064; data[1] = 0x0; @@ -1652,7 +1654,7 @@ public class FillTest { data[99] = 0x3907C010; data[100] = 0xA3A80000; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 54; data[0] = 0x3BC00010; data[1] = 0x33DEFFFF; @@ -1709,10 +1711,10 @@ public class FillTest { data[52] = 0x5F684001; data[53] = 0x41820028; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x400; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x387C0000; data[1] = 0x8123FFFC; @@ -1816,7 +1818,7 @@ public class FillTest { data[99] = 0x800100CC; data[100] = 0x7C0803A6; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x800100C4; data[1] = 0x7C1B03A6; @@ -1920,7 +1922,7 @@ public class FillTest { data[99] = 0x900100C0; data[100] = 0x7C000026; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 54; data[0] = 0x900100C4; data[1] = 0x7C0902A6; @@ -1977,10 +1979,10 @@ public class FillTest { data[52] = 0x0; data[53] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x800; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421FF34; data[1] = 0x900100B0; @@ -2084,7 +2086,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -2188,7 +2190,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 54; data[0] = 0x0; data[1] = 0x0; @@ -2245,10 +2247,10 @@ public class FillTest { data[52] = 0x0; data[53] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0xC00; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421FF34; data[1] = 0x900100B0; @@ -2352,7 +2354,7 @@ public class FillTest { data[99] = 0x800100B4; data[100] = 0x7C1A03A6; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x800100B0; data[1] = 0x382100CC; @@ -2456,7 +2458,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 54; data[0] = 0x0; data[1] = 0x0; @@ -2513,10 +2515,10 @@ public class FillTest { data[52] = 0x0; data[53] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x1000; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421FF34; data[1] = 0x900100B0; @@ -2620,7 +2622,7 @@ public class FillTest { data[99] = 0x3BA40000; data[100] = 0xE9E0000; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x57AA083C; data[1] = 0x316A0001; @@ -2724,7 +2726,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 54; data[0] = 0x0; data[1] = 0x0; @@ -2781,10 +2783,10 @@ public class FillTest { data[52] = 0x0; data[53] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x1400; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -2888,7 +2890,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -2992,7 +2994,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 54; data[0] = 0x0; data[1] = 0x0; @@ -3049,10 +3051,10 @@ public class FillTest { data[52] = 0x0; data[53] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x1800; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -3156,7 +3158,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -3260,7 +3262,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 54; data[0] = 0x0; data[1] = 0x0; @@ -3317,10 +3319,10 @@ public class FillTest { data[52] = 0x0; data[53] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x1C00; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -3424,7 +3426,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -3528,7 +3530,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 51; data[0] = 0x0; data[1] = 0x0; @@ -3582,10 +3584,10 @@ public class FillTest { data[49] = 0x4E800020; data[50] = 0x50C5598E; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x802000; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x26; data[1] = 0x80326C; @@ -3689,7 +3691,7 @@ public class FillTest { data[99] = 0x802370; data[100] = 0x80325C; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 58; data[0] = 0x8023F4; data[1] = 0x80325C; @@ -3750,10 +3752,10 @@ public class FillTest { data[56] = 0x0; data[57] = 0x7145256D; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x80227C; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421FFC0; data[1] = 0xBFC10038; @@ -3857,7 +3859,7 @@ public class FillTest { data[99] = 0x90410014; data[100] = 0x3BC30000; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x38600062; data[1] = 0x4BFFFE69; @@ -3961,7 +3963,7 @@ public class FillTest { data[99] = 0xCBC0022; data[100] = 0x578A103A; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 54; data[0] = 0x7D625214; data[1] = 0x806B0018; @@ -4018,10 +4020,10 @@ public class FillTest { data[52] = 0x39400000; data[53] = 0xB1420004; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x80267C; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x383FFFC8; data[1] = 0xBB810044; @@ -4125,7 +4127,7 @@ public class FillTest { data[99] = 0x4086000C; data[100] = 0x4BFFFD19; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x428001A4; data[1] = 0xA8620004; @@ -4229,7 +4231,7 @@ public class FillTest { data[99] = 0x3B9B0000; data[100] = 0x4280FF40; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 54; data[0] = 0xCBC0022; data[1] = 0x578C103A; @@ -4286,10 +4288,10 @@ public class FillTest { data[52] = 0x8001004C; data[53] = 0x7C0803A6; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x802A7C; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x38210050; data[1] = 0x4E800020; @@ -4393,7 +4395,7 @@ public class FillTest { data[99] = 0x387E0000; data[100] = 0x8083FFFC; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x8004FFF0; data[1] = 0x7C0903A6; @@ -4497,7 +4499,7 @@ public class FillTest { data[99] = 0xB0620008; data[100] = 0xA8820008; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 54; data[0] = 0x2F840022; data[1] = 0x419C0010; @@ -4554,10 +4556,10 @@ public class FillTest { data[52] = 0x80410014; data[53] = 0x4280FC6C; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x802E7C; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x383FFFC8; data[1] = 0xBB610048; @@ -4661,7 +4663,7 @@ public class FillTest { data[99] = 0xE9E0000; data[100] = 0x80FE0004; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x390003E8; data[1] = 0x7D2743D6; @@ -4765,7 +4767,7 @@ public class FillTest { data[99] = 0x33DE0001; data[100] = 0x4280FFE0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 40; data[0] = 0x3D400080; data[1] = 0x396A2AC8; @@ -4808,10 +4810,10 @@ public class FillTest { data[38] = 0x4E800020; data[39] = 0x73C16892; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x80330C; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 27; data[0] = 0x0; data[1] = 0x803348; @@ -4841,10 +4843,10 @@ public class FillTest { data[25] = 0x3FA6E0; data[26] = 0x8451FDF2; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x803378; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 87; data[0] = 0x9421FFB0; data[1] = 0x7C000026; @@ -4934,10 +4936,10 @@ public class FillTest { data[85] = 0x4E800020; data[86] = 0x84BDA90A; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x8034DC; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 60; data[0] = 0x1; data[1] = 0x803728; @@ -5000,10 +5002,10 @@ public class FillTest { data[58] = 0x0; data[59] = 0x86212A8C; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x8035CC; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 83; data[0] = 0x9421FFB0; data[1] = 0x7C0802A6; @@ -5089,30 +5091,30 @@ public class FillTest { data[81] = 0x4E800020; data[82] = 0x87111E2A; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); } public static void doFill2() throws BDIException, USBException, DispatchException { index = 0; - MPC555.writeMem(0x2FC100, 0x01000003, 4); - MPC555.writeMem(0x2FC104, 0x0FFC00020, 4); - MPC555.writeMem(0x2FC108, 0x0800003, 4); - MPC555.writeMem(0x2FC10C, 0x0FFE00020, 4); - MPC555.writeMem(0x2FC140, 3, 4); - MPC555.writeMem(0x2FC144, 0x7E000000, 4); - MPC555.writeSPR(158, 0x07); - MPC555.writeMem(0x2FC288, -1, 4); - MPC555.writeSPR(149, 0x031C7400F); - MPC555.writeSPR(27, 0x03802); + bdi.writeMem(0x2FC100, 0x01000003, 4); + bdi.writeMem(0x2FC104, 0x0FFC00020, 4); + bdi.writeMem(0x2FC108, 0x0800003, 4); + bdi.writeMem(0x2FC10C, 0x0FFE00020, 4); + bdi.writeMem(0x2FC140, 3, 4); + bdi.writeMem(0x2FC144, 0x7E000000, 4); + bdi.writeSPR(158, 0x07); + bdi.writeMem(0x2FC288, -1, 4); + bdi.writeSPR(149, 0x031C7400F); + bdi.writeSPR(27, 0x03802); int length; - int[] data = new int[MPC555.MAX_NOF_WORDS_FAST_DOWNLOAD]; + int[] data = new int[bdi.getMaxNofWordsFastDownload()]; baseAddr = 0x3f9800; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -5216,10 +5218,10 @@ public class FillTest { data[99] = 0x1; data[100] = 0x10be340; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3f98a8; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x0; data[1] = 0x3f98e4; @@ -5323,10 +5325,10 @@ public class FillTest { data[99] = 0x1; data[100] = 0x10be340; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3f9bf0; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421ffb0; data[1] = 0xbf810040; @@ -5430,7 +5432,7 @@ public class FillTest { data[99] = 0x6d9c0810; data[100] = 0x57830801; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x4182000c; data[1] = 0x6b844000; @@ -5534,7 +5536,7 @@ public class FillTest { data[99] = 0x90e50000; data[100] = 0x3d000030; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x3928c104; data[1] = 0x3d40ffc0; @@ -5638,10 +5640,10 @@ public class FillTest { data[99] = 0x90e50000; data[100] = 0x3d000030; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3f9ff0; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x3948fffc; data[1] = 0x562be8ff; @@ -5745,7 +5747,7 @@ public class FillTest { data[99] = 0x91280000; data[100] = 0x3d400030; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x396ac010; data[1] = 0x3d80ffff; @@ -5849,10 +5851,10 @@ public class FillTest { data[99] = 0x91280000; data[100] = 0x3d400030; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3f9914; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x0; data[1] = 0x3f9950; @@ -5956,7 +5958,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -6060,10 +6062,10 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3fa23c; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421ff90; data[1] = 0x7c000026; @@ -6167,7 +6169,7 @@ public class FillTest { data[99] = 0x7c821a14; data[100] = 0x80a40414; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x90bc0008; data[1] = 0xe9c0000; @@ -6271,7 +6273,7 @@ public class FillTest { data[99] = 0x4e800020; data[100] = 0x9421ffc0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0xbfe1003c; data[1] = 0x3be10038; @@ -6375,10 +6377,10 @@ public class FillTest { data[99] = 0x4e800020; data[100] = 0x9421ffc0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3fa63c; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x38d30004; data[1] = 0x90d30000; @@ -6482,10 +6484,10 @@ public class FillTest { data[99] = 0x4e800020; data[100] = 0x9421ffc0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x3f9acc; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x10; data[1] = 0x3faba0; @@ -6589,10 +6591,10 @@ public class FillTest { data[99] = 0x4e800020; data[100] = 0x9421ffc0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x0; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421ffc0; data[1] = 0xbfc10038; @@ -6696,7 +6698,7 @@ public class FillTest { data[99] = 0x800100c0; data[100] = 0x382100dc; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x4c000064; data[1] = 0x0; @@ -6800,7 +6802,7 @@ public class FillTest { data[99] = 0x3907c010; data[100] = 0xa3a80000; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x3bc00010; data[1] = 0x33deffff; @@ -6904,10 +6906,10 @@ public class FillTest { data[99] = 0x3907c010; data[100] = 0xa3a80000; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x400; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x387c0000; data[1] = 0x8123fffc; @@ -7011,7 +7013,7 @@ public class FillTest { data[99] = 0x800100cc; data[100] = 0x7c0803a6; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x800100c4; data[1] = 0x7c1b03a6; @@ -7115,7 +7117,7 @@ public class FillTest { data[99] = 0x900100c0; data[100] = 0x7c000026; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x900100c4; data[1] = 0x7c0902a6; @@ -7219,10 +7221,10 @@ public class FillTest { data[99] = 0x900100c0; data[100] = 0x7c000026; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x800; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421ff34; data[1] = 0x900100b0; @@ -7326,7 +7328,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -7430,7 +7432,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -7534,10 +7536,10 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0xc00; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421ff34; data[1] = 0x900100b0; @@ -7641,7 +7643,7 @@ public class FillTest { data[99] = 0x800100b4; data[100] = 0x7c1a03a6; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x800100b0; data[1] = 0x382100cc; @@ -7745,7 +7747,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -7849,10 +7851,10 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x1000; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421ff34; data[1] = 0x900100b0; @@ -7956,7 +7958,7 @@ public class FillTest { data[99] = 0x3ba40000; data[100] = 0xe9e0000; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x57aa083c; data[1] = 0x316a0001; @@ -8060,7 +8062,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -8164,10 +8166,10 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x1400; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -8271,7 +8273,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -8375,7 +8377,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -8479,10 +8481,10 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x1800; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -8586,7 +8588,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -8690,7 +8692,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -8794,10 +8796,10 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x1c00; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -8901,7 +8903,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -9005,7 +9007,7 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x0; data[1] = 0x0; @@ -9109,10 +9111,10 @@ public class FillTest { data[99] = 0x0; data[100] = 0x0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x802000; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x26; data[1] = 0x80326c; @@ -9216,7 +9218,7 @@ public class FillTest { data[99] = 0x802370; data[100] = 0x80325c; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x8023f4; data[1] = 0x80325c; @@ -9320,10 +9322,10 @@ public class FillTest { data[99] = 0x802370; data[100] = 0x80325c; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x80227c; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421ffc0; data[1] = 0xbfc10038; @@ -9427,7 +9429,7 @@ public class FillTest { data[99] = 0x90410014; data[100] = 0x3bc30000; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x38600062; data[1] = 0x4bfffe69; @@ -9531,7 +9533,7 @@ public class FillTest { data[99] = 0xcbc0022; data[100] = 0x578a103a; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x7d625214; data[1] = 0x806b0018; @@ -9635,10 +9637,10 @@ public class FillTest { data[99] = 0xcbc0022; data[100] = 0x578a103a; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x80267c; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x383fffc8; data[1] = 0xbb810044; @@ -9742,7 +9744,7 @@ public class FillTest { data[99] = 0x4086000c; data[100] = 0x4bfffd19; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x428001a4; data[1] = 0xa8620004; @@ -9846,7 +9848,7 @@ public class FillTest { data[99] = 0x3b9b0000; data[100] = 0x4280ff40; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0xcbc0022; data[1] = 0x578c103a; @@ -9950,10 +9952,10 @@ public class FillTest { data[99] = 0x3b9b0000; data[100] = 0x4280ff40; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x802a7c; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x38210050; data[1] = 0x4e800020; @@ -10057,7 +10059,7 @@ public class FillTest { data[99] = 0x387e0000; data[100] = 0x8083fffc; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x8004fff0; data[1] = 0x7c0903a6; @@ -10161,7 +10163,7 @@ public class FillTest { data[99] = 0xb0620008; data[100] = 0xa8820008; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x2f840022; data[1] = 0x419c0010; @@ -10265,10 +10267,10 @@ public class FillTest { data[99] = 0xb0620008; data[100] = 0xa8820008; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x802e7c; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x383fffc8; data[1] = 0xbb610048; @@ -10372,7 +10374,7 @@ public class FillTest { data[99] = 0xe9e0000; data[100] = 0x80fe0004; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x390003e8; data[1] = 0x7d2743d6; @@ -10476,7 +10478,7 @@ public class FillTest { data[99] = 0x33de0001; data[100] = 0x4280ffe0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); + bdi.fastDownload(data, length); length = 101; data[0] = 0x3d400080; data[1] = 0x396a2ac8; @@ -10580,10 +10582,10 @@ public class FillTest { data[99] = 0x33de0001; data[100] = 0x4280ffe0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x80330c; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x0; data[1] = 0x803348; @@ -10687,10 +10689,10 @@ public class FillTest { data[99] = 0x33de0001; data[100] = 0x4280ffe0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x803378; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421ffb0; data[1] = 0x7c000026; @@ -10794,10 +10796,10 @@ public class FillTest { data[99] = 0x33de0001; data[100] = 0x4280ffe0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x8034dc; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x1; data[1] = 0x803728; @@ -10901,10 +10903,10 @@ public class FillTest { data[99] = 0x33de0001; data[100] = 0x4280ffe0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); baseAddr = 0x8035cc; - MPC555.startFastDownload(baseAddr); + bdi.startFastDownload(baseAddr); length = 101; data[0] = 0x9421ffb0; data[1] = 0x7c0802a6; @@ -11008,7 +11010,7 @@ public class FillTest { data[99] = 0x33de0001; data[100] = 0x4280ffe0; add(baseAddr, data, length); - MPC555.fastDownload(data, length); - MPC555.stopFastDownload(); + bdi.fastDownload(data, length); + bdi.stopFastDownload(); } } diff --git a/mcdp/src/ch/ntb/mcdp/mc68332/IMCBTargetBoard.java b/mcdp/src/ch/ntb/mcdp/mc68332/IMCBTargetBoard.java index 50e37ba..91b986b 100644 --- a/mcdp/src/ch/ntb/mcdp/mc68332/IMCBTargetBoard.java +++ b/mcdp/src/ch/ntb/mcdp/mc68332/IMCBTargetBoard.java @@ -15,53 +15,58 @@ import ch.ntb.usb.USBException; public class IMCBTargetBoard { - static final McdpLogger logger = LogUtil.ch_ntb_mcdp_mc68332; + private static final McdpLogger logger = LogUtil.ch_ntb_mcdp_mc68332; - final static String dictionaryPath = "resources/targets/mc68332/registerDictionary.xml"; + private final static String dictionaryPath = "resources/targets/mc68332/registerDictionary.xml"; - static MC68332RegisterDict regDict = new MC68332RegisterDict(); + private static MC68332RegisterDict regDict = new MC68332RegisterDict(); - private static void writeRegister(String name, int value) - throws USBException, DispatchException, BDIException { + private MC68332 bdi; + + public IMCBTargetBoard(MC68332 bdi) { + this.bdi = bdi; + } + + public void writeRegister(String name, int value) throws USBException, + DispatchException, BDIException { logger.info("writeRegister: " + name + ", value: 0x" + Integer.toHexString(value)); MC68332Register r = (MC68332Register) regDict.getRegister(name); switch (r.type) { case MC68332Register.CtrlReg: - MC68332.writeMem(r.value, value, r.size); + bdi.writeMem(r.value, value, r.size); break; case MC68332Register.SysReg: - MC68332.writeSysReg(r.value, value); + bdi.writeSysReg(r.value, value); break; case MC68332Register.UserReg: - MC68332.writeUserReg(r.value, value); + bdi.writeUserReg(r.value, value); break; } } - private static int readRegister(String name) throws USBException, + public int readRegister(String name) throws USBException, DispatchException, BDIException { logger.info("readRegister: " + name); MC68332Register r = (MC68332Register) regDict.getRegister(name); switch (r.type) { case MC68332Register.CtrlReg: - return MC68332.readMem(r.value, r.size); + return bdi.readMem(r.value, r.size); case MC68332Register.SysReg: - return MC68332.readSysReg(r.value); + return bdi.readSysReg(r.value); case MC68332Register.UserReg: - return MC68332.readUserReg(r.value); + return bdi.readUserReg(r.value); } return -1; } - public static void init() throws USBException, DispatchException, - BDIException, IOException, ParserConfigurationException, - SAXException { + public void init() throws USBException, DispatchException, BDIException, + IOException, ParserConfigurationException, SAXException { logger.info("reading dictionary file from " + dictionaryPath); regDict.addRegistersFromFile(dictionaryPath); - MC68332.reset_target(); + bdi.reset_target(); // regDict.printRegisters();