[BACK]Return to cons.h CVS log [TXT][DIR] Up to [local] / sys / dev

Annotation of sys/dev/cons.h, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: cons.h,v 1.15 2006/01/01 11:59:40 miod Exp $  */
        !             2: /*     $NetBSD: cons.h,v 1.14 1996/03/14 19:08:35 christos Exp $       */
        !             3:
        !             4: /*
        !             5:  * Copyright (c) 1988 University of Utah.
        !             6:  * Copyright (c) 1990, 1993
        !             7:  *     The Regents of the University of California.  All rights reserved.
        !             8:  *
        !             9:  * This code is derived from software contributed to Berkeley by
        !            10:  * the Systems Programming Group of the University of Utah Computer
        !            11:  * Science Department.
        !            12:  *
        !            13:  * Redistribution and use in source and binary forms, with or without
        !            14:  * modification, are permitted provided that the following conditions
        !            15:  * are met:
        !            16:  * 1. Redistributions of source code must retain the above copyright
        !            17:  *    notice, this list of conditions and the following disclaimer.
        !            18:  * 2. Redistributions in binary form must reproduce the above copyright
        !            19:  *    notice, this list of conditions and the following disclaimer in the
        !            20:  *    documentation and/or other materials provided with the distribution.
        !            21:  * 3. Neither the name of the University nor the names of its contributors
        !            22:  *    may be used to endorse or promote products derived from this software
        !            23:  *    without specific prior written permission.
        !            24:  *
        !            25:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
        !            26:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            27:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            28:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
        !            29:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            30:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            31:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            32:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            33:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            34:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            35:  * SUCH DAMAGE.
        !            36:  *
        !            37:  * from: Utah $Hdr: cons.h 1.6 92/01/21$
        !            38:  *
        !            39:  *     @(#)cons.h      8.1 (Berkeley) 6/10/93
        !            40:  */
        !            41:
        !            42: struct consdev {
        !            43:                                /* probe hardware and fill in consdev info */
        !            44:        void    (*cn_probe)(struct consdev *);
        !            45:                                /* turn on as console */
        !            46:        void    (*cn_init)(struct consdev *);
        !            47:                                /* kernel getchar interface */
        !            48:        int     (*cn_getc)(dev_t);
        !            49:                                /* kernel putchar interface */
        !            50:        void    (*cn_putc)(dev_t, int);
        !            51:                                /* turn on and off polling */
        !            52:        void    (*cn_pollc)(dev_t, int);
        !            53:                                /* ring bell */
        !            54:        void    (*cn_bell)(dev_t, u_int, u_int, u_int);
        !            55:        dev_t   cn_dev;         /* major/minor of device */
        !            56:        int     cn_pri;         /* picking order; the higher the better */
        !            57: };
        !            58:
        !            59: /* values for cn_pri - reflect our policy for console selection */
        !            60: #define        CN_DEAD         0       /* device doesn't exist */
        !            61: #define CN_NORMAL      1       /* device exists but is nothing special */
        !            62: #define CN_INTERNAL    2       /* "internal" bit-mapped display */
        !            63: #define CN_REMOTE      3       /* serial interface with remote bit set */
        !            64: #define        CN_FORCED       4
        !            65:
        !            66: /* XXX */
        !            67: #define        CONSMAJOR       0
        !            68:
        !            69: #ifdef _KERNEL
        !            70:
        !            71: extern struct consdev constab[];
        !            72: extern struct consdev *cn_tab;
        !            73:
        !            74: struct knote;
        !            75:
        !            76: void   cninit(void);
        !            77: int    cnset(dev_t);
        !            78: int    cnopen(dev_t, int, int, struct proc *);
        !            79: int    cnclose(dev_t, int, int, struct proc *);
        !            80: int    cnread(dev_t, struct uio *, int);
        !            81: int    cnwrite(dev_t, struct uio *, int);
        !            82: int    cnioctl(dev_t, u_long, caddr_t, int, struct proc *);
        !            83: int    cnpoll(dev_t, int, struct proc *);
        !            84: int    cnkqfilter(dev_t, struct knote *);
        !            85: int    cngetc(void);
        !            86: void   cnputc(int);
        !            87: void   cnpollc(int);
        !            88: void   cnbell(u_int, u_int, u_int);
        !            89: void   cnrint(void);
        !            90: void   nullcnpollc(dev_t, int);
        !            91:
        !            92: /* console-specific types */
        !            93: #define        dev_type_cnprobe(n)     void n(struct consdev *)
        !            94: #define        dev_type_cninit(n)      void n(struct consdev *)
        !            95: #define        dev_type_cngetc(n)      int n(dev_t)
        !            96: #define        dev_type_cnputc(n)      void n(dev_t, int)
        !            97: #define        dev_type_cnpollc(n)     void n(dev_t, int)
        !            98: #define        dev_type_cnbell(n)      void n(dev_t, u_int, u_int, u_int)
        !            99:
        !           100: #define        cons_decl(n) \
        !           101:        dev_decl(n,cnprobe); dev_decl(n,cninit); dev_decl(n,cngetc); \
        !           102:        dev_decl(n,cnputc); dev_decl(n,cnpollc); dev_decl(n,cnbell);
        !           103:
        !           104: #define        cons_init(n) { \
        !           105:        dev_init(1,n,cnprobe), dev_init(1,n,cninit), dev_init(1,n,cngetc), \
        !           106:        dev_init(1,n,cnputc), dev_init(1,n,cnpollc), NULL, \
        !           107:        NODEV, CN_DEAD }
        !           108:
        !           109: #define cons_init_bell(n) { \
        !           110:        dev_init(1,n,cnprobe), dev_init(1,n,cninit), dev_init(1,n,cngetc), \
        !           111:        dev_init(1,n,cnputc), dev_init(1,n,cnpollc), dev_init(1,n,cnbell), \
        !           112:        NODEV, CN_DEAD }
        !           113:
        !           114: #endif

CVSweb