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

1.1       root        1: /* ttyputc.c - ttyputc */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
1.1.1.2 ! root        5: #include <proc.h>
1.1       root        6: #include <tty.h>
                      7: #include <io.h>
1.1.1.2 ! root        8: 
        !             9: /* set up macros for appropriate SLU as spec. by SLUCHIP:
        !            10:    if SLUCHIP==6850, #include slu6850.h, #define TTYPUTC ttyputc6850, etc.
        !            11:    if SLUCHIP==7201, #include slu7201.h, #define TTYPUTC ttyputc7201, etc.
        !            12:    if SLUCHIP undef.,#include slu.h, #define TTYPUTC ttyputc  (orig. case)
        !            13:    similarly sluaccess.h, other TTY fns */
        !            14: #include <sluinclude.h>
1.1       root       15: 
                     16: /*------------------------------------------------------------------------
                     17:  *  ttyputc - write one character to a tty device
                     18:  *------------------------------------------------------------------------
                     19:  */
1.1.1.2 ! root       20: TTYPUTC(devptr,ch)
        !            21:        struct  devsw   *devptr;
        !            22:        char    ch;
1.1       root       23: {
1.1.1.2 ! root       24:        register struct tty     *ttyp;
        !            25:        register struct csr     *cptr;
        !            26: 
        !            27: #ifdef DEBUG
        !            28:        dotrace("ttyputc", &devptr, 2);
        !            29: #endif
        !            30:        ttyp = &tty[devptr->dvminor];
        !            31: 
        !            32:        cptr = (struct csr *)devptr->dvcsr;
        !            33:         if ( ch==NEWLINE && ttyp->ocrlf )
        !            34:          TTYPUTC(devptr,RETURN);
        !            35:        wait(ttyp->osem);                       /* wait for space in queue*/
        !            36:        disable();
        !            37:        ttyp->obuff[ttyp->ohead++] = ch;
        !            38:        if (ttyp->ohead >= OBUFLEN)
        !            39:                ttyp->ohead = 0;
1.1       root       40: 
1.1.1.2 ! root       41:        slutenable(cptr); /* enable transmitter ints if disabled */
        !            42:        restore();
1.1       root       43:        return(OK);
                     44: }

unix.superglobalmegacorp.com

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