use of ejip123.util.Serial in project jop by jop-devel.
the class HelloWorldHereIPing method main.
public static void main(String[] args) {
// inits 10 packet buffers with 1500B each
PacketPool.init(10, 1500);
Serial ser;
if (TWO_SERIAL) {
// serial debug output
Dbg.initSer();
// simulator
ser = new Serial(10, 1000, Const.IO_UART_BG_MODEM_BASE);
} else {
// sends debug output over the network to 192.168.2.1:10000 (see init method)
DbgUdp.init();
// one byte every ~400us at 19200 baud
ser = new Serial(10, 1000, Const.IO_UART1_BASE);
}
// initializes a routing table with 3 routes
Router.init(3);
LinkLayer slip = Slip.init(9, 10000, ser, Ip.Ip(192, 168, 1, 2), 1500);
// ip (and therefore icmp and tcp) loop thread: period 50ms
Ip.init(6, 50000);
Router.addRoute(new Route(Ip.Ip(192, 168, 2, 0), Ip.Ip(255, 255, 255, 0), slip));
// where should packets go which are not matched by a route?
Router.setDefaultInterface(slip);
RtThread.startMission();
Router.print();
forever();
}
use of ejip123.util.Serial in project jop by jop-devel.
the class TcpClientTest method main.
public static void main(String[] args) throws InterruptedException {
PacketPool.init(10, 1500);
DbgUdp.init();
// Serial ser = new Serial(10, 1000, Const.IO_UART_BG_MODEM_BASE); // simulator
Serial ser = new Serial(10, 1000, Const.IO_UART1_BASE);
LinkLayer slip = Slip.init(9, 1000, ser, Ip.Ip(192, 168, 2, 2), 1500);
Ip.init(5, 1000);
Router.init(3);
Router.addRoute(new Route(Ip.Ip(192, 168, 2, 0), Ip.Ip(255, 255, 255, 0), slip));
Router.setDefaultInterface(slip);
Tcp.init(1, 4);
th = new TcpTestHandler();
RtThread.startMission();
Router.print();
forever();
}
use of ejip123.util.Serial in project jop by jop-devel.
the class TelnetStreamd method main.
public static void main(String[] args) {
PacketPool.init(8, 1500);
// Dbg.initSerWait();
DbgUdp.init();
Router.init(3);
// Serial ser = new Serial(10, 1000, Const.IO_UART_BG_MODEM_BASE); // simulator
Serial ser = new Serial(10, 1000, Const.IO_UART1_BASE);
LinkLayer slip = Slip.init(9, 1000, ser, Ip.Ip(192, 168, 2, 2), 1500);
Ip.init(5, 5000);
Router.addRoute(new Route(Ip.Ip(192, 168, 2, 0), Ip.Ip(255, 255, 255, 0), slip));
Router.setDefaultInterface(slip);
Tcp.init(3, 4);
TelnetStreamd th = new TelnetStreamd();
th.con = new TcpStreamConnection(5, 1000);
Tcp.addHandler(23, th.con);
RtThread.startMission();
Router.print();
th.forever();
}
use of ejip123.util.Serial in project jop by jop-devel.
the class Telnetd method main.
//private final Object this = new Object();
public static void main(String[] args) {
PacketPool.init(10, 1500);
// Dbg.initSerWait(); // serial debug output
// sends debug output over the network to 192.168.2.1:10000 (see init method)
DbgUdp.init();
// initializes a routing table with 3 routes
Router.init(3);
// Serial ser = new Serial(10, 1000, Const.IO_UART_BG_MODEM_BASE); // simulator
// one byte every ~400us at 19200 baud
Serial ser = new Serial(10, 1000, Const.IO_UART1_BASE);
LinkLayer slip = Slip.init(9, 10000, ser, Ip.Ip(192, 168, 2, 2), 1500);
// ip (and therefore icmp and tcp) loop thread: period 50ms
Ip.init(6, 50000);
Router.addRoute(new Route(Ip.Ip(192, 168, 2, 0), Ip.Ip(255, 255, 255, 0), slip));
// where should packets go which are not matched by a route?
Router.setDefaultInterface(slip);
// inits tcp with slots for 3 handlers and 4 connections
Tcp.init(3, 4);
Telnetd th = new Telnetd();
Tcp.addHandler(23, th);
RtThread.startMission();
// like route print on windows or ip addr on linux
Router.print();
th.forever();
}
use of ejip123.util.Serial in project jop by jop-devel.
the class MainSlipLoop method main.
/**
* Start network and enter forever loop.
*/
public static void main(String[] args) {
Dbg.init();
//
// start TCP/IP and all (four) threads
//
//net = Ip.init();
// don't use CS8900 when simulating on PC or for BG263
// LinkLayer ipLink = CS8900.init(Ip.eth, Ip.ip);
// don't use PPP on my web server
// Ppp.init(Const.IO_UART_BG_MODEM_BASE);
ser = new Serial(5, 10000, Const.IO_UART1_BASE);
ipLink = Slip.init(5, 10000, ser, (192 << 24) + (168 << 16) + (1 << 8) + 2, 1500);
Ip.init(5, 10000);
forever();
}