Search in sources :

Example 1 with HtmlBaseio

use of ejip.HtmlBaseio in project jop by jop-devel.

the class Lift 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);
    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); 
        new RtThread(5, 10000) {

            public void run() {
                for (; ; ) {
                    waitForNextPeriod();
                    net.run();
                    ipLink.run();
                }
            }
        };
    }
    /* there is some problem with the ACEX board and paramter in Flash ???
 
 
		par = new Param();
		fwp = new Fwp();
		Serial ser;
		if (simpc) {
			ser = new Serial(Const.IO_UART_BG_MODEM_BASE, 10, 3000);
		} else {
			ser = new Serial(Const.IO_UART1_BASE, 10, 3000);
		}
		if (evn) {
			modem = Modem.getInstance(5, 100000, ser);
		} else {
			new Modbus(5, 10000, ser, outReg);
		}
		
		loop = new Loop(7, 20000);
*/
    ctrl = new LiftControl();
    RtThread.startMission();
    forever();
}
Also used : CS8900(ejip.CS8900) HtmlBaseio(ejip.HtmlBaseio) RtThread(joprt.RtThread) Ejip(ejip.Ejip) Net(ejip.Net)

Example 2 with HtmlBaseio

use of ejip.HtmlBaseio 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)2 Ejip (ejip.Ejip)2 HtmlBaseio (ejip.HtmlBaseio)2 Net (ejip.Net)2 RtThread (joprt.RtThread)2 Tftp (ejip.Tftp)1 Serial (util.Serial)1