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/uart/uart_cpu.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 /*-
    2  * Copyright (c) 2003, 2004 Marcel Moolenaar
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  *
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   25  *
   26  * $FreeBSD$
   27  */
   28 
   29 #ifndef _DEV_UART_CPU_H_
   30 #define _DEV_UART_CPU_H_
   31 
   32 /*
   33  * Low-level operations for use by console and/or debug port support.
   34  */
   35 struct uart_ops {
   36         int (*probe)(struct uart_bas *);
   37         void (*init)(struct uart_bas *, int, int, int, int);
   38         void (*term)(struct uart_bas *);
   39         void (*putc)(struct uart_bas *, int);
   40         int (*poll)(struct uart_bas *);
   41         int (*getc)(struct uart_bas *);
   42 };
   43 
   44 extern struct uart_ops uart_i8251_ops;
   45 extern struct uart_ops uart_ns8250_ops;
   46 extern struct uart_ops uart_sab82532_ops;
   47 extern struct uart_ops uart_z8530_ops;
   48 
   49 extern bus_space_tag_t uart_bus_space_io;
   50 extern bus_space_tag_t uart_bus_space_mem;
   51 
   52 /*
   53  * Console and debug port device info.
   54  */
   55 struct uart_softc;
   56 struct uart_devinfo {
   57         SLIST_ENTRY(uart_devinfo) next;
   58         struct uart_ops ops;
   59         struct uart_bas bas;
   60         int     baudrate;
   61         int     databits;
   62         int     stopbits;
   63         int     parity;
   64         int     type;
   65 #define UART_DEV_CONSOLE        0
   66 #define UART_DEV_DBGPORT        1
   67 #define UART_DEV_KEYBOARD       2
   68         int     (*attach)(struct uart_softc*);
   69         int     (*detach)(struct uart_softc*);
   70         void    *cookie;                /* Type dependent use. */
   71 };
   72 
   73 int uart_cpu_eqres(struct uart_bas *, struct uart_bas *);
   74 int uart_cpu_getdev(int, struct uart_devinfo *);
   75 int uart_getenv(int, struct uart_devinfo *);
   76 
   77 void uart_add_sysdev(struct uart_devinfo *);
   78 void uart_cpu_identify(driver_t *, device_t);
   79 
   80 /*
   81  * Operations for low-level access to the UART. Primarily for use
   82  * by console and debug port logic.
   83  */
   84 static __inline int
   85 uart_probe(struct uart_devinfo *di)
   86 {
   87         return (di->ops.probe(&di->bas));
   88 }
   89 
   90 static __inline void
   91 uart_init(struct uart_devinfo *di)
   92 {
   93         di->ops.init(&di->bas, di->baudrate, di->databits, di->stopbits,
   94             di->parity);
   95 }
   96 
   97 static __inline void
   98 uart_term(struct uart_devinfo *di)
   99 {
  100         di->ops.term(&di->bas);
  101 }
  102 
  103 static __inline void
  104 uart_putc(struct uart_devinfo *di, int c)
  105 {
  106         di->ops.putc(&di->bas, c);
  107 }
  108 
  109 static __inline int
  110 uart_poll(struct uart_devinfo *di)
  111 {
  112         return (di->ops.poll(&di->bas));
  113 }
  114 
  115 static __inline int
  116 uart_getc(struct uart_devinfo *di)
  117 {
  118         return (di->ops.getc(&di->bas));
  119 }
  120 
  121 #endif /* _DEV_UART_CPU_H_ */

Cache object: c4100c1f08d4722f2fadcc0bba36ac5b


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