5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #ifndef _USBSER_USBFTDI_UFTDI_VAR_H
27 #define _USBSER_USBFTDI_UFTDI_VAR_H
28
29 /*
30 * USB UFTDI definitions
31 */
32
33 #include <sys/types.h>
34 #include <sys/dditypes.h>
35 #include <sys/note.h>
36
37 #include <sys/usb/clients/usbser/usbser_dsdi.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /*
44 * PM support
67 kmutex_t uf_lock; /* structure lock */
68 dev_info_t *uf_dip; /* device info */
69 int uf_dev_flags; /* device flags */
70 int uf_hwport; /* hw port number */
71 int uf_port_state; /* port state */
72 int uf_port_flags; /* port flags */
73 ds_cb_t uf_cb; /* DSD callbacks */
74
75 /*
76 * USBA
77 */
78 usb_client_dev_data_t *uf_dev_data; /* registration data */
79 usb_event_t *uf_usb_events; /* usb events */
80 usb_pipe_handle_t uf_def_ph; /* default pipe hdl */
81 usb_pipe_handle_t uf_bulkin_ph; /* in pipe hdl */
82 int uf_bulkin_state; /* in pipe state */
83 usb_pipe_handle_t uf_bulkout_ph; /* in pipe hdl */
84 int uf_bulkout_state; /* out pipe state */
85 usb_log_handle_t uf_lh; /* USBA log handle */
86 int uf_dev_state; /* USB device state */
87 size_t uf_xfer_sz; /* HCI bulk xfer size */
88
89 uftdi_pm_t *uf_pm; /* PM support */
90
91 /*
92 * data receive and transmit
93 */
94 mblk_t *uf_rx_mp; /* rx data */
95 mblk_t *uf_tx_mp; /* tx data */
96 kcondvar_t uf_tx_cv; /* tx completion */
97
98 /*
99 * soft registers
100 */
101 uftdi_regs_t uf_softr; /* config registers */
102 uint16_t uf_mctl; /* modem control */
103 uint8_t uf_msr; /* modem status */
104 uint8_t uf_lsr; /* line status register */
105
106 } uftdi_state_t;
107
108 _NOTE(MUTEX_PROTECTS_DATA(uftdi_state::uf_lock, uftdi_state))
109 _NOTE(DATA_READABLE_WITHOUT_LOCK(uftdi_state::{
110 uf_dip
111 uf_dev_data
112 uf_usb_events
113 uf_def_ph
114 uf_lh
115 uf_xfer_sz
116 uf_pm
117 uf_port_state
118 uf_cb
119 uf_bulkin_ph
120 uf_bulkout_ph
121 uf_hwport
122 }))
123
124 /* port state */
125 enum {
126 UFTDI_PORT_CLOSED, /* port is closed */
127 UFTDI_PORT_OPEN, /* port is open */
128 UFTDI_PORT_CLOSING
129 };
130
131 /* port flags */
132 enum {
133 UFTDI_PORT_TX_STOPPED = 0x0001 /* transmit not allowed */
134 };
135
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25 /*
26 * Copyright 2012 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
27 */
28
29 #ifndef _USBSER_USBFTDI_UFTDI_VAR_H
30 #define _USBSER_USBFTDI_UFTDI_VAR_H
31
32 /*
33 * USB UFTDI definitions
34 */
35
36 #include <sys/types.h>
37 #include <sys/dditypes.h>
38 #include <sys/note.h>
39
40 #include <sys/usb/clients/usbser/usbser_dsdi.h>
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 /*
47 * PM support
70 kmutex_t uf_lock; /* structure lock */
71 dev_info_t *uf_dip; /* device info */
72 int uf_dev_flags; /* device flags */
73 int uf_hwport; /* hw port number */
74 int uf_port_state; /* port state */
75 int uf_port_flags; /* port flags */
76 ds_cb_t uf_cb; /* DSD callbacks */
77
78 /*
79 * USBA
80 */
81 usb_client_dev_data_t *uf_dev_data; /* registration data */
82 usb_event_t *uf_usb_events; /* usb events */
83 usb_pipe_handle_t uf_def_ph; /* default pipe hdl */
84 usb_pipe_handle_t uf_bulkin_ph; /* in pipe hdl */
85 int uf_bulkin_state; /* in pipe state */
86 usb_pipe_handle_t uf_bulkout_ph; /* in pipe hdl */
87 int uf_bulkout_state; /* out pipe state */
88 usb_log_handle_t uf_lh; /* USBA log handle */
89 int uf_dev_state; /* USB device state */
90 size_t uf_ibuf_sz; /* input buffer size */
91 size_t uf_obuf_sz; /* output buffer size */
92
93 uftdi_pm_t *uf_pm; /* PM support */
94
95 /*
96 * data receive and transmit
97 */
98 mblk_t *uf_rx_mp; /* rx data */
99 mblk_t *uf_tx_mp; /* tx data */
100 kcondvar_t uf_tx_cv; /* tx completion */
101
102 /*
103 * soft registers
104 */
105 uftdi_regs_t uf_softr; /* config registers */
106 uint16_t uf_mctl; /* modem control */
107 uint8_t uf_msr; /* modem status */
108 uint8_t uf_lsr; /* line status register */
109
110 } uftdi_state_t;
111
112 _NOTE(MUTEX_PROTECTS_DATA(uftdi_state::uf_lock, uftdi_state))
113 _NOTE(DATA_READABLE_WITHOUT_LOCK(uftdi_state::{
114 uf_dip
115 uf_dev_data
116 uf_usb_events
117 uf_def_ph
118 uf_lh
119 uf_ibuf_sz
120 uf_obuf_sz
121 uf_pm
122 uf_port_state
123 uf_cb
124 uf_bulkin_ph
125 uf_bulkout_ph
126 uf_hwport
127 }))
128
129 /* port state */
130 enum {
131 UFTDI_PORT_CLOSED, /* port is closed */
132 UFTDI_PORT_OPEN, /* port is open */
133 UFTDI_PORT_CLOSING
134 };
135
136 /* port flags */
137 enum {
138 UFTDI_PORT_TX_STOPPED = 0x0001 /* transmit not allowed */
139 };
140
|