The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/cons.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $OpenBSD: cons.h,v 1.19 2022/07/02 08:50:41 visa 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         u_int   cn_pri;         /* picking order; the higher the better */
   57 };
   58 
   59 /* Values for cn_pri - policy for console selection. */
   60 #define CN_DEAD         0       /* Device does not exist. */
   61 #define CN_LOWPRI       1       /* Device exists and is low priority. */
   62 #define CN_MIDPRI       2       /* Device exists and is medium priority. */
   63 #define CN_HIGHPRI      3       /* Device exists and is high priority. */
   64 #define CN_FORCED       4       /* Use this device. */
   65 
   66 /* XXX */
   67 #define CONSMAJOR       0
   68 
   69 #ifdef _KERNEL
   70 
   71 extern  struct consdev constab[];
   72 extern  struct consdev *cn_tab;
   73 extern  struct tty *constty;
   74 extern  struct vnode *cn_devvp;
   75 
   76 struct knote;
   77 
   78 void    cninit(void);
   79 int     cnopen(dev_t, int, int, struct proc *);
   80 int     cnclose(dev_t, int, int, struct proc *);
   81 int     cnread(dev_t, struct uio *, int);
   82 int     cnwrite(dev_t, struct uio *, int);
   83 int     cnioctl(dev_t, u_long, caddr_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

Cache object: d1bc6c565ae5dd5190f64ce11ca6da92


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.