ftdi_sio.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. /*
  2. * Driver definitions for the FTDI USB Single Port Serial Converter -
  3. * known as FTDI_SIO (Serial Input/Output application of the chipset)
  4. *
  5. * For USB vendor/product IDs (VID/PID), please see ftdi_sio_ids.h
  6. *
  7. *
  8. * The example I have is known as the USC-1000 which is available from
  9. * http://www.dse.co.nz - cat no XH4214 It looks similar to this:
  10. * http://www.dansdata.com/usbser.htm but I can't be sure There are other
  11. * USC-1000s which don't look like my device though so beware!
  12. *
  13. * The device is based on the FTDI FT8U100AX chip. It has a DB25 on one side,
  14. * USB on the other.
  15. *
  16. * Thanx to FTDI (http://www.ftdichip.com) for so kindly providing details
  17. * of the protocol required to talk to the device and ongoing assistence
  18. * during development.
  19. *
  20. * Bill Ryder - bryder@sgi.com formerly of Silicon Graphics, Inc.- wrote the
  21. * FTDI_SIO implementation.
  22. *
  23. */
  24. /* Commands */
  25. #define FTDI_SIO_RESET 0 /* Reset the port */
  26. #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
  27. #define FTDI_SIO_SET_FLOW_CTRL 2 /* Set flow control register */
  28. #define FTDI_SIO_SET_BAUD_RATE 3 /* Set baud rate */
  29. #define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of
  30. the port */
  31. #define FTDI_SIO_GET_MODEM_STATUS 5 /* Retrieve current value of modem
  32. status register */
  33. #define FTDI_SIO_SET_EVENT_CHAR 6 /* Set the event character */
  34. #define FTDI_SIO_SET_ERROR_CHAR 7 /* Set the error character */
  35. #define FTDI_SIO_SET_LATENCY_TIMER 9 /* Set the latency timer */
  36. #define FTDI_SIO_GET_LATENCY_TIMER 10 /* Get the latency timer */
  37. /* Interface indices for FT2232, FT2232H and FT4232H devices */
  38. #define INTERFACE_A 1
  39. #define INTERFACE_B 2
  40. #define INTERFACE_C 3
  41. #define INTERFACE_D 4
  42. /*
  43. * BmRequestType: 1100 0000b
  44. * bRequest: FTDI_E2_READ
  45. * wValue: 0
  46. * wIndex: Address of word to read
  47. * wLength: 2
  48. * Data: Will return a word of data from E2Address
  49. *
  50. */
  51. /* Port Identifier Table */
  52. #define PIT_DEFAULT 0 /* SIOA */
  53. #define PIT_SIOA 1 /* SIOA */
  54. /* The device this driver is tested with one has only one port */
  55. #define PIT_SIOB 2 /* SIOB */
  56. #define PIT_PARALLEL 3 /* Parallel */
  57. /* FTDI_SIO_RESET */
  58. #define FTDI_SIO_RESET_REQUEST FTDI_SIO_RESET
  59. #define FTDI_SIO_RESET_REQUEST_TYPE 0x40
  60. #define FTDI_SIO_RESET_SIO 0
  61. #define FTDI_SIO_RESET_PURGE_RX 1
  62. #define FTDI_SIO_RESET_PURGE_TX 2
  63. /*
  64. * BmRequestType: 0100 0000B
  65. * bRequest: FTDI_SIO_RESET
  66. * wValue: Control Value
  67. * 0 = Reset SIO
  68. * 1 = Purge RX buffer
  69. * 2 = Purge TX buffer
  70. * wIndex: Port
  71. * wLength: 0
  72. * Data: None
  73. *
  74. * The Reset SIO command has this effect:
  75. *
  76. * Sets flow control set to 'none'
  77. * Event char = $0D
  78. * Event trigger = disabled
  79. * Purge RX buffer
  80. * Purge TX buffer
  81. * Clear DTR
  82. * Clear RTS
  83. * baud and data format not reset
  84. *
  85. * The Purge RX and TX buffer commands affect nothing except the buffers
  86. *
  87. */
  88. /* FTDI_SIO_SET_BAUDRATE */
  89. #define FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE 0x40
  90. #define FTDI_SIO_SET_BAUDRATE_REQUEST 3
  91. /*
  92. * BmRequestType: 0100 0000B
  93. * bRequest: FTDI_SIO_SET_BAUDRATE
  94. * wValue: BaudDivisor value - see below
  95. * wIndex: Port
  96. * wLength: 0
  97. * Data: None
  98. * The BaudDivisor values are calculated as follows:
  99. * - BaseClock is either 12000000 or 48000000 depending on the device.
  100. * FIXME: I wish I knew how to detect old chips to select proper base clock!
  101. * - BaudDivisor is a fixed point number encoded in a funny way.
  102. * (--WRONG WAY OF THINKING--)
  103. * BaudDivisor is a fixed point number encoded with following bit weighs:
  104. * (-2)(-1)(13..0). It is a radical with a denominator of 4, so values
  105. * end with 0.0 (00...), 0.25 (10...), 0.5 (01...), and 0.75 (11...).
  106. * (--THE REALITY--)
  107. * The both-bits-set has quite different meaning from 0.75 - the chip
  108. * designers have decided it to mean 0.125 instead of 0.75.
  109. * This info looked up in FTDI application note "FT8U232 DEVICES \ Data Rates
  110. * and Flow Control Consideration for USB to RS232".
  111. * - BaudDivisor = (BaseClock / 16) / BaudRate, where the (=) operation should
  112. * automagically re-encode the resulting value to take fractions into
  113. * consideration.
  114. * As all values are integers, some bit twiddling is in order:
  115. * BaudDivisor = (BaseClock / 16 / BaudRate) |
  116. * (((BaseClock / 2 / BaudRate) & 4) ? 0x4000 // 0.5
  117. * : ((BaseClock / 2 / BaudRate) & 2) ? 0x8000 // 0.25
  118. * : ((BaseClock / 2 / BaudRate) & 1) ? 0xc000 // 0.125
  119. * : 0)
  120. *
  121. * For the FT232BM, a 17th divisor bit was introduced to encode the multiples
  122. * of 0.125 missing from the FT8U232AM. Bits 16 to 14 are coded as follows
  123. * (the first four codes are the same as for the FT8U232AM, where bit 16 is
  124. * always 0):
  125. * 000 - add .000 to divisor
  126. * 001 - add .500 to divisor
  127. * 010 - add .250 to divisor
  128. * 011 - add .125 to divisor
  129. * 100 - add .375 to divisor
  130. * 101 - add .625 to divisor
  131. * 110 - add .750 to divisor
  132. * 111 - add .875 to divisor
  133. * Bits 15 to 0 of the 17-bit divisor are placed in the urb value. Bit 16 is
  134. * placed in bit 0 of the urb index.
  135. *
  136. * Note that there are a couple of special cases to support the highest baud
  137. * rates. If the calculated divisor value is 1, this needs to be replaced with
  138. * 0. Additionally for the FT232BM, if the calculated divisor value is 0x4001
  139. * (1.5), this needs to be replaced with 0x0001 (1) (but this divisor value is
  140. * not supported by the FT8U232AM).
  141. */
  142. enum ftdi_chip_type {
  143. SIO = 1,
  144. FT8U232AM = 2,
  145. FT232BM = 3,
  146. FT2232C = 4,
  147. FT232RL = 5,
  148. FT2232H = 6,
  149. FT4232H = 7,
  150. FT232H = 8,
  151. FTX = 9,
  152. };
  153. enum ftdi_sio_baudrate {
  154. ftdi_sio_b300 = 0,
  155. ftdi_sio_b600 = 1,
  156. ftdi_sio_b1200 = 2,
  157. ftdi_sio_b2400 = 3,
  158. ftdi_sio_b4800 = 4,
  159. ftdi_sio_b9600 = 5,
  160. ftdi_sio_b19200 = 6,
  161. ftdi_sio_b38400 = 7,
  162. ftdi_sio_b57600 = 8,
  163. ftdi_sio_b115200 = 9
  164. };
  165. /*
  166. * The ftdi_8U232AM_xxMHz_byyy constants have been removed. The encoded divisor
  167. * values are calculated internally.
  168. */
  169. #define FTDI_SIO_SET_DATA_REQUEST FTDI_SIO_SET_DATA
  170. #define FTDI_SIO_SET_DATA_REQUEST_TYPE 0x40
  171. #define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8)
  172. #define FTDI_SIO_SET_DATA_PARITY_ODD (0x1 << 8)
  173. #define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8)
  174. #define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8)
  175. #define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8)
  176. #define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11)
  177. #define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11)
  178. #define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11)
  179. #define FTDI_SIO_SET_BREAK (0x1 << 14)
  180. /* FTDI_SIO_SET_DATA */
  181. /*
  182. * BmRequestType: 0100 0000B
  183. * bRequest: FTDI_SIO_SET_DATA
  184. * wValue: Data characteristics (see below)
  185. * wIndex: Port
  186. * wLength: 0
  187. * Data: No
  188. *
  189. * Data characteristics
  190. *
  191. * B0..7 Number of data bits
  192. * B8..10 Parity
  193. * 0 = None
  194. * 1 = Odd
  195. * 2 = Even
  196. * 3 = Mark
  197. * 4 = Space
  198. * B11..13 Stop Bits
  199. * 0 = 1
  200. * 1 = 1.5
  201. * 2 = 2
  202. * B14
  203. * 1 = TX ON (break)
  204. * 0 = TX OFF (normal state)
  205. * B15 Reserved
  206. *
  207. */
  208. /* FTDI_SIO_MODEM_CTRL */
  209. #define FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE 0x40
  210. #define FTDI_SIO_SET_MODEM_CTRL_REQUEST FTDI_SIO_MODEM_CTRL
  211. /*
  212. * BmRequestType: 0100 0000B
  213. * bRequest: FTDI_SIO_MODEM_CTRL
  214. * wValue: ControlValue (see below)
  215. * wIndex: Port
  216. * wLength: 0
  217. * Data: None
  218. *
  219. * NOTE: If the device is in RTS/CTS flow control, the RTS set by this
  220. * command will be IGNORED without an error being returned
  221. * Also - you can not set DTR and RTS with one control message
  222. */
  223. #define FTDI_SIO_SET_DTR_MASK 0x1
  224. #define FTDI_SIO_SET_DTR_HIGH (1 | (FTDI_SIO_SET_DTR_MASK << 8))
  225. #define FTDI_SIO_SET_DTR_LOW (0 | (FTDI_SIO_SET_DTR_MASK << 8))
  226. #define FTDI_SIO_SET_RTS_MASK 0x2
  227. #define FTDI_SIO_SET_RTS_HIGH (2 | (FTDI_SIO_SET_RTS_MASK << 8))
  228. #define FTDI_SIO_SET_RTS_LOW (0 | (FTDI_SIO_SET_RTS_MASK << 8))
  229. /*
  230. * ControlValue
  231. * B0 DTR state
  232. * 0 = reset
  233. * 1 = set
  234. * B1 RTS state
  235. * 0 = reset
  236. * 1 = set
  237. * B2..7 Reserved
  238. * B8 DTR state enable
  239. * 0 = ignore
  240. * 1 = use DTR state
  241. * B9 RTS state enable
  242. * 0 = ignore
  243. * 1 = use RTS state
  244. * B10..15 Reserved
  245. */
  246. /* FTDI_SIO_SET_FLOW_CTRL */
  247. #define FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE 0x40
  248. #define FTDI_SIO_SET_FLOW_CTRL_REQUEST FTDI_SIO_SET_FLOW_CTRL
  249. #define FTDI_SIO_DISABLE_FLOW_CTRL 0x0
  250. #define FTDI_SIO_RTS_CTS_HS (0x1 << 8)
  251. #define FTDI_SIO_DTR_DSR_HS (0x2 << 8)
  252. #define FTDI_SIO_XON_XOFF_HS (0x4 << 8)
  253. /*
  254. * BmRequestType: 0100 0000b
  255. * bRequest: FTDI_SIO_SET_FLOW_CTRL
  256. * wValue: Xoff/Xon
  257. * wIndex: Protocol/Port - hIndex is protocol / lIndex is port
  258. * wLength: 0
  259. * Data: None
  260. *
  261. * hIndex protocol is:
  262. * B0 Output handshaking using RTS/CTS
  263. * 0 = disabled
  264. * 1 = enabled
  265. * B1 Output handshaking using DTR/DSR
  266. * 0 = disabled
  267. * 1 = enabled
  268. * B2 Xon/Xoff handshaking
  269. * 0 = disabled
  270. * 1 = enabled
  271. *
  272. * A value of zero in the hIndex field disables handshaking
  273. *
  274. * If Xon/Xoff handshaking is specified, the hValue field should contain the
  275. * XOFF character and the lValue field contains the XON character.
  276. */
  277. /*
  278. * FTDI_SIO_GET_LATENCY_TIMER
  279. *
  280. * Set the timeout interval. The FTDI collects data from the slave
  281. * device, transmitting it to the host when either A) 62 bytes are
  282. * received, or B) the timeout interval has elapsed and the buffer
  283. * contains at least 1 byte. Setting this value to a small number
  284. * can dramatically improve performance for applications which send
  285. * small packets, since the default value is 16ms.
  286. */
  287. #define FTDI_SIO_GET_LATENCY_TIMER_REQUEST FTDI_SIO_GET_LATENCY_TIMER
  288. #define FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE 0xC0
  289. /*
  290. * BmRequestType: 1100 0000b
  291. * bRequest: FTDI_SIO_GET_LATENCY_TIMER
  292. * wValue: 0
  293. * wIndex: Port
  294. * wLength: 0
  295. * Data: latency (on return)
  296. */
  297. /*
  298. * FTDI_SIO_SET_LATENCY_TIMER
  299. *
  300. * Set the timeout interval. The FTDI collects data from the slave
  301. * device, transmitting it to the host when either A) 62 bytes are
  302. * received, or B) the timeout interval has elapsed and the buffer
  303. * contains at least 1 byte. Setting this value to a small number
  304. * can dramatically improve performance for applications which send
  305. * small packets, since the default value is 16ms.
  306. */
  307. #define FTDI_SIO_SET_LATENCY_TIMER_REQUEST FTDI_SIO_SET_LATENCY_TIMER
  308. #define FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE 0x40
  309. /*
  310. * BmRequestType: 0100 0000b
  311. * bRequest: FTDI_SIO_SET_LATENCY_TIMER
  312. * wValue: Latency (milliseconds)
  313. * wIndex: Port
  314. * wLength: 0
  315. * Data: None
  316. *
  317. * wValue:
  318. * B0..7 Latency timer
  319. * B8..15 0
  320. *
  321. */
  322. /*
  323. * FTDI_SIO_SET_EVENT_CHAR
  324. *
  325. * Set the special event character for the specified communications port.
  326. * If the device sees this character it will immediately return the
  327. * data read so far - rather than wait 40ms or until 62 bytes are read
  328. * which is what normally happens.
  329. */
  330. #define FTDI_SIO_SET_EVENT_CHAR_REQUEST FTDI_SIO_SET_EVENT_CHAR
  331. #define FTDI_SIO_SET_EVENT_CHAR_REQUEST_TYPE 0x40
  332. /*
  333. * BmRequestType: 0100 0000b
  334. * bRequest: FTDI_SIO_SET_EVENT_CHAR
  335. * wValue: EventChar
  336. * wIndex: Port
  337. * wLength: 0
  338. * Data: None
  339. *
  340. * wValue:
  341. * B0..7 Event Character
  342. * B8 Event Character Processing
  343. * 0 = disabled
  344. * 1 = enabled
  345. * B9..15 Reserved
  346. *
  347. */
  348. /* FTDI_SIO_SET_ERROR_CHAR */
  349. /*
  350. * Set the parity error replacement character for the specified communications
  351. * port
  352. */
  353. /*
  354. * BmRequestType: 0100 0000b
  355. * bRequest: FTDI_SIO_SET_EVENT_CHAR
  356. * wValue: Error Char
  357. * wIndex: Port
  358. * wLength: 0
  359. * Data: None
  360. *
  361. *Error Char
  362. * B0..7 Error Character
  363. * B8 Error Character Processing
  364. * 0 = disabled
  365. * 1 = enabled
  366. * B9..15 Reserved
  367. *
  368. */
  369. /* FTDI_SIO_GET_MODEM_STATUS */
  370. /* Retrieve the current value of the modem status register */
  371. #define FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE 0xc0
  372. #define FTDI_SIO_GET_MODEM_STATUS_REQUEST FTDI_SIO_GET_MODEM_STATUS
  373. #define FTDI_SIO_CTS_MASK 0x10
  374. #define FTDI_SIO_DSR_MASK 0x20
  375. #define FTDI_SIO_RI_MASK 0x40
  376. #define FTDI_SIO_RLSD_MASK 0x80
  377. /*
  378. * BmRequestType: 1100 0000b
  379. * bRequest: FTDI_SIO_GET_MODEM_STATUS
  380. * wValue: zero
  381. * wIndex: Port
  382. * wLength: 1
  383. * Data: Status
  384. *
  385. * One byte of data is returned
  386. * B0..3 0
  387. * B4 CTS
  388. * 0 = inactive
  389. * 1 = active
  390. * B5 DSR
  391. * 0 = inactive
  392. * 1 = active
  393. * B6 Ring Indicator (RI)
  394. * 0 = inactive
  395. * 1 = active
  396. * B7 Receive Line Signal Detect (RLSD)
  397. * 0 = inactive
  398. * 1 = active
  399. */
  400. /* Descriptors returned by the device
  401. *
  402. * Device Descriptor
  403. *
  404. * Offset Field Size Value Description
  405. * 0 bLength 1 0x12 Size of descriptor in bytes
  406. * 1 bDescriptorType 1 0x01 DEVICE Descriptor Type
  407. * 2 bcdUSB 2 0x0110 USB Spec Release Number
  408. * 4 bDeviceClass 1 0x00 Class Code
  409. * 5 bDeviceSubClass 1 0x00 SubClass Code
  410. * 6 bDeviceProtocol 1 0x00 Protocol Code
  411. * 7 bMaxPacketSize0 1 0x08 Maximum packet size for endpoint 0
  412. * 8 idVendor 2 0x0403 Vendor ID
  413. * 10 idProduct 2 0x8372 Product ID (FTDI_SIO_PID)
  414. * 12 bcdDevice 2 0x0001 Device release number
  415. * 14 iManufacturer 1 0x01 Index of man. string desc
  416. * 15 iProduct 1 0x02 Index of prod string desc
  417. * 16 iSerialNumber 1 0x02 Index of serial nmr string desc
  418. * 17 bNumConfigurations 1 0x01 Number of possible configurations
  419. *
  420. * Configuration Descriptor
  421. *
  422. * Offset Field Size Value
  423. * 0 bLength 1 0x09 Size of descriptor in bytes
  424. * 1 bDescriptorType 1 0x02 CONFIGURATION Descriptor Type
  425. * 2 wTotalLength 2 0x0020 Total length of data
  426. * 4 bNumInterfaces 1 0x01 Number of interfaces supported
  427. * 5 bConfigurationValue 1 0x01 Argument for SetCOnfiguration() req
  428. * 6 iConfiguration 1 0x02 Index of config string descriptor
  429. * 7 bmAttributes 1 0x20 Config characteristics Remote Wakeup
  430. * 8 MaxPower 1 0x1E Max power consumption
  431. *
  432. * Interface Descriptor
  433. *
  434. * Offset Field Size Value
  435. * 0 bLength 1 0x09 Size of descriptor in bytes
  436. * 1 bDescriptorType 1 0x04 INTERFACE Descriptor Type
  437. * 2 bInterfaceNumber 1 0x00 Number of interface
  438. * 3 bAlternateSetting 1 0x00 Value used to select alternate
  439. * 4 bNumEndpoints 1 0x02 Number of endpoints
  440. * 5 bInterfaceClass 1 0xFF Class Code
  441. * 6 bInterfaceSubClass 1 0xFF Subclass Code
  442. * 7 bInterfaceProtocol 1 0xFF Protocol Code
  443. * 8 iInterface 1 0x02 Index of interface string description
  444. *
  445. * IN Endpoint Descriptor
  446. *
  447. * Offset Field Size Value
  448. * 0 bLength 1 0x07 Size of descriptor in bytes
  449. * 1 bDescriptorType 1 0x05 ENDPOINT descriptor type
  450. * 2 bEndpointAddress 1 0x82 Address of endpoint
  451. * 3 bmAttributes 1 0x02 Endpoint attributes - Bulk
  452. * 4 bNumEndpoints 2 0x0040 maximum packet size
  453. * 5 bInterval 1 0x00 Interval for polling endpoint
  454. *
  455. * OUT Endpoint Descriptor
  456. *
  457. * Offset Field Size Value
  458. * 0 bLength 1 0x07 Size of descriptor in bytes
  459. * 1 bDescriptorType 1 0x05 ENDPOINT descriptor type
  460. * 2 bEndpointAddress 1 0x02 Address of endpoint
  461. * 3 bmAttributes 1 0x02 Endpoint attributes - Bulk
  462. * 4 bNumEndpoints 2 0x0040 maximum packet size
  463. * 5 bInterval 1 0x00 Interval for polling endpoint
  464. *
  465. * DATA FORMAT
  466. *
  467. * IN Endpoint
  468. *
  469. * The device reserves the first two bytes of data on this endpoint to contain
  470. * the current values of the modem and line status registers. In the absence of
  471. * data, the device generates a message consisting of these two status bytes
  472. * every 40 ms
  473. *
  474. * Byte 0: Modem Status
  475. *
  476. * Offset Description
  477. * B0 Reserved - must be 1
  478. * B1 Reserved - must be 0
  479. * B2 Reserved - must be 0
  480. * B3 Reserved - must be 0
  481. * B4 Clear to Send (CTS)
  482. * B5 Data Set Ready (DSR)
  483. * B6 Ring Indicator (RI)
  484. * B7 Receive Line Signal Detect (RLSD)
  485. *
  486. * Byte 1: Line Status
  487. *
  488. * Offset Description
  489. * B0 Data Ready (DR)
  490. * B1 Overrun Error (OE)
  491. * B2 Parity Error (PE)
  492. * B3 Framing Error (FE)
  493. * B4 Break Interrupt (BI)
  494. * B5 Transmitter Holding Register (THRE)
  495. * B6 Transmitter Empty (TEMT)
  496. * B7 Error in RCVR FIFO
  497. *
  498. */
  499. #define FTDI_RS0_CTS (1 << 4)
  500. #define FTDI_RS0_DSR (1 << 5)
  501. #define FTDI_RS0_RI (1 << 6)
  502. #define FTDI_RS0_RLSD (1 << 7)
  503. #define FTDI_RS_DR 1
  504. #define FTDI_RS_OE (1<<1)
  505. #define FTDI_RS_PE (1<<2)
  506. #define FTDI_RS_FE (1<<3)
  507. #define FTDI_RS_BI (1<<4)
  508. #define FTDI_RS_THRE (1<<5)
  509. #define FTDI_RS_TEMT (1<<6)
  510. #define FTDI_RS_FIFO (1<<7)
  511. /*
  512. * OUT Endpoint
  513. *
  514. * This device reserves the first bytes of data on this endpoint contain the
  515. * length and port identifier of the message. For the FTDI USB Serial converter
  516. * the port identifier is always 1.
  517. *
  518. * Byte 0: Line Status
  519. *
  520. * Offset Description
  521. * B0 Reserved - must be 1
  522. * B1 Reserved - must be 0
  523. * B2..7 Length of message - (not including Byte 0)
  524. *
  525. */