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 /*      $NetBSD: cons.h,v 1.26 2007/01/13 18:39:35 cube Exp $   */
    2 
    3 /*
    4  * Copyright (c) 1990, 1993
    5  *      The Regents of the University of California.  All rights reserved.
    6  *
    7  * This code is derived from software contributed to Berkeley by
    8  * the Systems Programming Group of the University of Utah Computer
    9  * Science Department.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions and the following disclaimer.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  * 3. Neither the name of the University nor the names of its contributors
   20  *    may be used to endorse or promote products derived from this software
   21  *    without specific prior written permission.
   22  *
   23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   33  * SUCH DAMAGE.
   34  *
   35  * from: Utah $Hdr: cons.h 1.6 92/01/21$
   36  *
   37  *      @(#)cons.h      8.1 (Berkeley) 6/10/93
   38  */
   39 
   40 /*
   41  * Copyright (c) 1988 University of Utah.
   42  *
   43  * This code is derived from software contributed to Berkeley by
   44  * the Systems Programming Group of the University of Utah Computer
   45  * Science Department.
   46  *
   47  * Redistribution and use in source and binary forms, with or without
   48  * modification, are permitted provided that the following conditions
   49  * are met:
   50  * 1. Redistributions of source code must retain the above copyright
   51  *    notice, this list of conditions and the following disclaimer.
   52  * 2. Redistributions in binary form must reproduce the above copyright
   53  *    notice, this list of conditions and the following disclaimer in the
   54  *    documentation and/or other materials provided with the distribution.
   55  * 3. All advertising materials mentioning features or use of this software
   56  *    must display the following acknowledgement:
   57  *      This product includes software developed by the University of
   58  *      California, Berkeley and its contributors.
   59  * 4. Neither the name of the University nor the names of its contributors
   60  *    may be used to endorse or promote products derived from this software
   61  *    without specific prior written permission.
   62  *
   63  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   64  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   65  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   66  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   67  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   68  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   69  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   70  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   71  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   72  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   73  * SUCH DAMAGE.
   74  *
   75  * from: Utah $Hdr: cons.h 1.6 92/01/21$
   76  *
   77  *      @(#)cons.h      8.1 (Berkeley) 6/10/93
   78  */
   79 
   80 #ifndef _SYS_DEV_CONS_H_
   81 #define _SYS_DEV_CONS_H_
   82 
   83 struct consdev {
   84         void    (*cn_probe)     /* probe hardware and fill in consdev info */
   85                    (struct consdev *);
   86         void    (*cn_init)      /* turn on as console */
   87                    (struct consdev *);
   88         int     (*cn_getc)      /* kernel getchar interface */
   89                    (dev_t);
   90         void    (*cn_putc)      /* kernel putchar interface */
   91                    (dev_t, int);
   92         void    (*cn_pollc)     /* turn on and off polling */
   93                    (dev_t, int);
   94         void    (*cn_bell)      /* ring bell */
   95                    (dev_t, u_int, u_int, u_int);
   96         void    (*cn_halt)      /* stop device */
   97                    (dev_t);
   98         void    (*cn_flush)     /* flush output */
   99                    (dev_t);
  100         dev_t   cn_dev;         /* major/minor of device */
  101         int     cn_pri;         /* pecking order; the higher the better */
  102 };
  103 
  104 /* values for cn_pri - reflect our policy for console selection */
  105 #define CN_DEAD         0       /* device doesn't exist */
  106 #define CN_NULL         1       /* noop console */
  107 #define CN_NORMAL       2       /* device exists but is nothing special */
  108 #define CN_INTERNAL     3       /* "internal" bit-mapped display */
  109 #define CN_REMOTE       4       /* serial interface with remote bit set */
  110 
  111 #ifdef _KERNEL
  112 
  113 extern  struct consdev constab[];
  114 extern  struct consdev *cn_tab;
  115 
  116 void    cninit(void);
  117 int     cngetc(void);
  118 int     cngetsn(char *, int);
  119 void    cnputc(int);
  120 void    cnpollc(int);
  121 void    cnbell(u_int, u_int, u_int);
  122 void    cnflush(void);
  123 void    cnhalt(void);
  124 void    cnrint(void);
  125 void    nullcnprobe(struct consdev *);
  126 void    nullcninit(struct consdev *);
  127 void    nullcnpollc(dev_t, int);
  128 void    nullconsattach(int);
  129 
  130 /* console-specific types */
  131 #define dev_type_cnprobe(n)     void n(struct consdev *)
  132 #define dev_type_cninit(n)      void n(struct consdev *)
  133 #define dev_type_cngetc(n)      int n(dev_t)
  134 #define dev_type_cnputc(n)      void n(dev_t, int)
  135 #define dev_type_cnpollc(n)     void n(dev_t, int)
  136 #define dev_type_cnbell(n)      void n(dev_t, u_int, u_int, u_int)
  137 #define dev_type_cnhalt(n)      void n(dev_t)
  138 #define dev_type_cnflush(n)     void n(dev_t)
  139 
  140 #define dev_decl(n,t)           __CONCAT(dev_type_,t)(__CONCAT(n,t))
  141 #define dev_init(n,t)           __CONCAT(n,t)
  142 
  143 #define cons_decl(n) \
  144         dev_decl(n,cnprobe); dev_decl(n,cninit); dev_decl(n,cngetc); \
  145         dev_decl(n,cnputc); dev_decl(n,cnpollc); dev_decl(n,cnbell); \
  146         dev_decl(n,cnflush); dev_decl(n,cnhalt);
  147 
  148 #define cons_init(n) { \
  149         dev_init(n,cnprobe), dev_init(n,cninit), dev_init(n,cngetc), \
  150         dev_init(n,cnputc), dev_init(n,cnpollc), NULL, NULL, NULL, \
  151         0, 0 }
  152 
  153 #define cons_init_bell(n) { \
  154         dev_init(n,cnprobe), dev_init(n,cninit), dev_init(n,cngetc), \
  155         dev_init(n,cnputc), dev_init(n,cnpollc), dev_init(n,cnbell) }
  156 
  157 #define cons_init_halt(n) { \
  158         dev_init(n,cnprobe), dev_init(n,cninit), dev_init(n,cngetc), \
  159         dev_init(n,cnputc), dev_init(n,cnpollc), 0,                  \
  160         dev_init(n,cnhalt) }
  161 
  162 #endif
  163 
  164 #endif /* _SYS_DEV_CONS_H_ */

Cache object: fae3ae2b52f38ac461e434b5e85cea6b


[ 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.