2008-08-01 02:01:15 +04:00
|
|
|
/* $NetBSD: ubsavar.h,v 1.6 2008/07/31 22:01:15 drochner Exp $ */
|
add full support device driver for Huawei E220 wireless modem
PR/37692 from Yojiro UO
---
uhmodem: device driver for huawei 3G wireless modem
* what it is?
A device driver for huawei 3G wireless modem, E220 and its valiations.
The devices are very simuler to ubsa device, but they need special care
to use as modem device.
This patch introduce "uhmodem (USB Huawei modem)" for the devices.
A uhmodem device has two com devices and one USB mass strage device.
The driver enable to use all of them.
* dmesg:
uhmodem0 at uhub0 port 1 configuration 1 interface 0
uhmodem0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2
uhmodem0: mass storage only mode, reattach to enable modem
uhmodem0: at uhub0 port 1 (addr 2) disconnected
uhmodem0 detached
uhmodem0 at uhub0 port 1 configuration 1 interface 0
uhmodem0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2
ucom0 at uhmodem0 portno 0: modem
ucom1 at uhmodem0 portno 1: monitor
umass0 at uhub0 port 1 configuration 1 interface 2
umass0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, 1 lun per target
cd0 at scsibus0 target 0 lun 0: <HUAWEI, Mass Storage, 2.31> cdrom removable
2008-01-21 14:36:46 +03:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 2002, Alexander Kabaev <kan.FreeBSD.org>.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Ichiro FUKUHARA (ichiro@ichiro.org).
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define UBSA_MODVER 1 /* module version */
|
|
|
|
|
2008-08-01 02:01:15 +04:00
|
|
|
#define UBSA_DEFAULT_CONFIG_INDEX 0
|
add full support device driver for Huawei E220 wireless modem
PR/37692 from Yojiro UO
---
uhmodem: device driver for huawei 3G wireless modem
* what it is?
A device driver for huawei 3G wireless modem, E220 and its valiations.
The devices are very simuler to ubsa device, but they need special care
to use as modem device.
This patch introduce "uhmodem (USB Huawei modem)" for the devices.
A uhmodem device has two com devices and one USB mass strage device.
The driver enable to use all of them.
* dmesg:
uhmodem0 at uhub0 port 1 configuration 1 interface 0
uhmodem0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2
uhmodem0: mass storage only mode, reattach to enable modem
uhmodem0: at uhub0 port 1 (addr 2) disconnected
uhmodem0 detached
uhmodem0 at uhub0 port 1 configuration 1 interface 0
uhmodem0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2
ucom0 at uhmodem0 portno 0: modem
ucom1 at uhmodem0 portno 1: monitor
umass0 at uhub0 port 1 configuration 1 interface 2
umass0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, 1 lun per target
cd0 at scsibus0 target 0 lun 0: <HUAWEI, Mass Storage, 2.31> cdrom removable
2008-01-21 14:36:46 +03:00
|
|
|
#define UBSA_IFACE_INDEX_OFFSET 0
|
|
|
|
|
|
|
|
#define UBSA_INTR_INTERVAL 100 /* ms */
|
|
|
|
|
|
|
|
#define UBSA_SET_BAUDRATE 0x00
|
|
|
|
#define UBSA_SET_STOP_BITS 0x01
|
|
|
|
#define UBSA_SET_DATA_BITS 0x02
|
|
|
|
#define UBSA_SET_PARITY 0x03
|
|
|
|
#define UBSA_SET_DTR 0x0A
|
|
|
|
#define UBSA_SET_RTS 0x0B
|
|
|
|
#define UBSA_SET_BREAK 0x0C
|
|
|
|
#define UBSA_SET_FLOW_CTRL 0x10
|
|
|
|
|
|
|
|
#define UBSA_QUADUMTS_SET_PIN 0x22
|
|
|
|
|
|
|
|
#define UBSA_PARITY_NONE 0x00
|
|
|
|
#define UBSA_PARITY_EVEN 0x01
|
|
|
|
#define UBSA_PARITY_ODD 0x02
|
|
|
|
#define UBSA_PARITY_MARK 0x03
|
|
|
|
#define UBSA_PARITY_SPACE 0x04
|
|
|
|
|
|
|
|
#define UBSA_FLOW_NONE 0x0000
|
|
|
|
#define UBSA_FLOW_OCTS 0x0001
|
|
|
|
#define UBSA_FLOW_ODSR 0x0002
|
|
|
|
#define UBSA_FLOW_IDSR 0x0004
|
|
|
|
#define UBSA_FLOW_IDTR 0x0008
|
|
|
|
#define UBSA_FLOW_IRTS 0x0010
|
|
|
|
#define UBSA_FLOW_ORTS 0x0020
|
|
|
|
#define UBSA_FLOW_UNKNOWN 0x0040
|
|
|
|
#define UBSA_FLOW_OXON 0x0080
|
|
|
|
#define UBSA_FLOW_IXON 0x0100
|
|
|
|
|
|
|
|
/* line status register */
|
|
|
|
#define UBSA_LSR_TSRE 0x40 /* Transmitter empty: byte sent */
|
|
|
|
#define UBSA_LSR_TXRDY 0x20 /* Transmitter buffer empty */
|
|
|
|
#define UBSA_LSR_BI 0x10 /* Break detected */
|
|
|
|
#define UBSA_LSR_FE 0x08 /* Framing error: bad stop bit */
|
|
|
|
#define UBSA_LSR_PE 0x04 /* Parity error */
|
|
|
|
#define UBSA_LSR_OE 0x02 /* Overrun, lost incoming byte */
|
|
|
|
#define UBSA_LSR_RXRDY 0x01 /* Byte ready in Receive Buffer */
|
|
|
|
#define UBSA_LSR_RCV_MASK 0x1f /* Mask for incoming data or error */
|
|
|
|
|
|
|
|
/* modem status register */
|
|
|
|
/* All deltas are from the last read of the MSR. */
|
|
|
|
#define UBSA_MSR_DCD 0x80 /* Current Data Carrier Detect */
|
|
|
|
#define UBSA_MSR_RI 0x40 /* Current Ring Indicator */
|
|
|
|
#define UBSA_MSR_DSR 0x20 /* Current Data Set Ready */
|
|
|
|
#define UBSA_MSR_CTS 0x10 /* Current Clear to Send */
|
|
|
|
#define UBSA_MSR_DDCD 0x08 /* DCD has changed state */
|
|
|
|
#define UBSA_MSR_TERI 0x04 /* RI has toggled low to high */
|
|
|
|
#define UBSA_MSR_DDSR 0x02 /* DSR has changed state */
|
|
|
|
#define UBSA_MSR_DCTS 0x01 /* CTS has changed state */
|
|
|
|
|
|
|
|
#define UBSA_MAXCONN 3
|
|
|
|
|
|
|
|
struct ubsa_softc {
|
|
|
|
USBBASEDEVICE sc_dev; /* base device */
|
|
|
|
usbd_device_handle sc_udev; /* USB device */
|
|
|
|
usbd_interface_handle sc_iface[UBSA_MAXCONN]; /* interface */
|
|
|
|
|
|
|
|
int sc_iface_number[UBSA_MAXCONN]; /* interface number */
|
|
|
|
int sc_config_index; /* USB CONFIG_INDEX */
|
|
|
|
|
|
|
|
int sc_intr_number; /* interrupt number */
|
|
|
|
usbd_pipe_handle sc_intr_pipe; /* interrupt pipe */
|
|
|
|
u_char *sc_intr_buf; /* interrupt buffer */
|
|
|
|
int sc_isize;
|
|
|
|
|
|
|
|
u_char sc_dtr; /* current DTR state */
|
|
|
|
u_char sc_rts; /* current RTS state */
|
|
|
|
|
|
|
|
u_char sc_lsr; /* Local status register */
|
|
|
|
u_char sc_msr; /* ubsa status register */
|
|
|
|
|
2008-05-24 20:40:58 +04:00
|
|
|
device_t sc_subdevs[UBSA_MAXCONN]; /* ucom device */
|
add full support device driver for Huawei E220 wireless modem
PR/37692 from Yojiro UO
---
uhmodem: device driver for huawei 3G wireless modem
* what it is?
A device driver for huawei 3G wireless modem, E220 and its valiations.
The devices are very simuler to ubsa device, but they need special care
to use as modem device.
This patch introduce "uhmodem (USB Huawei modem)" for the devices.
A uhmodem device has two com devices and one USB mass strage device.
The driver enable to use all of them.
* dmesg:
uhmodem0 at uhub0 port 1 configuration 1 interface 0
uhmodem0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2
uhmodem0: mass storage only mode, reattach to enable modem
uhmodem0: at uhub0 port 1 (addr 2) disconnected
uhmodem0 detached
uhmodem0 at uhub0 port 1 configuration 1 interface 0
uhmodem0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2
ucom0 at uhmodem0 portno 0: modem
ucom1 at uhmodem0 portno 1: monitor
umass0 at uhub0 port 1 configuration 1 interface 2
umass0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, 1 lun per target
cd0 at scsibus0 target 0 lun 0: <HUAWEI, Mass Storage, 2.31> cdrom removable
2008-01-21 14:36:46 +03:00
|
|
|
int sc_numif; /* number of interfaces */
|
|
|
|
|
|
|
|
u_char sc_dying; /* disconnecting */
|
|
|
|
u_char sc_quadumts;
|
2008-02-11 05:23:09 +03:00
|
|
|
u_int16_t sc_devflags;
|
add full support device driver for Huawei E220 wireless modem
PR/37692 from Yojiro UO
---
uhmodem: device driver for huawei 3G wireless modem
* what it is?
A device driver for huawei 3G wireless modem, E220 and its valiations.
The devices are very simuler to ubsa device, but they need special care
to use as modem device.
This patch introduce "uhmodem (USB Huawei modem)" for the devices.
A uhmodem device has two com devices and one USB mass strage device.
The driver enable to use all of them.
* dmesg:
uhmodem0 at uhub0 port 1 configuration 1 interface 0
uhmodem0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2
uhmodem0: mass storage only mode, reattach to enable modem
uhmodem0: at uhub0 port 1 (addr 2) disconnected
uhmodem0 detached
uhmodem0 at uhub0 port 1 configuration 1 interface 0
uhmodem0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2
ucom0 at uhmodem0 portno 0: modem
ucom1 at uhmodem0 portno 1: monitor
umass0 at uhub0 port 1 configuration 1 interface 2
umass0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, 1 lun per target
cd0 at scsibus0 target 0 lun 0: <HUAWEI, Mass Storage, 2.31> cdrom removable
2008-01-21 14:36:46 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-01-21 15:16:31 +03:00
|
|
|
void ubsa_intr(usbd_xfer_handle, usbd_private_handle, usbd_status);
|
|
|
|
|
|
|
|
void ubsa_get_status(void *, int, u_char *, u_char *);
|
|
|
|
void ubsa_set(void *, int, int, int);
|
|
|
|
int ubsa_param(void *, int, struct termios *);
|
|
|
|
int ubsa_open(void *, int);
|
|
|
|
void ubsa_close(void *, int);
|
|
|
|
|
|
|
|
void ubsa_break(struct ubsa_softc *sc, int, int onoff);
|
|
|
|
int ubsa_request(struct ubsa_softc *, int, u_int8_t, u_int16_t);
|
|
|
|
void ubsa_dtr(struct ubsa_softc *, int, int);
|
|
|
|
void ubsa_quadumts_dtr(struct ubsa_softc *, int, int);
|
|
|
|
void ubsa_rts(struct ubsa_softc *, int, int);
|
|
|
|
void ubsa_quadumts_rts(struct ubsa_softc *, int, int);
|
|
|
|
void ubsa_baudrate(struct ubsa_softc *, int, speed_t);
|
|
|
|
void ubsa_parity(struct ubsa_softc *, int, tcflag_t);
|
|
|
|
void ubsa_databits(struct ubsa_softc *, int, tcflag_t);
|
|
|
|
void ubsa_stopbits(struct ubsa_softc *, int, tcflag_t);
|
|
|
|
void ubsa_flow(struct ubsa_softc *, int, tcflag_t, tcflag_t);
|