亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? hso.c

?? linux系統(tǒng)下3G模塊USB串口驅(qū)動程序源代碼最新版本
?? C
?? 第 1 頁 / 共 5 頁
字號:
/****************************************************************************** * * Driver for Option High Speed Mobile Devices. * *  Copyright (C) 2008 Option International *                     Filip Aben <f.aben@option.com> *                     Denis Joseph Barrow <d.barow@option.com> *                     Jan Dumon <j.dumon@option.com> *  Copyright (C) 2007 Andrew Bird (Sphere Systems Ltd) *  			<ajb@spheresystems.co.uk> *  Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de> *  Copyright (C) 2008 Novell, Inc. * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License version 2 as *  published by the Free Software Foundation. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, *  USA * * *****************************************************************************//****************************************************************************** * * Description of the device: * * Interface 0:	Contains the IP network interface on the bulk end points. *		The multiplexed serial ports are using the interrupt and *		control endpoints. *		Interrupt contains a bitmap telling which multiplexed *		serialport needs servicing. * * Interface 1:	Diagnostics port, uses bulk only, do not submit urbs until the *		port is opened, as this have a huge impact on the network port *		throughput. * * Interface 2:	Standard modem interface - circuit switched interface, this *		can be used to make a standard ppp connection however it *              should not be used in conjunction with the IP network interface *              enabled for USB performance reasons i.e. if using this set *              ideally disable_net=1. * *****************************************************************************/#include <linux/version.h>#include <linux/autoconf.h>#include <linux/sched.h>#include <linux/slab.h>#include <linux/init.h>#include <linux/delay.h>#include <linux/netdevice.h>#include <linux/module.h>#include <linux/ethtool.h>#include <linux/usb.h>#include <linux/timer.h>#include <linux/tty.h>#include <linux/tty_driver.h>#include <linux/tty_flip.h>#include <linux/kmod.h>#define HAVE_RFKILL (defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE))#if (HAVE_RFKILL)#include <linux/rfkill.h>#endif#include <linux/ip.h>#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))#include <linux/uaccess.h>#else#include <asm/uaccess.h>#endif#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))#include <linux/usb/cdc.h>#else#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 11))#include <linux/usb_cdc.h>#else#define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x0#define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x1#endif#endif#include <net/arp.h>#include <asm/byteorder.h>#include <linux/serial_core.h>#include <linux/serial.h>#if  (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 15))#include <linux/mutex.h>#define MUTEX mutex#else#include <asm/semaphore.h>#define MUTEX semaphore#define mutex_init(sem) sema_init(sem, 1)#define mutex_lock(sem) down(sem)#define mutex_unlock(sem) up(sem)#endif  /* ( LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 15) ) */#define NETDEV_HAVE_DEV (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 20))#if NETDEV_HAVE_DEV#define netdev_err(net, format, arg...)  dev_err(&net->dev, format, ## arg)#define netdev_warn(net, format, arg...) dev_warn(&net->dev, format, ## arg)#else#define netdev_err(net, format, arg...) printk(KERN_ERR "%s" format ,\					       (char *)(&net->name), ## arg)#define netdev_warn(net, format, arg...) printk(KERN_WARNING "%s" format ,\                                                (char *)(&net->name), ## arg)#endif#ifdef CONFIG_HSO_AUTOPM#if  (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))#warning "CONFIG_HSO_AUTOPM set for kernel version < 2.6.19," \          "it's not supported by the kernel I'm undeffing it."#undef CONFIG_HSO_AUTOPM#endif#endif#define HAVE_RESET_RESUME (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22))#if (!HAVE_RFKILL)#define SIOCSETRADIO   (SIOCDEVPRIVATE+4)#endif#if  (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22))static inline void skb_reset_mac_header(struct sk_buff *skb){	skb->mac.raw = skb->data;}#endif#ifdef CONFIG_HSO_AUTOPM#define sCONFIG_HSO_AUTOPM "CONFIG_HSO_AUTOPM "#else#define sCONFIG_HSO_AUTOPM ""#endif#ifdef CONFIG_HSO_DEBUG#define sCONFIG_HSO_DEBUG "CONFIG_HSO_DEBUG "#else#define sCONFIG_HSO_DEBUG ""#endif#define DRIVER_VERSION			"1.12-Option"#define MOD_AUTHOR			"Option Wireless"#define MOD_DESCRIPTION			"USB High Speed Option driver"#define MOD_LICENSE			"GPL"#define HSO_MAX_NET_DEVICES		10#define HSO_MAX_MTU			2048#define DEFAULT_MTU			1500#define DEFAULT_MRU			1500#define CTRL_URB_RX_SIZE		1024#define CTRL_URB_TX_SIZE		64#define BULK_URB_RX_SIZE		4096#define BULK_URB_TX_SIZE		8192#define MUX_BULK_RX_BUF_SIZE		HSO_MAX_MTU#define MUX_BULK_TX_BUF_SIZE		HSO_MAX_MTU#define MUX_BULK_RX_BUF_COUNT		4#define USB_TYPE_OPTION_VENDOR		0x20/* These definitions are used with the struct hso_net flags element *//* - use *_bit operations on it. (bit indices not values.) */#define HSO_NET_RUNNING			0#define	HSO_NET_TX_TIMEOUT		(HZ*10)#define HSO_SERIAL_MAGIC		0x48534f31/* Number of ttys to handle */#define HSO_SERIAL_TTY_MINORS		256#define MAX_RX_URBS			2/*****************************************************************************//* kernel dependent declarations                                             *//*****************************************************************************/#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20))#define TERMIOS				termios#define GFP_T				int#define CALLBACK_ARGS			struct urb *urb, struct pt_regs *regs#else	/* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)) */#define TERMIOS				ktermios#define GFP_T				gfp_t#define CALLBACK_ARGS			struct urb *urb#endif	/* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)) */static inline struct hso_serial *get_serial_by_tty(struct tty_struct *tty){	if (tty)		return tty->driver_data;	return NULL;}/*****************************************************************************//* Debugging functions                                                       *//*****************************************************************************/#define D__(lvl_, fmt, arg...)				\	do {						\		printk(lvl_ "[%d:%s]: " fmt "\n",	\		       __LINE__, __func__, ## arg);	\	} while (0)#define D_(lvl, args...)				\	do {						\		if (lvl & debug)			\			D__(KERN_INFO, args);		\	} while (0)#define D1(args...)	D_(0x01, ##args)#define D2(args...)	D_(0x02, ##args)#define D3(args...)	D_(0x04, ##args)#define D4(args...)	D_(0x08, ##args)#define D5(args...)	D_(0x10, ##args)/*****************************************************************************//* Enumerators                                                               *//*****************************************************************************/enum pkt_parse_state {	WAIT_IP,	WAIT_DATA,	WAIT_SYNC};/*****************************************************************************//* Structs                                                                   *//*****************************************************************************/struct hso_shared_int {	struct usb_endpoint_descriptor *intr_endp;	void *shared_intr_buf;	struct urb *shared_intr_urb;	struct usb_device *usb;	int use_count;	int ref_count;	struct MUTEX shared_int_lock;};#define NETDEVICE_HAS_STATS  (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22))struct hso_net {	struct hso_device *parent;#if (!NETDEVICE_HAS_STATS)	struct net_device_stats	stats;#endif	struct net_device *net;#if HAVE_RFKILL	struct rfkill *rfkill;#endif	struct usb_endpoint_descriptor *in_endp;	struct usb_endpoint_descriptor *out_endp;	struct urb *mux_bulk_rx_urb_pool[MUX_BULK_RX_BUF_COUNT];	struct urb *mux_bulk_tx_urb;	void *mux_bulk_rx_buf_pool[MUX_BULK_RX_BUF_COUNT];	void *mux_bulk_tx_buf;	struct sk_buff *skb_rx_buf;	struct sk_buff *skb_tx_buf;	enum pkt_parse_state rx_parse_state;	spinlock_t net_lock;	unsigned short rx_buf_size;	unsigned short rx_buf_missing;	struct iphdr rx_ip_hdr;	unsigned long flags;};#if NETDEVICE_HAS_STATS#define STATS(net) ((net)->stats)#else#define STATS(net) (((struct hso_net *)netdev_priv(net))->stats)#endif#define HAVE_TTY_INSERT_FLIP_STRING \(LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16))#define HAVE_LDISC_OPS  (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16))enum rx_ctrl_state{	RX_IDLE,	RX_SENT,	RX_PENDING};#define BM_REQUEST_TYPE (0xa1)#define B_NOTIFICATION  (0x20)#define W_VALUE         (0x0)#define W_INDEX         (0x2)#define W_LENGTH        (0x2)#define B_OVERRUN       (0x1<<6)#define B_PARITY        (0x1<<5)#define B_FRAMING       (0x1<<4)#define B_RING_SIGNAL   (0x1<<3)#define B_BREAK         (0x1<<2)#define B_TX_CARRIER    (0x1<<1)#define B_RX_CARRIER    (0x1<<0)struct hso_serial_state_notification {	u8 bmRequestType;	u8 bNotification;	u16 wValue;	u16 wIndex;	u16 wLength;	u16 UART_state_bitmap;} __attribute__((packed));struct hso_tiocmget {	struct MUTEX mutex;	wait_queue_head_t waitq;	int    intr_completed;	struct usb_endpoint_descriptor *endp;	struct urb *urb;	struct hso_serial_state_notification serial_state_notification;	u16    prev_UART_state_bitmap;	struct uart_icount icount;};struct hso_serial {	struct hso_device *parent;	int magic;	u8 minor;	struct hso_shared_int *shared_int;	/* rx/tx urb could be either a bulk urb or a control urb depending	   on which serial port it is used on. */	struct urb *rx_urb[MAX_RX_URBS];	u8 num_rx_urbs;	u8 *rx_data[MAX_RX_URBS];	u16 rx_data_length;	/* should contain allocated length */	struct urb *tx_urb;	u8 *tx_data;	u8 *tx_buffer;	u16 tx_data_length;	/* should contain allocated length */	u16 tx_data_count;	u16 tx_buffer_count;	struct usb_ctrlrequest ctrl_req_tx;	struct usb_ctrlrequest ctrl_req_rx;	struct usb_endpoint_descriptor *in_endp;	struct usb_endpoint_descriptor *out_endp;	enum rx_ctrl_state rx_state;	u8 rts_state;	u8 dtr_state;	unsigned tx_urb_used:1;	/* from usb_serial_port */	struct tty_struct *tty;	int open_count;	spinlock_t serial_lock;	int (*write_data) (struct hso_serial *serial);        /* Hacks required to get flow control	 * working on the serial receive buffers	 * so as not to drop characters on the floor.         */	int  curr_rx_urb_idx;	u16  curr_rx_urb_offset;	u8   rx_urb_filled[MAX_RX_URBS];	struct tasklet_struct unthrottle_tasklet;	struct hso_tiocmget  *tiocmget;};struct hso_mutex_t {	struct MUTEX mutex;	u8 allocated;};struct hso_device {	union {		struct hso_serial *dev_serial;		struct hso_net *dev_net;	} port_data;	u32 port_spec;	u8 usb_gone;#ifdef CONFIG_HSO_AUTOPM	u8 is_active;	struct work_struct async_get_intf;	struct work_struct async_put_intf;#endif	struct usb_device *usb;	struct usb_interface *interface;	struct device *dev;	struct kref ref;	struct hso_mutex_t *mutex;};/* Type of interface */#define HSO_INTF_MASK		0xFF00#define	HSO_INTF_MUX		0x0100#define	HSO_INTF_BULK   	0x0200/* Type of port */#define HSO_PORT_MASK		0xFF#define HSO_PORT_NO_PORT	0x0#define	HSO_PORT_CONTROL	0x1#define	HSO_PORT_APP		0x2#define	HSO_PORT_GPS		0x3#define	HSO_PORT_PCSC		0x4#define	HSO_PORT_APP2		0x5#define HSO_PORT_GPS_CONTROL	0x6#define HSO_PORT_MSD		0x7#define HSO_PORT_VOICE		0x8#define HSO_PORT_DIAG2		0x9#define	HSO_PORT_DIAG		0x10#define	HSO_PORT_MODEM		0x11#define	HSO_PORT_NETWORK	0x12/* Additional device info */#define HSO_INFO_MASK		0xFF000000#define HSO_INFO_CRC_BUG	0x01000000/*****************************************************************************//* Prototypes                                                                *//*****************************************************************************//* Serial driver functions */static int hso_serial_tiocmset(struct tty_struct *tty, struct file *file,			       unsigned int set, unsigned int clear);static void ctrl_callback(CALLBACK_ARGS);static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial);static void hso_kick_transmit(struct hso_serial *serial);/* Helper functions */static int hso_mux_submit_intr_urb(struct hso_shared_int *mux_int,				   struct usb_device *usb, GFP_T gfp);static void log_usb_status(int status, const char *function);static struct usb_endpoint_descriptor *hso_get_ep(struct usb_interface *intf,						  int type, int dir);static int hso_get_mux_ports(struct usb_interface *intf, unsigned char *ports);static void hso_free_interface(struct usb_interface *intf);static int hso_start_serial_device(struct hso_device *hso_dev, GFP_T flags);static int hso_stop_serial_device(struct hso_device *hso_dev);static int hso_start_net_device(struct hso_device *hso_dev);static void hso_free_shared_int(struct hso_shared_int *shared_int);static int hso_stop_net_device(struct hso_device *hso_dev);static void hso_serial_ref_free(struct kref *ref);static void hso_std_serial_read_bulk_callback(CALLBACK_ARGS);static int hso_mux_serial_read(struct hso_serial *serial);#ifdef CONFIG_HSO_AUTOPMstatic void async_get_intf(struct work_struct *data);static void async_put_intf(struct work_struct *data);static int hso_put_activity(struct hso_device *hso_dev);static int hso_get_activity(struct hso_device *hso_dev);#endifstatic void tiocmget_intr_callback(CALLBACK_ARGS);/*****************************************************************************//* Helping functions                                                         *//*****************************************************************************/static inline struct hso_net *dev2net(struct hso_device *hso_dev){	return hso_dev->port_data.dev_net;}static inline struct hso_serial *dev2ser(struct hso_device *hso_dev){	return hso_dev->port_data.dev_serial;}#if  (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 23))#define safe_usb_unlink_urb usb_unlink_urb#define safe_usb_kill_urb   usb_kill_urb#elsestatic void safe_usb_unlink_urb(struct urb *urb){	if (!urb)

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品一区二区三区在线| 精品欧美一区二区三区精品久久 | 国产欧美综合在线观看第十页| 99re亚洲国产精品| 麻豆一区二区三| 一区二区三区波多野结衣在线观看| 日韩一级大片在线观看| 色综合夜色一区| 国产精品一卡二卡| 美女一区二区视频| 亚洲成人免费在线| 亚洲三级免费电影| 国产日韩v精品一区二区| 国产精品久久一级| 欧美电视剧免费观看| 亚洲国产成人va在线观看天堂| 国产99一区视频免费| 日韩精品乱码免费| 亚洲三级免费电影| 中文字幕在线观看不卡| 久久久久久久久久久电影| 91精品国产综合久久福利| 欧美三级乱人伦电影| 91在线视频在线| 成人av动漫网站| 不卡一区二区三区四区| 国产一区二区精品久久| 老司机午夜精品| 奇米精品一区二区三区在线观看| 一区二区三区欧美激情| 最新久久zyz资源站| 国产精品嫩草影院com| 国产欧美综合色| 国产精品私人影院| 欧美国产日本韩| 国产精品女主播av| 欧美国产精品一区二区三区| 久久久久久久久久久久久女国产乱| 欧美sm极限捆绑bd| 精品国产免费视频| 26uuu亚洲| 久久精品一区蜜桃臀影院| 久久综合九色综合97婷婷女人| 精品999在线播放| 亚洲精品一区在线观看| 精品国产乱码久久久久久浪潮| 欧美tk—视频vk| 久久精品一区二区三区av| 久久久国产精华| 国产精品久久久久婷婷二区次| 国产精品理伦片| 亚洲欧美另类图片小说| 亚洲自拍偷拍网站| 五月天久久比比资源色| 美女看a上一区| 国产在线播精品第三| 粉嫩蜜臀av国产精品网站| 97国产精品videossex| 91国偷自产一区二区使用方法| 欧美日韩国产经典色站一区二区三区| 欧美精品第一页| 欧美mv日韩mv亚洲| 国产精品毛片大码女人| 一区二区三区成人| 人禽交欧美网站| 国产98色在线|日韩| 91福利国产精品| 日韩一区二区三区视频| 国产三级精品三级在线专区| 亚洲三级久久久| 青青草国产精品亚洲专区无| 国产精品99久| 一本大道久久a久久综合婷婷| 欧美精品一卡两卡| 久久久久久久性| 亚洲一区二区三区小说| 久久国产欧美日韩精品| 成人av网站大全| 欧美一区二区黄色| 国产精品久久久一本精品| 日日摸夜夜添夜夜添亚洲女人| 欧美视频在线播放| 日韩精品一区二区三区蜜臀| 亚洲欧洲三级电影| 麻豆精品视频在线观看| 不卡欧美aaaaa| 欧美一区二区免费视频| 亚洲视频图片小说| 美女被吸乳得到大胸91| av亚洲精华国产精华精华| 欧美一区二区三区成人| 亚洲人午夜精品天堂一二香蕉| 日本美女一区二区| 99riav一区二区三区| 精品国产免费久久| 一区二区三区日韩精品视频| 国产成人综合在线播放| 欧美精选一区二区| 一区二区在线电影| 国产精品18久久久久久久网站| 欧美日韩一级视频| 国产精品久久看| 国产毛片精品视频| 欧美日韩国产片| 成人免费视频在线观看| 精品夜夜嗨av一区二区三区| 欧美日韩久久不卡| 亚洲手机成人高清视频| 国产精品亚洲一区二区三区妖精| 欧美日韩亚洲另类| 亚洲男人天堂av| 成a人片国产精品| 国产亚洲精品精华液| 麻豆精品一区二区三区| 欧美麻豆精品久久久久久| 亚洲免费在线视频一区 二区| 国产福利一区在线| 精品噜噜噜噜久久久久久久久试看| 一区二区三区日本| 色婷婷av一区| 亚洲日本乱码在线观看| 大白屁股一区二区视频| 久久精品水蜜桃av综合天堂| 久久国产综合精品| 精品欧美一区二区三区精品久久 | 国产亚洲精品精华液| 精品一区二区三区在线视频| 91精品国产综合久久香蕉麻豆| 亚洲黄色片在线观看| 色综合色综合色综合色综合色综合 | 不卡一卡二卡三乱码免费网站| 久久久精品免费网站| 国产在线国偷精品免费看| 精品国产三级电影在线观看| 美女视频一区二区三区| 精品久久久久久最新网址| 久久不见久久见免费视频7| 日韩精品自拍偷拍| 精品中文字幕一区二区小辣椒 | 91精品在线一区二区| 青草av.久久免费一区| 69久久夜色精品国产69蝌蚪网| 亚洲福利视频三区| 欧洲亚洲精品在线| 亚洲123区在线观看| 欧美日本国产视频| 美国十次综合导航| 精品粉嫩aⅴ一区二区三区四区| 国产曰批免费观看久久久| 欧美激情一区在线观看| 91麻豆国产福利精品| 一区二区免费在线播放| 欧美精品久久久久久久多人混战| 首页国产欧美久久| 精品国产乱码久久| 成人午夜在线播放| 一区二区不卡在线播放| 精品视频资源站| 精品一区二区三区影院在线午夜| 久久久精品中文字幕麻豆发布| 成人午夜免费视频| 亚洲亚洲人成综合网络| 日韩精品一区二区三区swag | 色综合久久中文字幕综合网| 亚洲第一福利视频在线| 精品1区2区在线观看| 成人免费高清视频在线观看| 亚洲一级不卡视频| 精品国产亚洲一区二区三区在线观看 | 国产日韩精品视频一区| 91色.com| 久久精品99国产国产精| 国产精品免费aⅴ片在线观看| 欧美中文字幕亚洲一区二区va在线| 天堂蜜桃91精品| 亚洲国产精品激情在线观看| 在线亚洲人成电影网站色www| 日本不卡一二三区黄网| 国产精品久久久久久久久晋中 | www.亚洲免费av| 午夜视频一区二区三区| 久久久久九九视频| 色噜噜狠狠色综合中国| 麻豆91免费看| 亚洲欧美日韩在线不卡| 欧美成人激情免费网| 一本色道久久综合狠狠躁的推荐| 奇米色一区二区| 一区二区三区在线观看国产| 精品成人免费观看| 在线观看日韩国产| 国产黑丝在线一区二区三区| 成人免费高清在线| 美美哒免费高清在线观看视频一区二区 | 国产伦精品一区二区三区在线观看| 亚洲激情中文1区| 欧美高清在线视频| 欧美一级欧美一级在线播放| 在线免费观看日本一区| 国产伦精一区二区三区|