use of joprt.RtThread in project jop by jop-devel.
the class Tal method main.
/**
* Start all threads and enter forever loop.
*/
public static void main(String[] args) {
// we provide a null pointer in Startup.java for JOP
simpc = args != null;
evn = true;
run = true;
// will be UDP...
if (simpc) {
Dbg.initSer();
} else {
Dbg.init();
}
//
// start TCP/IP
//
Ejip ejip = new Ejip();
net = new Net(ejip);
net.getUdp().addHandler(Tftp.PORT, new Tftp(ejip));
int[] outReg = new int[1];
outReg[0] = 0;
HtmlBaseio http = new HtmlBaseio();
// register the simple HTTP server
net.getTcp().addHandler(80, http);
http.setOutValArray(outReg);
// don't use CS8900 when simulating on PC
if (!simpc) {
int[] eth = { 0x00, 0xe0, 0x98, 0x33, 0xb0, 0xf8 };
int ip = Ejip.makeIp(192, 168, 0, 123);
ipLink = new CS8900(ejip, eth, ip);
}
// use instead Slip for PC simulation
// LinkLayer ipLink = Slip.init(Const.IO_UART_BG_MODEM_BASE,
// (192<<24) + (168<<16) + (1<<8) + 2);
//
// start device driver threads
//
new RtThread(5, 10000) {
public void run() {
for (; ; ) {
waitForNextPeriod();
net.run();
if (!simpc)
ipLink.run();
}
}
};
par = new Param();
fwp = new Fwp(ejip, net);
if (simpc) {
ser = new Serial(Const.IO_UART_BG_MODEM_BASE);
} else {
ser = new Serial(Const.IO_UART1_BASE);
}
if (evn) {
modem = Modem.getInstance(5, 100000, ser);
} else {
new Modbus(5, 10000, ser, outReg);
}
new RtThread(10, 3000) {
public void run() {
for (; ; ) {
waitForNextPeriod();
ser.loop();
}
}
};
loop = new Loop(7, 5000);
RtThread.startMission();
forever();
}
use of joprt.RtThread in project jop by jop-devel.
the class Main method main.
public static void main(String[] args) {
SpeedManager manager = new SpeedManager();
RtThread smThread = new RtThread(manager, 5, 10 * 1000);
System.out.println("created SpeedManager");
Controller control = new Controller(manager);
RtThread ctrlThread = new RtThread(control, 4, 10 * 1000);
System.out.println("created Controller");
Filter frontLeftFilter = new Filter("FLF", manager.frontLeftSpeed);
RtThread flThread = new RtThread(frontLeftFilter, 6, 5 * 1000);
Filter frontRightFilter = new Filter("FRF", manager.frontRightSpeed);
RtThread frThread = new RtThread(frontRightFilter, 6, 5 * 1000);
Filter rearLeftFilter = new Filter("RLF", manager.rearLeftSpeed);
RtThread rlThread = new RtThread(rearLeftFilter, 6, 5 * 1000);
Filter rearRightFilter = new Filter("RRF", manager.rearRightSpeed);
RtThread rrThread = new RtThread(rearRightFilter, 6, 5 * 1000);
System.out.println("created Filters");
Dispatcher dispatch = new Dispatcher(manager, frontLeftFilter, frontRightFilter, rearLeftFilter, rearRightFilter);
RtThread dThread = new RtThread(dispatch, 7, 1000);
System.out.println("created Dispatcher");
System.out.println("Cruise control up and running");
RtThread.startMission();
for (; ; ) {
// wait forever
}
}
use of joprt.RtThread in project jop by jop-devel.
the class MainPpp method main.
/**
* Start network and enter forever loop.
*/
public static void main(String[] args) {
Ejip ejip = new Ejip();
//
// start TCP/IP
//
net = new Net(ejip);
//
// use second serial line for simulation
// with JopSim and on the project usbser
//
ser = new Serial(Const.IO_UART_BG_MODEM_BASE);
//
// Create serial and PPP
//
new RtThread(IPSER_PRIO, IPSER_PERIOD) {
public void run() {
for (; ; ) {
waitForNextPeriod();
ser.loop();
}
}
};
RtThread pppThre = new RtThread(IPLINK_PRIO, IPLINK_PERIOD) {
public void run() {
for (; ; ) {
waitForNextPeriod();
ipLink.run();
}
}
};
ipLink = new Ppp(ejip, ser, pppThre);
new RtThread(20, 100000) {
public void run() {
int i = 0;
for (; ; ) {
waitForNextPeriod();
net.run();
++i;
if (i == 10) {
Timer.wd();
System.out.print('*');
i = 0;
}
Timer.loop();
}
}
};
ipLink.startConnection(new StringBuffer("*99***1#"), new StringBuffer("A1.net"), new StringBuffer("ppp@A1plus.at"), new StringBuffer("ppp"));
RtThread.startMission();
for (; ; ) {
int t = Timer.getTimeoutMs(800);
while (!Timer.timeout(t)) {
RtThread.sleepMs(10);
}
System.out.print("M");
}
}
use of joprt.RtThread in project jop by jop-devel.
the class AESCsp method main.
public static void main(String[] args) {
AESCsp aes = new AESCsp();
// Initialization for benchmarking
int start = 0;
int stop = 0;
int time = 0;
System.out.println("AES Benchmark with SPM and NoC");
int nrCpu = Runtime.getRuntime().availableProcessors();
if (nrCpu < 3) {
throw new Error("Not enough CPUs");
}
// ni must be translated from proc index to NoC address!
new RtThread(aes.source, 1, 1000).setProcessor(1);
new RtThread(aes.enc, 1, 1000).setProcessor(2);
new RtThread(aes.dec, 1, 1000).setProcessor(3);
new RtThread(aes.sink, 1, 1000).setProcessor(4);
aes.reset(1000);
// start the other CPUs
System.out.println("starting cpus.");
RtThread.startMission();
start = (int) System.currentTimeMillis();
while (!finished) {
;
}
// End of measurement
stop = (int) System.currentTimeMillis();
System.out.println("StartTime: " + start);
System.out.println("StopTime: " + stop);
time = stop - start;
System.out.println("TimeSpent: " + time);
System.out.println("Result = " + aes.sink.ok);
}
use of joprt.RtThread in project jop by jop-devel.
the class AESSPM method main.
public static void main(String[] args) {
AESSPM aes = new AESSPM();
// Initialization for benchmarking
int start = 0;
int stop = 0;
int time = 0;
System.out.println("AES Benchmark with SPM");
int nrCpu = Runtime.getRuntime().availableProcessors();
if (nrCpu < 5) {
throw new Error("Not enogh CPUs");
}
// ni must be translated from proc index to NoC address!
new RtThread(aes.source, 1, 1000).setProcessor(1);
new RtThread(aes.enc, 1, 1000).setProcessor(2);
new RtThread(aes.dec, 1, 1000).setProcessor(3);
new RtThread(aes.sink, 1, 1000).setProcessor(4);
aes.reset(1000);
// start the other CPUs
System.out.println("starting cpus.");
RtThread.startMission();
start = (int) System.currentTimeMillis();
while (!finished) {
;
}
// End of measurement
stop = (int) System.currentTimeMillis();
System.out.println("StartTime: " + start);
System.out.println("StopTime: " + stop);
time = stop - start;
System.out.println("TimeSpent: " + time);
System.out.println("Result = " + aes.sink.ok);
}
Aggregations