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

Cache object: 79a9a147c4f66fd4fcd614a7bb2488cb


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