⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mct_u232.h

📁 基于S3CEB2410平台LINUX操作系统下 USB驱动源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * Definitions for MCT (Magic Control Technology) USB-RS232 Converter Driver * *   Copyright (C) 2000 Wolfgang Grandegger (wolfgang@ces.ch) * *   This program is free software; you can redistribute it and/or modify *   it under the terms of the GNU General Public License as published by *   the Free Software Foundation; either version 2 of the License, or *   (at your option) any later version. * * This driver is for the device MCT USB-RS232 Converter (25 pin, Model No. * U232-P25) from Magic Control Technology Corp. (there is also a 9 pin * Model No. U232-P9). See http://www.mct.com.tw/p_u232.html for further * information. The properties of this device are listed at the end of this * file. This device is available from various distributors. I know Hana, * http://www.hana.de and D-Link, http://www.dlink.com/products/usb/dsbs25. * * All of the information about the device was acquired by using SniffUSB * on Windows98. The technical details of the reverse engineering are * summarized at the end of this file. */#ifndef __LINUX_USB_SERIAL_MCT_U232_H#define __LINUX_USB_SERIAL_MCT_U232_H#define MCT_U232_VID	                0x0711	/* Vendor Id */#define MCT_U232_PID	                0x0210	/* Original MCT Product Id *//* U232-P25, Sitecom */#define MCT_U232_SITECOM_PID		0x0230	/* Sitecom Product Id *//* DU-H3SP USB BAY hub */#define MCT_U232_DU_H3SP_PID		0x0200	/* D-Link DU-H3SP USB BAY *//* Belkin badge the MCT U232-P9 as the F5U109 */#define MCT_U232_BELKIN_F5U109_VID	0x050d	/* Vendor Id */#define MCT_U232_BELKIN_F5U109_PID	0x0109	/* Product Id *//* * Vendor Request Interface */#define MCT_U232_SET_REQUEST_TYPE	0x40#define MCT_U232_GET_REQUEST_TYPE	0xc0#define MCT_U232_GET_MODEM_STAT_REQUEST 2  /* Get Modem Status Register (MSR) */#define MCT_U232_GET_MODEM_STAT_SIZE    1#define MCT_U232_GET_LINE_CTRL_REQUEST  6  /* Get Line Control Register (LCR) */#define MCT_U232_GET_LINE_CTRL_SIZE     1  /* ... not used by this driver */#define MCT_U232_SET_BAUD_RATE_REQUEST	5  /* Set Baud Rate Divisor */#define MCT_U232_SET_BAUD_RATE_SIZE     4#define MCT_U232_SET_LINE_CTRL_REQUEST	7  /* Set Line Control Register (LCR) */#define MCT_U232_SET_LINE_CTRL_SIZE     1#define MCT_U232_SET_MODEM_CTRL_REQUEST	10 /* Set Modem Control Register (MCR) */#define MCT_U232_SET_MODEM_CTRL_SIZE    1/* * Baud rate (divisor) */#define MCT_U232_BAUD_RATE(b)		(115200/b)/* * Line Control Register (LCR) */#define MCT_U232_SET_BREAK              0x40#define MCT_U232_PARITY_SPACE		0x38#define MCT_U232_PARITY_MARK		0x28#define MCT_U232_PARITY_EVEN		0x18#define MCT_U232_PARITY_ODD		0x08#define MCT_U232_PARITY_NONE		0x00#define MCT_U232_DATA_BITS_5            0x00#define MCT_U232_DATA_BITS_6            0x01#define MCT_U232_DATA_BITS_7            0x02#define MCT_U232_DATA_BITS_8            0x03#define MCT_U232_STOP_BITS_2            0x04#define MCT_U232_STOP_BITS_1            0x00/* * Modem Control Register (MCR) */#define MCT_U232_MCR_NONE               0x8     /* Deactivate DTR and RTS */#define MCT_U232_MCR_RTS                0xa     /* Activate RTS */#define MCT_U232_MCR_DTR                0x9     /* Activate DTR *//* * Modem Status Register (MSR) */#define MCT_U232_MSR_INDEX              0x0     /* data[index] */#define MCT_U232_MSR_CD                 0x80    /* Current CD */#define MCT_U232_MSR_RI                 0x40    /* Current RI */#define MCT_U232_MSR_DSR                0x20    /* Current DSR */#define MCT_U232_MSR_CTS                0x10    /* Current CTS */#define MCT_U232_MSR_DCD                0x08    /* Delta CD */#define MCT_U232_MSR_DRI                0x04    /* Delta RI */#define MCT_U232_MSR_DDSR               0x02    /* Delta DSR */#define MCT_U232_MSR_DCTS               0x01    /* Delta CTS *//* * Line Status Register (LSR) */#define MCT_U232_LSR_INDEX              1       /* data[index] */#define MCT_U232_LSR_ERR                0x80    /* OE | PE | FE | BI */#define MCT_U232_LSR_TEMT               0x40    /* transmit register empty */#define MCT_U232_LSR_THRE               0x20    /* transmit holding register empty */#define MCT_U232_LSR_BI                 0x10    /* break indicator */#define MCT_U232_LSR_FE                 0x08    /* framing error */#define MCT_U232_LSR_OE                 0x02    /* overrun error */#define MCT_U232_LSR_PE                 0x04    /* parity error */#define MCT_U232_LSR_OE                 0x02    /* overrun error */#define MCT_U232_LSR_DR                 0x01    /* receive data ready *//* ----------------------------------------------------------------------------- * Technical Specification reverse engineered with SniffUSB on Windows98 * ===================================================================== * *  The technical details of the device have been acquired be using "SniffUSB" *  and the vendor-supplied device driver (version 2.3A) under Windows98. To *  identify the USB vendor-specific requests and to assign them to terminal  *  settings (flow control, baud rate, etc.) the program "SerialSettings" from *  William G. Greathouse has been proven to be very useful. I also used the *  Win98 "HyperTerminal" and "usb-robot" on Linux for testing. The results and  *  observations are summarized below: * *  The USB requests seem to be directly mapped to the registers of a 8250, *  16450 or 16550 UART. The FreeBSD handbook (appendix F.4 "Input/Output *  devices") contains a comprehensive description of UARTs and its registers. *  The bit descriptions are actually taken from there. * * * Baud rate (divisor) * ------------------- * *   BmRequestType:  0x4 (0100 0000B) *   bRequest:       0x5 *   wValue:         0x0 *   wIndex:         0x0 *   wLength:        0x4 *   Data:           divisor = 115200 / baud_rate * * * Line Control Register (LCR) * --------------------------- * *  BmRequestType:  0x4 (0100 0000B)    0xc (1100 0000B) *  bRequest:       0x7                 0x6 *  wValue:         0x0 *  wIndex:         0x0 *  wLength:        0x1 *  Data:           LCR (see below) * *  Bit 7: Divisor Latch Access Bit (DLAB). When set, access to the data *  	   transmit/receive register (THR/RBR) and the Interrupt Enable Register *  	   (IER) is disabled. Any access to these ports is now redirected to the *  	   Divisor Latch Registers. Setting this bit, loading the Divisor *  	   Registers, and clearing DLAB should be done with interrupts disabled. *  Bit 6: Set Break. When set to "1", the transmitter begins to transmit *  	   continuous Spacing until this bit is set to "0". This overrides any *  	   bits of characters that are being transmitted. *  Bit 5: Stick Parity. When parity is enabled, setting this bit causes parity *  	   to always be "1" or "0", based on the value of Bit 4. *  Bit 4: Even Parity Select (EPS). When parity is enabled and Bit 5 is "0", *  	   setting this bit causes even parity to be transmitted and expected. *  	   Otherwise, odd parity is used. *  Bit 3: Parity Enable (PEN). When set to "1", a parity bit is inserted *  	   between the last bit of the data and the Stop Bit. The UART will also *  	   expect parity to be present in the received data. *  Bit 2: Number of Stop Bits (STB). If set to "1" and using 5-bit data words, *  	   1.5 Stop Bits are transmitted and expected in each data word. For *  	   6, 7 and 8-bit data words, 2 Stop Bits are transmitted and expected. *  	   When this bit is set to "0", one Stop Bit is used on each data word. *  Bit 1: Word Length Select Bit #1 (WLSB1) *  Bit 0: Word Length Select Bit #0 (WLSB0) *  	   Together these bits specify the number of bits in each data word. *  	     1 0  Word Length *  	     0 0  5 Data Bits *  	     0 1  6 Data Bits *  	     1 0  7 Data Bits *  	     1 1  8 Data Bits * *  SniffUSB observations: Bit 7 seems not to be used. There seem to be two bugs *  in the Win98 driver: the break does not work (bit 6 is not asserted) and the *  sticky parity bit is not cleared when set once. The LCR can also be read *  back with USB request 6 but this has never been observed with SniffUSB. * * * Modem Control Register (MCR) * ---------------------------- * *  BmRequestType:  0x4  (0100 0000B)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -