Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

555 lines
20 KiB

  1. // port.h - serial port stuff
  2. // 5-13-99 - enable RTS toggling for VS
  3. // 3-20-98 add NEW_Q stuff, turned off for now - kpb
  4. // following defines the port queue sizes for in/out going data between
  5. // box and us. See Qin, Qout structs in SerPort structs.
  6. #define IN_BUF_SIZE 2000 // must match box code, and be even #
  7. #define OUT_BUF_SIZE 2000 // must match box code, and be even #
  8. // uncomment this for new-q tracking code
  9. #define NEW_Q
  10. #ifdef NEW_Q
  11. // following is less the rocketport-hardware buffer in the box
  12. #define REMOTE_IN_BUF_SIZE (2000 - 256)
  13. #endif
  14. #define PORTS_MAX_PORTS_PER_DEVICE 64
  15. //-------- sub-packet type byte header defines for type ASYNC_FRAME
  16. #define RK_QIN_STATUS 0x60 // qin status report
  17. #define RK_DATA_BLK 0x61 // data block
  18. #define RK_PORT_SET 0x62 // set the port num to work with
  19. #define RK_CONTROL_SET 0x63 // config the hardware
  20. #define RK_MCR_SET 0x64 // change on modem control reg.
  21. #define RK_MSR_SET 0x65 // change on modem status reg.
  22. #define RK_ACTION_SET 0x66 // new actions, such as flush.
  23. #define RK_ACTION_ACK 0x67 // response to actions, such as flush.
  24. #define RK_BAUD_SET 0x70 // set the baud rate
  25. #define RK_SPECIAL_CHAR_SET 0x71 // xon,xoff, err-replace, event-match
  26. #define RK_ESR_SET 0x72 // set error status register.
  27. #define RK_CONNECT_CHECK 0xfd // server packet to check link is working
  28. #define RK_CONNECT_REPLY 0xfe // reply from RK_CONNECT_ASK
  29. #define RK_CONNECT_ASK 0xff // broadcast from server to get report from boxes
  30. //------ old ssci.h stuff
  31. #define TRUE 1
  32. #define FALSE 0
  33. //#define RX_HIWATER 512 /* sw input flow ctl high water mark */
  34. //#define RX_LOWATER 256 /* sw input flow ctl low water mark */
  35. #define OFF 0
  36. #define ON 1
  37. #define NOCHANGE 2
  38. //Status
  39. /* Open type and TX and RX identifier flags (unsigned int) */
  40. #define COM_OPEN 0x0001 /* device open */
  41. #define COM_TX 0x0002 /* transmit */
  42. #define COM_RX 0x0004 /* receive */
  43. typedef struct
  44. {
  45. BYTE rx_xon; // xon sent by us to resume rx flow, default to 11H
  46. BYTE rx_xoff; // xoff sent by us to halt rx flow, default to 13H
  47. BYTE tx_xon; // xon rec. by us to resume tx flow, default to 11H
  48. BYTE tx_xoff; // xoff rec. by us to halt tx flow, default to 13H
  49. BYTE error; // in NT, option to replace error-chars with this char
  50. BYTE event; // in NT, can specify a event-char to match and notify
  51. } Special_Chars;
  52. // for NT, we want to keep this DWORD aligned, so NT and DOS see same struct
  53. typedef struct
  54. {
  55. //WORD dev; // handle index to com port, same as COM#(# part)
  56. //WORD LanIndex; // index of port number to LAN
  57. WORD Status; // we use as internal status indicator
  58. WORD control_settings; // parity, stopbits, databits, flowcontrol
  59. WORD old_control_settings; // used to detect change
  60. DWORD baudrate;
  61. DWORD old_baudrate; // used to detect change
  62. WORD mcr_value; // modem control register state
  63. WORD old_mcr_value; // used to detect change
  64. WORD change_flags; // tells what might have changed and needs transfer to remote
  65. WORD msr_value; // modem status register state
  66. WORD old_msr_value; // used to detect change
  67. WORD action_reg; // action(one-shot) functions:flush, etc.
  68. WORD esr_reg; // error status register state(framing err, parity err,,)
  69. // one shot style register(resets on read)
  70. // The following Q structures are in perspective of the LAN.
  71. // So QOut is the Que for data which is destined for the remote
  72. // client over the LAN. QIn is data we received from the LAN.
  73. Queue QOut;
  74. Queue QIn;
  75. #ifdef NEW_Q
  76. // How much data can we send over to the remote?
  77. // new method which can include hardware tx buffer space and
  78. // does not rely on set queue sizes.
  79. WORD nPutRemote; // tx data we sent to remote, Modulo 0x10000.
  80. WORD nGetRemote; // tx data remote cleared out, Modulo 0x10000.
  81. // this value is sent to us as an update.
  82. WORD nGetLocal; // tx data we cleared out, Modulo 0x10000.
  83. // we send back as an update.
  84. #else
  85. // How much data can we send over to the remote? We can calculate
  86. // this by maintaining a mirror image of its Q data structure.
  87. // We maintain the Q.Put index, and the remote side sends us its
  88. // actual Q.Get value when it changes. Then when we want to
  89. // calculate the room left in the remote queue(this includes anything
  90. // in transit.) we just do the normal queue arithmetic.
  91. // there is no actual data buffer used in this queue structure.
  92. Queue QInRemote;
  93. #endif
  94. WORD remote_status;
  95. Special_Chars sp_chars; // special chars struct: xon, xoff..
  96. Special_Chars last_sp_chars; // used to detect when we need to send
  97. } SerPort;
  98. //----- change_flags bit assignments
  99. // tells what has changed and needs transfer to remote
  100. #define CHG_SP_CHARS 0x0001
  101. #define CHG_BAUDRATE 0x0002
  102. //----- Mirror Register bit flags, these are associated with fields in
  103. // the SerPort struct, and get mirrored back/forth to the box to transfer
  104. // state of the port.
  105. // values for Status(SerPort)
  106. #define S_OPENED 0x0001
  107. #define S_UPDATE_ROOM 0x0002
  108. #define S_NEED_CODE_UPDATE 0x0800
  109. // control_settings, control settings
  110. #define SC_STOPBITS_MASK 0x0001
  111. #define SC_STOPBITS_1 0x0000
  112. #define SC_STOPBITS_2 0x0001
  113. #define SC_DATABITS_MASK 0x0002
  114. #define SC_DATABITS_7 0x0002
  115. #define SC_DATABITS_8 0x0000
  116. #define SC_PARITY_MASK 0x000c
  117. #define SC_PARITY_NONE 0x0000
  118. #define SC_PARITY_EVEN 0x0004
  119. #define SC_PARITY_ODD 0x0008
  120. #define SC_FLOW_RTS_MASK 0x0070
  121. #define SC_FLOW_RTS_NONE 0x0000
  122. #define SC_FLOW_RTS_AUTO 0x0010
  123. #define SC_FLOW_RTS_RS485 0x0020 // rts turn on to transmit
  124. #define SC_FLOW_RTS_ARS485 0x0040 // rts turn off to transmit(auto-rocketport)
  125. #define SC_FLOW_CTS_MASK 0x0080
  126. #define SC_FLOW_CTS_NONE 0x0000
  127. #define SC_FLOW_CTS_AUTO 0x0080
  128. #define SC_FLOW_DTR_MASK 0x0100
  129. #define SC_FLOW_DTR_NONE 0x0000
  130. #define SC_FLOW_DTR_AUTO 0x0100
  131. #define SC_FLOW_DSR_MASK 0x0200
  132. #define SC_FLOW_DSR_NONE 0x0000
  133. #define SC_FLOW_DSR_AUTO 0x0200
  134. #define SC_FLOW_CD_MASK 0x0400
  135. #define SC_FLOW_CD_NONE 0x0000
  136. #define SC_FLOW_CD_AUTO 0x0400
  137. #define SC_FLOW_XON_TX_AUTO 0x0800
  138. #define SC_FLOW_XON_RX_AUTO 0x1000
  139. #define SC_NULL_STRIP 0x2000
  140. // mcr_value, settings(modem control reg.)
  141. #define MCR_RTS_SET_MASK 0x0001
  142. #define MCR_RTS_SET_ON 0x0001
  143. #define MCR_RTS_SET_OFF 0x0000
  144. #define MCR_DTR_SET_MASK 0x0002
  145. #define MCR_DTR_SET_ON 0x0002
  146. #define MCR_DTR_SET_OFF 0x0000
  147. // loop in rocketport asic chip
  148. #define MCR_LOOP_SET_MASK 0x0004
  149. #define MCR_LOOP_SET_ON 0x0004
  150. #define MCR_LOOP_SET_OFF 0x0000
  151. #define MCR_BREAK_SET_MASK 0x0008
  152. #define MCR_BREAK_SET_ON 0x0008
  153. #define MCR_BREAK_SET_OFF 0x0000
  154. // msr_value, settings(modem status reg.)
  155. #define MSR_TX_FLOWED_OFF 0x0001
  156. #define MSR_CD_ON 0x0008
  157. #define MSR_DSR_ON 0x0010
  158. #define MSR_CTS_ON 0x0020
  159. #define MSR_RING_ON 0x0040
  160. #define MSR_BREAK_ON 0x0080
  161. //#define MSR_TX_FLOW_OFF_DTR 0x0040
  162. //#define MSR_TX_FLOW_OFF_XOFF 0x0080
  163. //-- action control register bit flags(server event out to device)
  164. #define ACT_FLUSH_INPUT 0x0001
  165. #define ACT_FLUSH_OUTPUT 0x0002
  166. #define ACT_SET_TX_XOFF 0x0004
  167. #define ACT_CLEAR_TX_XOFF 0x0008
  168. #define ACT_SEND_RX_XON 0x0010
  169. #define ACT_SEND_RX_XOFF 0x0020
  170. #define ACT_MODEM_RESET 0x0040
  171. //-- error status register bit flags
  172. #define ESR_FRAME_ERROR 0x0001
  173. #define ESR_PARITY_ERROR 0x0002
  174. #define ESR_OVERFLOW_ERROR 0x0004
  175. #define ESR_BREAK_ERROR 0x0008
  176. //-- event control register bit flags(device event reported to server)
  177. #define ST_INIT 0
  178. #define ST_GET_OWNERSHIP 1
  179. #define ST_SENDCODE 2
  180. #define ST_CONNECT 3
  181. #define ST_ACTIVE 4
  182. // following for trace or dump messages, make public for other mods as well.
  183. char *port_state_str[];
  184. typedef struct {
  185. Nic *nic; // ptr to our NIC card handler
  186. Hdlc *hd; // ptr to our HDLC struct handler
  187. SerPort *sp[PORTS_MAX_PORTS_PER_DEVICE]; // ptr to list of our sp objects(num_ports worth)
  188. int unique_id; // unique id assigned to this device
  189. int backup_server; // 1=this is a backup server,0=primary server
  190. int backup_timer; // 1=backup server timer used to detect how long to
  191. // wait before attempting to acquire the box
  192. int load_timer; // our load_timer, incr. every time in port_poll compared
  193. // against backup_timer for when to load box
  194. int nic_index; // index of nic card
  195. int num_ports; // num ports on this box
  196. //int sp_index; // index into total SerPort array
  197. int state; // state for state-machine
  198. int old_state; // old state, used to detect state changes and reset timer
  199. WORD state_timer; // our state_timer, incr. every time in port_poll
  200. WORD Status; // misc. bit flags
  201. int last_round_robin; // used to cycle service of ports evenly
  202. ULONG code_cnt; // used to upload code(marks position in upload data)
  203. WORD code_state; // 1=signals port poll code to send next chunk
  204. WORD reload_errors; // count of ialive failures
  205. WORD timer_base; // used to time port_state_handler
  206. WORD total_loads; // statistics
  207. WORD good_loads; // statistics
  208. WORD ownership_timer; // check timer due to hosed up ownership logic
  209. } PortMan; // port manager
  210. // values for Status(PortMan)
  211. #define S_SERVER 0x0001
  212. #define S_CHECK_LINK 0x0002
  213. #define S_NEED_CODE_UPDATE 0x0800
  214. void port_state_handler(PortMan *pm);
  215. int port_set_new_mac_addr(PortMan *pm, BYTE *box_addr);
  216. int portman_init(Hdlc *hd,
  217. PortMan *pm,
  218. int num_ports,
  219. int unique_id,
  220. int backup_server,
  221. int backup_timer,
  222. BYTE *box_addr);
  223. int port_init(SerPort *sp);
  224. int port_close(SerPort *sp);
  225. int port_poll(PortMan *pm);
  226. void port_debug_scr(PortMan *pm, char *outbuf);
  227. int portman_close(PortMan *pm);
  228. void PortFlushTx(SerPort *p);
  229. void PortFlushRx(SerPort *p);
  230. int PortSetBaudRate(SerPort *p,
  231. ULONG desired_baud,
  232. USHORT SetHardware,
  233. DWORD clock_freq,
  234. DWORD clk_prescaler);
  235. WORD PortGetTxCntRemote(SerPort *p);
  236. #define PortGetTxCnt(p) (q_count(&p->QOut))
  237. // int PortGetTxCnt(SerPort *p)
  238. // { return q_count(&p->QOut); }
  239. #define PortGetTxRoom(p) (q_room(&p->QOut))
  240. #define PortGetRxCnt(p) (q_count(&p->QIn))
  241. // return q_count(&p->QIn);
  242. #define pIsTxFlowedOff(p) ((p)->msr_value & MSR_TX_FLOWED_OFF)
  243. #define pEnLocalLoopback(p) \
  244. { (p)->mcr_value |= MCR_LOOP_SET_MASK; }
  245. #define pDisLocalLoopback(p) \
  246. { (p)->mcr_value &= ~MCR_LOOP_SET_MASK; }
  247. #define pSetBreak(p) \
  248. { (p)->mcr_value |= MCR_BREAK_SET_ON; }
  249. #define pClrBreak(p) \
  250. { (p)->mcr_value &= ~MCR_BREAK_SET_ON; }
  251. #define pSetDTR(p) \
  252. {(p)->mcr_value |= MCR_DTR_SET_ON;}
  253. #define pClrDTR(p) \
  254. {(p)->mcr_value &= ~MCR_DTR_SET_ON;}
  255. #define pSetRTS(p) \
  256. {(p)->mcr_value |= MCR_RTS_SET_ON;}
  257. #define pClrRTS(p) \
  258. {(p)->mcr_value &= ~MCR_RTS_SET_ON;}
  259. #define pEnRTSToggleLow(p) \
  260. { (p)->control_settings &= ~SC_FLOW_RTS_MASK; \
  261. (p)->control_settings |= SC_FLOW_RTS_ARS485; }
  262. #define pEnRTSToggleHigh(p) \
  263. { (p)->control_settings &= ~SC_FLOW_RTS_MASK; \
  264. (p)->control_settings |= SC_FLOW_RTS_RS485; }
  265. #define pEnDTRFlowCtl(p) \
  266. { (p)->control_settings &= ~SC_FLOW_DTR_AUTO; \
  267. (p)->control_settings |= SC_FLOW_DTR_AUTO; }
  268. #define pDisDTRFlowCtl(p) \
  269. { (p)->control_settings &= ~SC_FLOW_DTR_AUTO; }
  270. #define pEnCDFlowCtl(p) \
  271. { (p)->control_settings |= SC_FLOW_CD_AUTO; }
  272. #define pDisCDFlowCtl(p) \
  273. { (p)->control_settings &= ~SC_FLOW_CD_AUTO; }
  274. #define pEnDSRFlowCtl(p) \
  275. { (p)->control_settings |= SC_FLOW_DSR_AUTO; }
  276. #define pDisDSRFlowCtl(p) \
  277. { (p)->control_settings &= ~SC_FLOW_DSR_AUTO; }
  278. #define pEnRTSFlowCtl(p) \
  279. { (p)->control_settings &= ~SC_FLOW_RTS_MASK; \
  280. (p)->control_settings |= SC_FLOW_RTS_AUTO; \
  281. (p)->mcr_value |= MCR_RTS_SET_ON; }
  282. #define pDisRTSFlowCtl(p) \
  283. { (p)->control_settings &= ~SC_FLOW_RTS_MASK; }
  284. #define pDisRTSToggle(p) \
  285. { (p)->control_settings &= ~SC_FLOW_RTS_MASK; }
  286. #define pEnCTSFlowCtl(p) \
  287. { (p)->control_settings |= SC_FLOW_CTS_AUTO; }
  288. #define pDisCTSFlowCtl(p) \
  289. { (p)->control_settings &= ~SC_FLOW_CTS_AUTO; }
  290. #define pEnNullStrip(p) \
  291. { (p)->control_settings |= SC_NULL_STRIP; }
  292. #define pDisNullStrip(p) \
  293. { (p)->control_settings &= ~SC_NULL_STRIP; }
  294. #define pSetXOFFChar(p,c) \
  295. { (p)->sp_chars.rx_xoff = (c); \
  296. (p)->sp_chars.tx_xoff = (c); \
  297. (p)->change_flags |= CHG_SP_CHARS; }
  298. #define pSetXONChar(p,c) \
  299. { (p)->sp_chars.rx_xon = (c); \
  300. (p)->sp_chars.tx_xon = (c); \
  301. (p)->change_flags |= CHG_SP_CHARS; }
  302. #define pSetTxXOFFChar(p,c) \
  303. { (p)->sp_chars.tx_xoff = (c); \
  304. (p)->change_flags |= CHG_SP_CHARS; }
  305. #define pSetTxXONChar(p,c) \
  306. { (p)->sp_chars.tx_xon = (c); \
  307. (p)->change_flags |= CHG_SP_CHARS; }
  308. #define pSetRxXOFFChar(p,c) \
  309. { (p)->sp_chars.rx_xoff = (c); \
  310. (p)->change_flags |= CHG_SP_CHARS; }
  311. #define pSetRxXONChar(p,c) \
  312. { (p)->sp_chars.rx_xon = (c); \
  313. (p)->change_flags |= CHG_SP_CHARS; }
  314. #define pSetErrorChar(p,c) \
  315. { (p)->sp_chars.error = (c); \
  316. (p)->change_flags |= CHG_SP_CHARS; }
  317. #define pSetEventChar(p,c) \
  318. { (p)->sp_chars.event = (c); \
  319. (p)->change_flags |= CHG_SP_CHARS; }
  320. #define pEnRxSoftFlowCtl(p) \
  321. { (p)->control_settings |= SC_FLOW_XON_RX_AUTO; }
  322. #define pDisRxSoftFlowCtl(p) \
  323. { (p)->control_settings &= ~SC_FLOW_XON_RX_AUTO; }
  324. #define pEnTxSoftFlowCtl(p) \
  325. { (p)->control_settings |= SC_FLOW_XON_TX_AUTO; }
  326. #define pDisTxSoftFlowCtl(p) \
  327. { (p)->control_settings &= ~SC_FLOW_XON_TX_AUTO; }
  328. #define pSetStop2(p) \
  329. { (p)->control_settings |= SC_STOPBITS_2; }
  330. #define pSetStop1(p) \
  331. { (p)->control_settings &= ~SC_STOPBITS_2; }
  332. #define pSetOddParity(p) \
  333. { (p)->control_settings &= ~SC_PARITY_MASK; \
  334. (p)->control_settings |= SC_PARITY_ODD; }
  335. #define pSetEvenParity(p) \
  336. { (p)->control_settings &= ~SC_PARITY_MASK; \
  337. (p)->control_settings |= SC_PARITY_EVEN; }
  338. #define pDisParity(p) \
  339. { (p)->control_settings &= ~SC_PARITY_MASK; }
  340. #define pSetData8(p) \
  341. { (p)->control_settings &= ~SC_DATABITS_7; }
  342. #define pSetData7(p) \
  343. { (p)->control_settings |= SC_DATABITS_7; }
  344. //--- action_reg macros
  345. #define pModemReset(p) \
  346. { (p)->action_reg |= ACT_MODEM_RESET; }
  347. #define pFlushInput(p) \
  348. { (p)->action_reg |= ACT_FLUSH_INPUT; }
  349. #define pFlushOutput(p) \
  350. { (p)->action_reg |= ACT_FLUSH_OUTPUT; }
  351. #define pOverrideClearXoff(p) \
  352. { (p)->action_reg |= ACT_CLEAR_TX_XOFF; }
  353. #define pOverrideSetXoff(p) \
  354. { (p)->action_reg |= ACT_SET_TX_XOFF; }
  355. //------- questionable stuff, untidy, thrown in to make compile
  356. //Status
  357. /* Open type and TX and RX identifier flags (unsigned int) */
  358. #define COM_OPEN 0x0001 /* device open */
  359. #define COM_TX 0x0002 /* transmit */
  360. #define COM_RX 0x0004 /* receive */
  361. //Status
  362. /* Flow control flags (unsigned int) */
  363. #define COM_FLOW_NONE 0x0000
  364. #define COM_FLOW_IS 0x0008 /* input software flow control */
  365. #define COM_FLOW_IH 0x0010 /* input hardware flow control */
  366. #define COM_FLOW_OS 0x0020 /* output software flow control */
  367. #define COM_FLOW_OH 0x0040 /* output hardware flow control */
  368. #define COM_FLOW_OXANY 0x0080 /* restart output on any Rx char */
  369. #define COM_RXFLOW_ON 0x0100 /* Rx data flow is ON */
  370. #define COM_TXFLOW_ON 0x0200 /* Tx data flow is ON */
  371. //Status ... State flags
  372. #define COM_REQUEST_BREAK 0x0400
  373. /* Modem control flags (unsigned char) */
  374. #define COM_MDM_RTS 0x02 /* request to send */
  375. #define COM_MDM_DTR 0x04 /* data terminal ready */
  376. #define COM_MDM_CD CD_ACT /* carrier detect (0x08) */
  377. #define COM_MDM_DSR DSR_ACT /* data set ready (0x10) */
  378. #define COM_MDM_CTS CTS_ACT /* clear to send (0x20) */
  379. /* Stop bit flags (unsigned char) */
  380. #define COM_STOPBIT_1 0x01 /* 1 stop bit */
  381. #define COM_STOPBIT_2 0x02 /* 2 stop bits */
  382. /* Data bit flags (unsigned char) */
  383. #define COM_DATABIT_7 0x01 /* 7 data bits */
  384. #define COM_DATABIT_8 0x02 /* 8 data bits */
  385. /* Parity flags (unsigned char) */
  386. #define COM_PAR_NONE 0x00 /* no parity */
  387. #define COM_PAR_EVEN 0x02 /* even parity */
  388. #define COM_PAR_ODD 0x01 /* odd parity */
  389. /* Detection enable flags (unsigned int) */
  390. #define COM_DEN_NONE 0 /* no event detection enabled */
  391. #define COM_DEN_MDM 0x0001 /* enable modem control change detection */
  392. #define COM_DEN_RDA 0x0002 /* enable Rx data available detection */
  393. /*---- 20-2FH Direct - Channel Status Reg. */
  394. #define CTS_ACT 0x20 /* CTS input asserted */
  395. #define DSR_ACT 0x10 /* DSR input asserted */
  396. #define CD_ACT 0x08 /* CD input asserted */
  397. #define TXFIFOMT 0x04 /* Tx FIFO is empty */
  398. #define TXSHRMT 0x02 /* Tx shift register is empty */
  399. #define RDA 0x01 /* Rx data available */
  400. #define DRAINED (TXFIFOMT | TXSHRMT) /* indicates Tx is drained */
  401. #define STATMODE 0x8000 /* status mode enable bit */
  402. #define RXFOVERFL 0x2000 /* receive FIFO overflow */
  403. #define RX2MATCH 0x1000 /* receive compare byte 2 match */
  404. #define RX1MATCH 0x0800 /* receive compare byte 1 match */
  405. #define RXBREAK 0x0400 /* received BREAK */
  406. #define RXFRAME 0x0200 /* received framing error */
  407. #define RXPARITY 0x0100 /* received parity error */
  408. #define STATERROR (RXBREAK | RXFRAME | RXPARITY)
  409. /* channel data register stat mode status byte (high byte of word read) */
  410. #define STMBREAK 0x08 /* BREAK */
  411. #define STMFRAME 0x04 /* framing error */
  412. #define STMRCVROVR 0x02 /* receiver over run error */
  413. #define STMPARITY 0x01 /* parity error */
  414. #define STMERROR (STMBREAK | STMFRAME | STMPARITY)
  415. #define STMBREAKH 0x800 /* BREAK */
  416. #define STMFRAMEH 0x400 /* framing error */
  417. #define STMRCVROVRH 0x200 /* receiver over run error */
  418. #define STMPARITYH 0x100 /* parity error */
  419. #define STMERRORH (STMBREAKH | STMFRAMEH | STMPARITYH)
  420. #define CTS_ACT 0x20 /* CTS input asserted */
  421. #define DSR_ACT 0x10 /* DSR input asserted */
  422. #define CD_ACT 0x08 /* CD input asserted */
  423. #define TXFIFOMT 0x04 /* Tx FIFO is empty */
  424. #define TXSHRMT 0x02 /* Tx shift register is empty */
  425. #define RDA 0x01 /* Rx data available */
  426. #define DRAINED (TXFIFOMT | TXSHRMT) /* indicates Tx is drained */
  427. /* interrupt ID register */
  428. #define RXF_TRIG 0x20 /* Rx FIFO trigger level interrupt */
  429. #define TXFIFO_MT 0x10 /* Tx FIFO empty interrupt */
  430. #define SRC_INT 0x08 /* special receive condition interrupt */
  431. #define DELTA_CD 0x04 /* CD change interrupt */
  432. #define DELTA_CTS 0x02 /* CTS change interrupt */
  433. #define DELTA_DSR 0x01 /* DSR change interrupt */
  434. //------- END questionable stuff, untidy, thrown in to make compile
  435. #define DEF_VS_PRESCALER 0x14 /* div 5 prescale, max 460800 baud(NO 50baud!) */
  436. #define DEF_VS_CLOCKRATE 36864000
  437. #define DEF_RHUB_PRESCALER 0x14
  438. #define DEF_RHUB_CLOCKRATE 18432000