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/usb/ucomvar.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: ucomvar.h,v 1.9 2001/01/23 21:56:17 augustss Exp $     */
    2 /*      $FreeBSD: releng/7.3/sys/dev/usb/ucomvar.h 178512 2008-04-25 17:04:45Z sam $    */
    3 
    4 /*-
    5  * Copyright (c) 2001-2002, Shunsuke Akiyama <akiyama@jp.FreeBSD.org>.
    6  * All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  *
   17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   27  * SUCH DAMAGE.
   28  */
   29 
   30 /*-
   31  * Copyright (c) 1999 The NetBSD Foundation, Inc.
   32  * All rights reserved.
   33  *
   34  * This code is derived from software contributed to The NetBSD Foundation
   35  * by Lennart Augustsson (lennart@augustsson.net) at
   36  * Carlstedt Research & Technology.
   37  *
   38  * Redistribution and use in source and binary forms, with or without
   39  * modification, are permitted provided that the following conditions
   40  * are met:
   41  * 1. Redistributions of source code must retain the above copyright
   42  *    notice, this list of conditions and the following disclaimer.
   43  * 2. Redistributions in binary form must reproduce the above copyright
   44  *    notice, this list of conditions and the following disclaimer in the
   45  *    documentation and/or other materials provided with the distribution.
   46  * 3. All advertising materials mentioning features or use of this software
   47  *    must display the following acknowledgement:
   48  *        This product includes software developed by the NetBSD
   49  *        Foundation, Inc. and its contributors.
   50  * 4. Neither the name of The NetBSD Foundation nor the names of its
   51  *    contributors may be used to endorse or promote products derived
   52  *    from this software without specific prior written permission.
   53  *
   54  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   55  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   56  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   57  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   58  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   59  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   60  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   61  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   62  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   63  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   64  * POSSIBILITY OF SUCH DAMAGE.
   65  */
   66 
   67 /* Module interface related macros */
   68 #define UCOM_MODVER     1
   69 
   70 #define UCOM_MINVER     1
   71 #define UCOM_PREFVER    UCOM_MODVER
   72 #define UCOM_MAXVER     1
   73 
   74 /* Macros to clear/set/test flags. */
   75 #define SET(t, f)       (t) |= (f)
   76 #define CLR(t, f)       (t) &= ~((unsigned)(f))
   77 #define ISSET(t, f)     ((t) & (f))
   78 
   79 #define UCOM_CALLOUT_MASK       0x80
   80 
   81 #define UCOMUNIT_MASK           0x3ff7f
   82 #define UCOMDIALOUT_MASK        0x80000
   83 #define UCOMCALLUNIT_MASK       0x40000
   84 
   85 #define UCOMUNIT(x)             (minor(x) & UCOMUNIT_MASK)
   86 #define UCOMDIALOUT(x)          (minor(x) & UCOMDIALOUT_MASK)
   87 #define UCOMCALLUNIT(x)         (minor(x) & UCOMCALLUNIT_MASK)
   88 
   89 #define UCOM_UNK_PORTNO         -1      /* XXX */
   90 
   91 struct ucom_softc;
   92 
   93 struct ucom_callback {
   94         void (*ucom_get_status)(void *, int, u_char *, u_char *);
   95         void (*ucom_set)(void *, int, int, int);
   96 #define UCOM_SET_DTR 1
   97 #define UCOM_SET_RTS 2
   98 #define UCOM_SET_BREAK 3
   99         int (*ucom_param)(void *, int, struct termios *);
  100         int (*ucom_ioctl)(void *, int, u_long, caddr_t, int, struct thread *);
  101         int (*ucom_open)(void *, int);
  102         void (*ucom_close)(void *, int);
  103         void (*ucom_read)(void *, int, u_char **, u_int32_t *);
  104         void (*ucom_write)(void *, int, u_char *, u_char *, u_int32_t *);
  105 };
  106 
  107 /* line status register */
  108 #define ULSR_RCV_FIFO   0x80
  109 #define ULSR_TSRE       0x40    /* Transmitter empty: byte sent */
  110 #define ULSR_TXRDY      0x20    /* Transmitter buffer empty */
  111 #define ULSR_BI         0x10    /* Break detected */
  112 #define ULSR_FE         0x08    /* Framing error: bad stop bit */
  113 #define ULSR_PE         0x04    /* Parity error */
  114 #define ULSR_OE         0x02    /* Overrun, lost incoming byte */
  115 #define ULSR_RXRDY      0x01    /* Byte ready in Receive Buffer */
  116 #define ULSR_RCV_MASK   0x1f    /* Mask for incoming data or error */
  117 
  118 /* ucom state declarations */
  119 #define UCS_RXSTOP      0x0001  /* Rx stopped */
  120 #define UCS_RTS_IFLOW   0x0008  /* use RTS input flow control */
  121 
  122 struct ucom_softc {
  123         device_t                sc_dev;         /* base device */
  124         usbd_device_handle      sc_udev;        /* USB device */
  125         usbd_interface_handle   sc_iface;       /* data interface */
  126 
  127         int                     sc_bulkin_no;   /* bulk in endpoint address */
  128         usbd_pipe_handle        sc_bulkin_pipe; /* bulk in pipe */
  129         usbd_xfer_handle        sc_ixfer;       /* read request */
  130         u_char                  *sc_ibuf;       /* read buffer */
  131         u_int                   sc_ibufsize;    /* read buffer size */
  132         u_int                   sc_ibufsizepad; /* read buffer size padded */
  133 
  134         int                     sc_bulkout_no;  /* bulk out endpoint address */
  135         usbd_pipe_handle        sc_bulkout_pipe;/* bulk out pipe */
  136         usbd_xfer_handle        sc_oxfer;       /* write request */
  137         u_char                  *sc_obuf;       /* write buffer */
  138         u_int                   sc_obufsize;    /* write buffer size */
  139         u_int                   sc_opkthdrlen;  /* header length of
  140                                                    output packet */
  141 
  142         struct ucom_callback    *sc_callback;
  143         void                    *sc_parent;
  144         int                     sc_portno;
  145 
  146         struct tty              *sc_tty;        /* our tty */
  147 
  148         int                     sc_state;
  149 
  150         int                     sc_poll;
  151 
  152         u_char                  sc_lsr;
  153         u_char                  sc_msr;
  154         u_char                  sc_mcr;
  155 
  156         u_char                  sc_dying;       /* disconnecting */
  157 
  158 };
  159 
  160 extern devclass_t ucom_devclass;
  161 
  162 int ucom_attach_tty(struct ucom_softc *, int, char*, int);
  163 int ucom_attach(struct ucom_softc *);
  164 int ucom_detach(struct ucom_softc *);
  165 void ucom_status_change(struct ucom_softc *);

Cache object: 98873ef111da46de3196002933230af2


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