- logger added
git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@68 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c
This commit is contained in:
@@ -3,10 +3,14 @@ package ch.ntb.mcdp.bdi.test;
|
||||
import ch.ntb.mcdp.bdi.BDIException;
|
||||
import ch.ntb.mcdp.bdi.MPC555;
|
||||
import ch.ntb.mcdp.usb.DispatchException;
|
||||
import ch.ntb.mcdp.utils.logger.LogUtil;
|
||||
import ch.ntb.mcdp.utils.logger.McdpLogger;
|
||||
import ch.ntb.usb.USBException;
|
||||
|
||||
public class BDI555test {
|
||||
|
||||
private static McdpLogger logger = LogUtil.ch_ntb_mcdp_bdi_test;
|
||||
|
||||
// private static void testBdiTransaction() {
|
||||
// // test bdi transaction
|
||||
// DataPacket result = null;
|
||||
@@ -37,6 +41,7 @@ public class BDI555test {
|
||||
MPC555.writeMem(0x02FC004, 0x0FFFFFF83, 4);
|
||||
// SCCR, switch off EECLK for download
|
||||
MPC555.writeMem(0x02FC280, 0x08121C100, 4);
|
||||
logger.info("Is freeze asserted: " + MPC555.isFreezeAsserted());
|
||||
} catch (USBException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
@@ -51,8 +56,7 @@ public class BDI555test {
|
||||
|
||||
private static void freeze() {
|
||||
try {
|
||||
System.out
|
||||
.println("isFreezeAsserted: " + MPC555.isFreezeAsserted());
|
||||
logger.info("isFreezeAsserted: " + MPC555.isFreezeAsserted());
|
||||
} catch (USBException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
@@ -69,6 +73,7 @@ public class BDI555test {
|
||||
private static void break_() {
|
||||
try {
|
||||
MPC555.break_();
|
||||
logger.info("break");
|
||||
} catch (USBException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
@@ -84,6 +89,7 @@ public class BDI555test {
|
||||
private static void go() {
|
||||
try {
|
||||
MPC555.go();
|
||||
logger.info("go");
|
||||
} catch (USBException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
@@ -97,9 +103,12 @@ public class BDI555test {
|
||||
}
|
||||
|
||||
private static void writeMem() {
|
||||
final int BASE_ADDR = 0x800000;
|
||||
final int BASE_ADDR = 0x800000, VALUE = 0x123456;
|
||||
try {
|
||||
MPC555.writeMem(BASE_ADDR, 0x123456, 4);
|
||||
MPC555.writeMem(BASE_ADDR, VALUE, 4);
|
||||
logger.info("writeMem: BASE_ADDR = 0x"
|
||||
+ Integer.toHexString(BASE_ADDR) + ", value = 0x"
|
||||
+ Integer.toHexString(VALUE));
|
||||
} catch (USBException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
@@ -115,13 +124,14 @@ public class BDI555test {
|
||||
private static void readMem() {
|
||||
final int BASE_ADDR = 0x800000;
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuffer sb = new StringBuffer("readMem: BASE_ADDR = 0x"
|
||||
+ 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(MPC555.readMem(BASE_ADDR + i * 4,
|
||||
4)) + "\n");
|
||||
}
|
||||
System.out.println(sb.toString());
|
||||
logger.info(sb.toString());
|
||||
} catch (USBException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
@@ -136,11 +146,14 @@ public class BDI555test {
|
||||
|
||||
private static void fastDownload() {
|
||||
final int BASE_ADDR = 0x800000;
|
||||
int[] testData = new int[120];
|
||||
int[] testData = new int[MPC555.MAX_NOF_WORDS_FAST_DOWNLOAD];
|
||||
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();
|
||||
@@ -159,13 +172,14 @@ public class BDI555test {
|
||||
private static void readMemSeq() {
|
||||
final int BASE_ADDR = 0x800000;
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer(0 + "\tData: 0x"
|
||||
StringBuffer sb = new StringBuffer("readMemSeq: BASE_ADDR = 0x"
|
||||
+ Integer.toHexString(BASE_ADDR) + "\n" + 0 + "\tData: 0x"
|
||||
+ Integer.toHexString(MPC555.readMem(BASE_ADDR, 4)) + "\n");
|
||||
for (int i = 1; i < 120; i++) {
|
||||
sb.append(i + "\tData: 0x"
|
||||
+ Integer.toHexString(MPC555.readMemSeq(4)) + "\n");
|
||||
}
|
||||
System.out.println(sb.toString());
|
||||
logger.info(sb.toString());
|
||||
} catch (USBException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
@@ -184,46 +198,48 @@ public class BDI555test {
|
||||
}
|
||||
|
||||
public static void button2() {
|
||||
System.out.println("reset_target()");
|
||||
reset_target();
|
||||
}
|
||||
|
||||
public static void button3() {
|
||||
System.out.println("go()");
|
||||
go();
|
||||
}
|
||||
|
||||
public static void button4() {
|
||||
System.out.println("break_()");
|
||||
break_();
|
||||
}
|
||||
|
||||
public static void button5() {
|
||||
System.out.println("freeze()");
|
||||
freeze();
|
||||
}
|
||||
|
||||
public static void button6() {
|
||||
System.out.println("writeMem()");
|
||||
writeMem();
|
||||
}
|
||||
|
||||
public static void button7() {
|
||||
System.out.println("readMem()");
|
||||
readMem();
|
||||
}
|
||||
|
||||
public static void button8() {
|
||||
System.out.println("readMemSeq()");
|
||||
readMemSeq();
|
||||
}
|
||||
|
||||
public static void button9() {
|
||||
System.out.println("");
|
||||
logger.info("not implemented!");
|
||||
// logger.info("hard_reset()");
|
||||
// try {
|
||||
// MPC555.hard_reset();
|
||||
// } catch (USBException e) {
|
||||
// e.printStackTrace();
|
||||
// } catch (DispatchException e) {
|
||||
// e.printStackTrace();
|
||||
// } catch (BDIException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
}
|
||||
|
||||
public static void button10() {
|
||||
System.out.println("fastDownload()");
|
||||
fastDownload();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user