1 /*        $NetBSD: umodemvar.h,v 1.12 2019/05/09 02:43:35 mrg Exp $   */
2 
3 /*
4  * Copyright (c) 1998 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Lennart Augustsson (lennart@augustsson.net) at
9  * Carlstedt Research & Technology.
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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 struct umodem_softc {
34           device_t            sc_dev;             /* base device */
35 
36           struct usbd_device *          sc_udev;  /* USB device */
37 
38           int                           sc_ctl_iface_no;
39           struct usbd_interface *       sc_ctl_iface;       /* control interface */
40           int                           sc_data_iface_no;
41           struct usbd_interface *       sc_data_iface;      /* data interface */
42 
43           int                           sc_cm_cap;          /* CM capabilities */
44           int                           sc_acm_cap;         /* ACM capabilities */
45 
46           int                           sc_cm_over_data;
47 
48           usb_cdc_line_state_t          sc_line_state;      /* current line state */
49           u_char                        sc_dtr;             /* current DTR state */
50           u_char                        sc_rts;             /* current RTS state */
51 
52           device_t            sc_subdev;          /* ucom device */
53 
54           bool                          sc_dying; /* disconnecting */
55 
56           int                           sc_ctl_notify;      /* Notification endpoint */
57           struct usbd_pipe *  sc_notify_pipe; /* Notification pipe */
58           usb_cdc_notification_t        sc_notify_buf;      /* Notification structure */
59           u_char                        sc_lsr;             /* Local status register */
60           u_char                        sc_msr;             /* Modem status register */
61 };
62 
63 void umodem_common_childdet(struct umodem_softc *, device_t);
64 int umodem_common_attach(device_t, struct umodem_softc *,
65                                struct usbif_attach_arg *, struct ucom_attach_args *);
66 
67 int       umodem_get_caps(struct usbd_device *, int *, int *,
68                               usb_interface_descriptor_t *);
69 
70 void      umodem_get_status(void *, int, u_char *, u_char *);
71 void      umodem_set(void *, int, int, int);
72 int       umodem_param(void *, int, struct termios *);
73 int       umodem_ioctl(void *, int, u_long, void *, int, proc_t *);
74 int       umodem_open(void *, int);
75 void      umodem_close(void *, int);
76 int       umodem_common_detach(struct umodem_softc *, int);
77