Annotation of xinu/sys/ttyinit.c, revision 1.1.1.2

1.1       root        1: /* ttyinit.c - ttyinit */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <tty.h>
                      6: #include <io.h>
1.1.1.2 ! root        7: 
        !             8: /* set up macros for appropriate SLU as spec. by SLUCHIP:
        !             9:    if SLUCHIP==6850, #include slu6850.h, #define TTYINIT ttyinit6850, etc.
        !            10:    if SLUCHIP==7201, #include slu7201.h, #define TTYINIT ttyinit7201, etc.
        !            11:    if SLUCHIP undef.,#include slu.h, #define TTYINIT ttyinit  (orig. case)
        !            12:    similarly sluaccess.h, other TTY fns */
        !            13: #include <sluinclude.h>
1.1       root       14: 
                     15: /*------------------------------------------------------------------------
                     16:  *  ttyinit - initialize buffers and modes for a tty line
1.1.1.2 ! root       17:  *  (if SLUCHIP is nontrivial, this defines ttyinit6850 or ttyinit7201)
1.1       root       18:  *------------------------------------------------------------------------
                     19:  */
1.1.1.2 ! root       20: TTYINIT(devptr)
1.1       root       21:        struct  devsw   *devptr;
                     22: {
1.1.1.2 ! root       23:        register struct tty *ttyp;
        !            24:        struct csr *cptr;
        !            25:        int     junk, isconsole;
        !            26: 
        !            27: #ifdef debug
        !            28:        dotrace("ttyinit", &devptr, 1);
        !            29: #endif
1.1       root       30: 
1.1.1.2 ! root       31:        ttyp = &tty[devptr->dvminor];
1.1       root       32: 
1.1.1.2 ! root       33: /*     iosetvec(devptr->dvnum, ttyp, ttyp); */
        !            34: /* The "map" trick for interrupt dispatching doesn't work for 68000 */
        !            35: /* so iosetvec is obsolete--simpler but device-dependent method is used */
        !            36: /* here we just write the interrupt vector(s) in low memory--
        !            37:      (for 6850 and 7201, both of these do the same thing)  */
        !            38:        *(int *)(devptr->dvivec) = (int)devptr->dviint;/* set up int. vec(s)*/
        !            39:        *(int *)(devptr->dvovec) = (int)devptr->dvoint;
1.1       root       40: 
1.1.1.2 ! root       41:        devptr->dvioblk = (char *) ttyp;        /* fill tty control blk */
1.1       root       42:        isconsole = (devptr->dvnum == CONSOLE); /* make console cooked  */
1.1.1.2 ! root       43:        ttyp->ioaddr = (struct csr *)devptr->dvcsr; /* copy csr address */
        !            44:        ttyp->ihead = ttyp->itail = 0;          /* empty input queue    */
        !            45:        ttyp->isem = screate(0);                /* chars. read so far=0 */
        !            46:        ttyp->osem = screate(OBUFLEN);          /* buffer available=all */
        !            47:        ttyp->odsend = 0;                       /* sends delayed so far */
        !            48:        ttyp->ohead = ttyp->otail = 0;          /* output queue empty   */
        !            49:        ttyp->ehead = ttyp->etail = 0;          /* echo queue empty     */
        !            50:        ttyp->imode = (isconsole ? IMCOOKED : IMRAW);
        !            51:        ttyp->iecho = ttyp->evis = isconsole;   /* echo console input   */
        !            52:        ttyp->ierase = ttyp->ieback = isconsole;/* console honors erase */
        !            53:        ttyp->ierasec = BACKSP;                 /*  using ^h            */
        !            54:        ttyp->ecrlf = ttyp->icrlf = isconsole;  /* map RETURN on input  */
        !            55:        ttyp->ocrlf = ttyp->oflow = isconsole;
        !            56:        ttyp->ikill = isconsole;                /* set line kill == @   */
        !            57:        ttyp->ikillc = ATSIGN;
        !            58:        ttyp->oheld = FALSE;
        !            59:        ttyp->ostart = STRTCH;
        !            60:        ttyp->ostop = STOPCH;
        !            61:        ttyp->icursor = 0;
        !            62:        ttyp->ifullc = TFULLC;
        !            63: 
        !            64:        cptr = (struct csr *)devptr->dvcsr;     /* CSR of this SLU      */
        !            65:        sluinitcsr(cptr);                       /* set dataformat, etc. */
        !            66:        junk = slugetch(cptr);                  /* Clear receiver       */
        !            67:        slutdisable(cptr);                      /* Disable trans. ints  */
        !            68:        slurenable(cptr);                       /* Enable receiver ints */
1.1       root       69: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.