Search in sources :

Example 1 with Tftp

use of ejip.Tftp 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();
}
Also used : Tftp(ejip.Tftp) Ejip(ejip.Ejip) CS8900(ejip.CS8900) Serial(util.Serial) HtmlBaseio(ejip.HtmlBaseio) RtThread(joprt.RtThread) Net(ejip.Net)

Aggregations

CS8900 (ejip.CS8900)1 Ejip (ejip.Ejip)1 HtmlBaseio (ejip.HtmlBaseio)1 Net (ejip.Net)1 Tftp (ejip.Tftp)1 RtThread (joprt.RtThread)1 Serial (util.Serial)1