Search in sources :

Example 6 with Serial

use of util.Serial in project jop by jop-devel.

the class SerialTest method main.

public static void main(String[] args) {
    new RtThread(9, 10000) {

        private Serial ser = new Serial(10, 400, Const.IO_UART1_BASE);

        private int err = 0;

        private int loop = 0;

        public void run() {
            while (true) {
                waitForNextPeriod();
                int rxCnt = ser.rxCnt();
                for (int i = 0; i < rxCnt; i++) {
                    if (ser.txFreeCnt() <= 0) {
                        err++;
                    } else
                        ser.wr(ser.rd());
                }
            }
        }
    };
    RtThread.startMission();
    while (true) {
    }
}
Also used : Serial(ejip123.util.Serial) RtThread(joprt.RtThread)

Example 7 with Serial

use of util.Serial in project jop by jop-devel.

the class MainPppLoop method main.

/**
*	Start network and enter forever loop.
*/
public static void main(String[] args) {
    Dbg.initSerWait();
    //
    //	initialize TCP/IP
    //
    //net = Ip.init();
    ser = new Serial(IPSER_PRIO, IPSER_PERIOD, Const.IO_UART_BG_MODEM_BASE);
    //
    //	Create serial and PPP
    //
    ipLink = Ppp.init(IPLINK_PRIO, IPLINK_PERIOD, ser);
    new RtThread(20, 100000) {

        public void run() {
            int i = 0;
            for (; ; ) {
                waitForNextPeriod();
                //					Ip.loop();
                ++i;
                if (i == 10) {
                    Timer.wd();
                    System.out.print('*');
                    i = 0;
                }
                Timer.loop();
            }
        }
    };
    /*FIXME 		ipLink.startConnection(new StringBuffer("*99***1#"),
				new StringBuffer("A1.net"),
				new StringBuffer("ppp@A1plus.at"),
				new StringBuffer("ppp"));
*/
    RtThread.startMission();
    //		forever();
    for (; ; ) {
        int t = Timer.getTimeoutMs(800);
        while (!Timer.timeout(t)) {
            RtThread.sleepMs(10);
        }
        System.out.print("M");
    }
}
Also used : Serial(ejip123.util.Serial) RtThread(joprt.RtThread)

Example 8 with Serial

use of 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 = Net.init();
    // don't use CS8900 when simulating on PC or for BG263
    // LinkLayer ipLink = CS8900.init(Net.eth, Net.ip);
    // don't use PPP on my web server
    // Ppp.init(Const.IO_UART_BG_MODEM_BASE); 
    ser = new Serial(Const.IO_UART1_BASE);
    ipLink = Slip.init(ser, (192 << 24) + (168 << 16) + (1 << 8) + 2);
    forever();
}
Also used : Serial(util.Serial)

Example 9 with Serial

use of util.Serial in project jop by jop-devel.

the class MainSlipUart2 method main.

/**
*	Start network and enter forever loop.
*/
public static void main(String[] args) {
    Dbg.initSerWait();
    //
    //	start TCP/IP and all (four) threads
    //
    net = Net.init();
    // don't use CS8900 when simulating on PC or for BG263
    // LinkLayer ipLink = CS8900.init(Net.eth, Net.ip);
    // don't use PPP on my web server
    // Ppp.init(Const.IO_UART_BG_MODEM_BASE); 
    //
    //	use second serial line for simulation
    //	with JopSim
    //
    ser = new Serial(Const.IO_UART_BG_MODEM_BASE);
    ipLink = Slip.init(ser, (192 << 24) + (168 << 16) + (1 << 8) + 2);
    //
    //	start device driver threads
    //
    new RtThread(5, 10000) {

        public void run() {
            for (; ; ) {
                waitForNextPeriod();
                net.loop();
            }
        }
    };
    // Slip timeout (for windoz slip reply) depends on
    // period (=100*period) !
    new RtThread(9, 10000) {

        public void run() {
            for (; ; ) {
                waitForNextPeriod();
                ipLink.loop();
            }
        }
    };
    new RtThread(10, 10000) {

        public void run() {
            for (; ; ) {
                waitForNextPeriod();
                ser.loop();
            }
        }
    };
    //
    //	WD thread has lowest priority to see if every timing will be met
    //
    RtThread.startMission();
    forever();
}
Also used : Serial(util.Serial) RtThread(joprt.RtThread)

Example 10 with Serial

use of util.Serial in project jop by jop-devel.

the class MainSlip 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(10, 3000, Const.IO_UART1_BASE);
    ipLink = Slip.init(9, 10000, ser, (192 << 24) + (168 << 16) + (1 << 8) + 2, 1500);
    //
    //	start device driver threads
    //
    new RtThread(5, 10000) {

        public void run() {
            for (; ; ) {
                waitForNextPeriod();
            //					Ip.loop();
            }
        }
    };
    //
    //	WD thread has lowest priority to see if every timing will be met
    //
    RtThread.startMission();
    forever();
}
Also used : Serial(ejip123.util.Serial) RtThread(joprt.RtThread)

Aggregations

Serial (util.Serial)11 RtThread (joprt.RtThread)10 Serial (ejip123.util.Serial)9 CS8900 (ejip.CS8900)2 Ejip (ejip.Ejip)2 Net (ejip.Net)2 HtmlBaseio (ejip.HtmlBaseio)1 Tftp (ejip.Tftp)1