- RegisterDictioniary updated

- TestClasses added
- Some unnecessary imports removed

git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@58 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c
This commit is contained in:
schlaepfer
2005-11-21 15:21:40 +00:00
parent 9c63504caf
commit ef133e3c83
7 changed files with 74 additions and 34 deletions

View File

@@ -3,7 +3,7 @@ package ch.ntb.mcdp.dict;
public class Register {
// Register Types
public static String[] types = null;
protected static String[] types = null;
public Register(String name, int type, int value, int size,
String description) {
@@ -29,4 +29,8 @@ public class Register {
return new String(name + "\t" + types[type] + "\t0x"
+ Integer.toHexString(value) + "\t" + size + "\t" + description);
}
public String[] getTypes(){
return types;
}
}

View File

@@ -0,0 +1,32 @@
package ch.ntb.mcdp.dict.test;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
import ch.ntb.mcdp.mc68332.MC68332RegisterDict;
public class Test332Dict {
private static final String PATH_TO_REGISTER_FILE = "resources/targets/mc68332/registerDictionary.xml";
public static void main(String[] args) {
MC68332RegisterDict regdict = new MC68332RegisterDict();
try {
regdict.addRegistersFromFile(PATH_TO_REGISTER_FILE);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
regdict.printRegisters();
}
}

View File

@@ -0,0 +1,29 @@
package ch.ntb.mcdp.dict.test;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
import ch.ntb.mcdp.mpc555.MPC555RegisterDict;
public class Test555Dict {
private static final String PATH_TO_REGISTER_FILE = "resources/targets/mpc555/registerDictionary.xml";
public static void main(String[] args) {
MPC555RegisterDict regdict = new MPC555RegisterDict();
try {
regdict.addRegistersFromFile(PATH_TO_REGISTER_FILE);
} catch (IOException e) {
e.printStackTrace();
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
}
regdict.printRegisters();
}
}

View File

@@ -14,7 +14,7 @@ public class MC68332RegisterDict extends RegisterDict {
private static final String PATH_TO_REGISTER_FILE = "resources/targets/mc68332/registerDictionary.xml";
MC68332RegisterDict() {
public MC68332RegisterDict() {
super(REGISTER_CLASS);
// TODO: remove

View File

@@ -5,8 +5,10 @@ import ch.ntb.mcdp.dict.Register;
public class MPC555Register extends Register {
// Register Types
static final String[] types = new String[] { "GPR", "FPR", "SPR", "MSR",
"CR", "FPSCR", "CtrlReg" };
static {
types = new String[] { "GPR", "FPR", "SPR", "MSR", "CR", "FPSCR",
"CtrlReg" };
}
static final int GPR = 0;
@@ -22,7 +24,7 @@ public class MPC555Register extends Register {
static final int CtrlReg = 6;
protected MPC555Register(String name, int type, int value, int size,
public MPC555Register(String name, int type, int value, int size,
String description) {
super(name, type, value, size, description);
}

View File

@@ -1,35 +1,12 @@
package ch.ntb.mcdp.mpc555;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
import ch.ntb.mcdp.dict.RegisterDict;
public class MPC555RegisterDict extends RegisterDict {
private static final String REGISTER_CLASS = "ch.ntb.mcdp.mpc555.MPC555RegisterDict";
private static final String REGISTER_CLASS = "ch.ntb.mcdp.mpc555.MPC555Register";
private static final String PATH_TO_REGISTER_FILE = "resources/targets/mpc555/registerDictionary.xml";
MPC555RegisterDict() {
public MPC555RegisterDict() {
super(REGISTER_CLASS);
// TODO: remove
try {
addRegistersFromFile(PATH_TO_REGISTER_FILE);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
printRegisters();
}
}

View File

@@ -1,11 +1,7 @@
package ch.ntb.mcdp.uart;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.LinkedList;
import ch.ntb.mcdp.usb.DataPacket;
public class Uart0 extends Uart {
Uart0(LinkedList<Uart> list) {