--- Gnu-Mach/device/chario.c 2020/09/02 04:41:25 1.1.1.2 +++ Gnu-Mach/device/chario.c 2020/09/02 04:45:32 1.1.1.4 @@ -43,21 +43,24 @@ #include #include +#include #include #include #include -#include "device_reply.h" +#include #include /* If you change these, check that tty_outq_size and tty_inq_size * is greater than largest tthiwat entry. */ -short tthiwat[16] = - { 100,100,100,100,100,100,100,200,200,400,400,400,650,650,1300,2000 }; -short ttlowat[16] = - { 30, 30, 30, 30, 30, 30, 30, 50, 50,120,120,120,125,125, 125, 125 }; +short tthiwat[NSPEEDS] = + { 100,100,100,100,100,100,100,200,200,400,400,400,650,650,1300,2000, + 2000,2000 }; +short ttlowat[NSPEEDS] = + { 30, 30, 30, 30, 30, 30, 30, 50, 50,120,120,120,125,125, 125, 125, + 125,125 }; /* * forward declarations @@ -65,11 +68,9 @@ short ttlowat[16] = void queue_delayed_reply( queue_t, io_req_t, boolean_t (*)(io_req_t)); void tty_output(struct tty *); -void tty_flush(struct tty *, int); boolean_t char_open_done(io_req_t); boolean_t char_read_done(io_req_t); boolean_t char_write_done(io_req_t); -void ttstart(struct tty *tp); /* * Fake 'line discipline' switch for the benefit of old code @@ -88,8 +89,8 @@ struct ldisc_switch linesw[] = { /* * Sizes for input and output circular buffers. */ -int tty_inq_size = 4096; /* big nuf */ -int tty_outq_size = 2048; /* Must be bigger that tthiwat */ +const int tty_inq_size = 4096; /* big nuf */ +const int tty_outq_size = 2048; /* Must be bigger that tthiwat */ int pdma_default = 1; /* turn pseudo dma on by default */ /* @@ -122,6 +123,8 @@ void chario_init(void) pdma_timeouts[B9600] = _PR(960); pdma_timeouts[EXTA] = _PR(1440); /* >14400 baud */ pdma_timeouts[EXTB] = _PR(1920); /* >19200 baud */ + pdma_timeouts[B57600] = _PR(5760); + pdma_timeouts[B115200] = _PR(11520); for (i = B0; i < B300; i++) pdma_water_mark[i] = 0; @@ -143,6 +146,8 @@ void chario_init(void) pdma_water_mark[B9600] = i; pdma_water_mark[EXTA] = i; /* >14400 baud */ pdma_water_mark[EXTB] = i; /* >19200 baud */ + pdma_water_mark[B57600] = i; + pdma_water_mark[B115200] = i; return; } @@ -209,7 +214,7 @@ out: boolean_t char_open_done( io_req_t ior) { - register struct tty *tp = (struct tty *)ior->io_dev_ptr; + struct tty *tp = (struct tty *)ior->io_dev_ptr; spl_t s = spltty(); simple_lock(&tp->t_lock); @@ -249,12 +254,12 @@ boolean_t tty_close_open_reply( * device needs to run on master. */ io_return_t char_write( - register struct tty * tp, - register io_req_t ior) + struct tty * tp, + io_req_t ior) { spl_t s; - register int count; - register char *data; + int count; + char *data; vm_offset_t addr; io_return_t rc = D_SUCCESS; @@ -340,10 +345,10 @@ out: * May run on any CPU. */ boolean_t char_write_done( - register io_req_t ior) + io_req_t ior) { - register struct tty *tp = (struct tty *)ior->io_dev_ptr; - register spl_t s = spltty(); + struct tty *tp = (struct tty *)ior->io_dev_ptr; + spl_t s = spltty(); simple_lock(&tp->t_lock); if (tp->t_outq.c_cc > TTHIWAT(tp) || @@ -371,7 +376,7 @@ boolean_t char_write_done( } boolean_t tty_close_write_reply( - register io_req_t ior) + io_req_t ior) { ior->io_residual = ior->io_count; ior->io_error = D_DEVICE_DOWN; @@ -385,8 +390,8 @@ boolean_t tty_close_write_reply( * May run on any CPU - does not talk to device driver. */ io_return_t char_read( - register struct tty *tp, - register io_req_t ior) + struct tty *tp, + io_req_t ior) { spl_t s; kern_return_t rc; @@ -446,10 +451,10 @@ io_return_t char_read( * May run on any CPU - does not talk to device driver. */ boolean_t char_read_done( - register io_req_t ior) + io_req_t ior) { - register struct tty *tp = (struct tty *)ior->io_dev_ptr; - register spl_t s = spltty(); + struct tty *tp = (struct tty *)ior->io_dev_ptr; + spl_t s = spltty(); simple_lock(&tp->t_lock); @@ -478,7 +483,7 @@ boolean_t char_read_done( } boolean_t tty_close_read_reply( - register io_req_t ior) + io_req_t ior) { ior->io_residual = ior->io_count; ior->io_error = D_DEVICE_DOWN; @@ -492,9 +497,9 @@ boolean_t tty_close_read_reply( * Iff modem control should run on master. */ void ttyclose( - register struct tty *tp) + struct tty *tp) { - register io_req_t ior; + io_req_t ior; /* * Flush the read and write queues. Signal @@ -534,7 +539,7 @@ tty_queue_clean( ipc_port_t port, boolean_t (*routine)(io_req_t) ) { - register io_req_t ior; + io_req_t ior; ior = (io_req_t)queue_first(q); while (!queue_end(q, (queue_entry_t)ior)) { @@ -559,8 +564,8 @@ tty_portdeath( struct tty * tp, ipc_port_t port) { - register spl_t spl = spltty(); - register boolean_t result; + spl_t spl = spltty(); + boolean_t result; simple_lock(&tp->t_lock); @@ -591,7 +596,7 @@ tty_portdeath( * May run on any CPU. */ io_return_t tty_get_status( - register struct tty *tp, + struct tty *tp, dev_flavor_t flavor, int * data, /* pointer to OUT array */ natural_t *count) /* out */ @@ -601,7 +606,7 @@ io_return_t tty_get_status( switch (flavor) { case TTY_STATUS: { - register struct tty_status *tsp = + struct tty_status *tsp = (struct tty_status *) data; if (*count < TTY_STATUS_COUNT) @@ -637,7 +642,7 @@ io_return_t tty_get_status( * device needs to run on master. */ io_return_t tty_set_status( - register struct tty *tp, + struct tty *tp, dev_flavor_t flavor, int * data, natural_t count) @@ -647,7 +652,7 @@ io_return_t tty_set_status( switch (flavor) { case TTY_FLUSH: { - register int flags; + int flags; if (count < TTY_FLUSH_COUNT) return D_INVALID_OPERATION; @@ -690,7 +695,7 @@ io_return_t tty_set_status( case TTY_STATUS: /* set special characters and speed */ { - register struct tty_status *tsp; + struct tty_status *tsp; if (count < TTY_STATUS_COUNT) return D_INVALID_OPERATION; @@ -745,9 +750,9 @@ void queue_delayed_reply( * TTY containing queue must be locked (at spltty). */ void tty_queue_completion( - register queue_t qh) + queue_t qh) { - register io_req_t ior; + io_req_t ior; while ((ior = (io_req_t)dequeue_head(qh)) != 0) { iodone(ior); @@ -760,7 +765,7 @@ void tty_queue_completion( * we can initialize the queues here. */ void ttychars( - register struct tty *tp) + struct tty *tp) { if ((tp->t_flags & TS_INIT) == 0) { /* @@ -797,7 +802,7 @@ void ttychars( * device needs to run on master. */ void tty_flush( - register struct tty *tp, + struct tty *tp, int rw) { if (rw & D_READ) { @@ -820,9 +825,9 @@ void tty_flush( * What if device runs on a different CPU? */ void ttrstrt( - register struct tty *tp) + struct tty *tp) { - register spl_t s; + spl_t s; s = spltty(); simple_lock(&tp->t_lock); @@ -844,7 +849,7 @@ void ttrstrt( * Must be on master CPU if device runs on master. */ void ttstart(tp) - register struct tty *tp; + struct tty *tp; { if ((tp->t_state & (TS_TIMEOUT|TS_TTSTOP|TS_BUSY)) == 0) { /* @@ -868,7 +873,7 @@ void ttstart(tp) * Must be on master CPU if device runs on master. */ void tty_output( - register struct tty *tp) + struct tty *tp) { if ((tp->t_state & (TS_TIMEOUT|TS_TTSTOP|TS_BUSY)) == 0) { /* @@ -888,10 +893,11 @@ void tty_output( * Send any buffered recvd chars up to user */ void ttypush( - register struct tty *tp) + void * _tp) { + struct tty *tp = _tp; spl_t s = spltty(); - register int state; + int state; simple_lock(&tp->t_lock); @@ -977,7 +983,7 @@ void ttyinput( * into the future, but this involves making a timeout/untimeout * call on every character. */ - register int ptime = pdma_timeouts[tp->t_ispeed]; + int ptime = pdma_timeouts[tp->t_ispeed]; if (ptime > 0) { if ((tp->t_state & TS_MIN_TO) == 0) @@ -1000,7 +1006,7 @@ void ttyinput( */ void ttyinput_many( struct tty *tp, - unsigned char *chars, + char *chars, int count) { /* @@ -1074,6 +1080,7 @@ boolean_t ttymodem( * * Tty must be locked and on master. */ +void tty_cts( struct tty * tp, boolean_t cts_up)