--- xinu/sys/ttyputc.c 2018/04/24 17:39:02 1.1.1.1 +++ xinu/sys/ttyputc.c 2018/04/24 17:39:28 1.1.1.2 @@ -2,30 +2,43 @@ #include #include +#include #include #include -#include + +/* set up macros for appropriate SLU as spec. by SLUCHIP: + if SLUCHIP==6850, #include slu6850.h, #define TTYPUTC ttyputc6850, etc. + if SLUCHIP==7201, #include slu7201.h, #define TTYPUTC ttyputc7201, etc. + if SLUCHIP undef.,#include slu.h, #define TTYPUTC ttyputc (orig. case) + similarly sluaccess.h, other TTY fns */ +#include /*------------------------------------------------------------------------ * ttyputc - write one character to a tty device *------------------------------------------------------------------------ */ -ttyputc(devptr, ch ) -struct devsw *devptr; -char ch; +TTYPUTC(devptr,ch) + struct devsw *devptr; + char ch; { - struct tty *iptr; - PStype ps; + register struct tty *ttyp; + register struct csr *cptr; + +#ifdef DEBUG + dotrace("ttyputc", &devptr, 2); +#endif + ttyp = &tty[devptr->dvminor]; + + cptr = (struct csr *)devptr->dvcsr; + if ( ch==NEWLINE && ttyp->ocrlf ) + TTYPUTC(devptr,RETURN); + wait(ttyp->osem); /* wait for space in queue*/ + disable(); + ttyp->obuff[ttyp->ohead++] = ch; + if (ttyp->ohead >= OBUFLEN) + ttyp->ohead = 0; - iptr = &tty[devptr->dvminor]; - if ( ch==NEWLINE && iptr->ocrlf ) - ttyputc(devptr,RETURN); - disable(ps); - wait(iptr->osem); /* wait for space in queue */ - iptr->obuff[iptr->ohead++] = ch; - if (iptr->ohead >= OBUFLEN) - iptr->ohead = 0; - (iptr->ioaddr)->ctstat = SLUENABLE; - restore(ps); + slutenable(cptr); /* enable transmitter ints if disabled */ + restore(); return(OK); }