Home | History | Annotate | Line # | Download | only in usb
ucomvar.h revision 1.10.16.1
      1  1.10.16.1     skrll /*	$NetBSD: ucomvar.h,v 1.10.16.1 2004/09/18 14:51:46 skrll Exp $	*/
      2        1.1  augustss 
      3        1.1  augustss /*
      4        1.1  augustss  * Copyright (c) 1999 The NetBSD Foundation, Inc.
      5        1.1  augustss  * All rights reserved.
      6        1.1  augustss  *
      7        1.1  augustss  * This code is derived from software contributed to The NetBSD Foundation
      8        1.6  augustss  * by Lennart Augustsson (lennart (at) augustsson.net) at
      9        1.1  augustss  * Carlstedt Research & Technology.
     10        1.1  augustss  *
     11        1.1  augustss  * Redistribution and use in source and binary forms, with or without
     12        1.1  augustss  * modification, are permitted provided that the following conditions
     13        1.1  augustss  * are met:
     14        1.1  augustss  * 1. Redistributions of source code must retain the above copyright
     15        1.1  augustss  *    notice, this list of conditions and the following disclaimer.
     16        1.1  augustss  * 2. Redistributions in binary form must reproduce the above copyright
     17        1.1  augustss  *    notice, this list of conditions and the following disclaimer in the
     18        1.1  augustss  *    documentation and/or other materials provided with the distribution.
     19        1.1  augustss  * 3. All advertising materials mentioning features or use of this software
     20        1.1  augustss  *    must display the following acknowledgement:
     21        1.1  augustss  *        This product includes software developed by the NetBSD
     22        1.1  augustss  *        Foundation, Inc. and its contributors.
     23        1.1  augustss  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24        1.1  augustss  *    contributors may be used to endorse or promote products derived
     25        1.1  augustss  *    from this software without specific prior written permission.
     26        1.1  augustss  *
     27        1.1  augustss  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28        1.1  augustss  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29        1.1  augustss  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30        1.1  augustss  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31        1.1  augustss  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32        1.1  augustss  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33        1.1  augustss  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34        1.1  augustss  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35        1.1  augustss  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36        1.1  augustss  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37        1.1  augustss  * POSSIBILITY OF SUCH DAMAGE.
     38        1.1  augustss  */
     39        1.1  augustss 
     40        1.1  augustss 
     41        1.1  augustss /* Macros to clear/set/test flags. */
     42        1.1  augustss #define SET(t, f)       (t) |= (f)
     43        1.1  augustss #define CLR(t, f)       (t) &= ~(f)
     44        1.1  augustss #define ISSET(t, f)     ((t) & (f))
     45        1.1  augustss 
     46  1.10.16.1     skrll /* just for ucom_attach_args, not in the config namespace */
     47  1.10.16.1     skrll #define UCOM_UNK_PORTNO (-1)
     48        1.1  augustss 
     49        1.1  augustss struct	ucom_softc;
     50        1.1  augustss 
     51        1.1  augustss struct ucom_methods {
     52        1.7  augustss 	void (*ucom_get_status)(void *sc, int portno, u_char *lsr, u_char *msr);
     53        1.7  augustss 	void (*ucom_set)(void *sc, int portno, int reg, int onoff);
     54        1.1  augustss #define UCOM_SET_DTR 1
     55        1.1  augustss #define UCOM_SET_RTS 2
     56        1.1  augustss #define UCOM_SET_BREAK 3
     57        1.7  augustss 	int (*ucom_param)(void *sc, int portno, struct termios *);
     58        1.7  augustss 	int (*ucom_ioctl)(void *sc, int portno, u_long cmd,
     59       1.10  augustss 			  caddr_t data, int flag, usb_proc_ptr p);
     60        1.7  augustss 	int (*ucom_open)(void *sc, int portno);
     61        1.7  augustss 	void (*ucom_close)(void *sc, int portno);
     62        1.7  augustss 	void (*ucom_read)(void *sc, int portno, u_char **ptr, u_int32_t *count);
     63        1.7  augustss 	void (*ucom_write)(void *sc, int portno, u_char *to, u_char *from,
     64        1.7  augustss 			   u_int32_t *count);
     65        1.1  augustss };
     66        1.1  augustss 
     67        1.1  augustss /* modem control register */
     68        1.1  augustss #define	UMCR_RTS	0x02	/* Request To Send */
     69        1.1  augustss #define	UMCR_DTR	0x01	/* Data Terminal Ready */
     70        1.1  augustss 
     71        1.1  augustss /* line status register */
     72        1.1  augustss #define	ULSR_RCV_FIFO	0x80
     73        1.1  augustss #define	ULSR_TSRE	0x40	/* Transmitter empty: byte sent */
     74        1.1  augustss #define	ULSR_TXRDY	0x20	/* Transmitter buffer empty */
     75        1.1  augustss #define	ULSR_BI		0x10	/* Break detected */
     76        1.1  augustss #define	ULSR_FE		0x08	/* Framing error: bad stop bit */
     77        1.1  augustss #define	ULSR_PE		0x04	/* Parity error */
     78        1.1  augustss #define	ULSR_OE		0x02	/* Overrun, lost incoming byte */
     79        1.1  augustss #define	ULSR_RXRDY	0x01	/* Byte ready in Receive Buffer */
     80        1.1  augustss #define	ULSR_RCV_MASK	0x1f	/* Mask for incoming data or error */
     81        1.1  augustss 
     82        1.1  augustss /* modem status register */
     83        1.1  augustss /* All deltas are from the last read of the MSR. */
     84        1.1  augustss #define	UMSR_DCD	0x80	/* Current Data Carrier Detect */
     85        1.1  augustss #define	UMSR_RI		0x40	/* Current Ring Indicator */
     86        1.1  augustss #define	UMSR_DSR	0x20	/* Current Data Set Ready */
     87        1.1  augustss #define	UMSR_CTS	0x10	/* Current Clear to Send */
     88        1.1  augustss #define	UMSR_DDCD	0x08	/* DCD has changed state */
     89        1.1  augustss #define	UMSR_TERI	0x04	/* RI has toggled low to high */
     90        1.1  augustss #define	UMSR_DDSR	0x02	/* DSR has changed state */
     91        1.1  augustss #define	UMSR_DCTS	0x01	/* CTS has changed state */
     92        1.1  augustss 
     93        1.1  augustss struct ucom_attach_args {
     94        1.1  augustss 	int portno;
     95        1.1  augustss 	int bulkin;
     96        1.1  augustss 	int bulkout;
     97        1.3  augustss 	u_int ibufsize;
     98        1.5  augustss 	u_int ibufsizepad;
     99        1.3  augustss 	u_int obufsize;
    100        1.8  augustss 	u_int opkthdrlen;
    101        1.9  augustss 	const char *info;	/* attach message */
    102        1.1  augustss 	usbd_device_handle device;
    103        1.1  augustss 	usbd_interface_handle iface;
    104        1.1  augustss 	struct ucom_methods *methods;
    105        1.1  augustss 	void *arg;
    106        1.1  augustss };
    107        1.1  augustss 
    108        1.7  augustss int ucomprint(void *aux, const char *pnp);
    109  1.10.16.1     skrll int ucomsubmatch(struct device *parent, struct cfdata *cf,
    110  1.10.16.1     skrll 		 const locdesc_t *, void *aux);
    111        1.7  augustss void ucom_status_change(struct ucom_softc *);
    112