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.

681 lines
23 KiB

  1. #if !defined(SPD_CARD_H)
  2. #define SPD_CARD_H
  3. #if DBG
  4. #define SERDIAG1 ((ULONG)0x00000001)
  5. #define SERDIAG2 ((ULONG)0x00000002)
  6. #define SERDIAG3 ((ULONG)0x00000004)
  7. #define SERDIAG4 ((ULONG)0x00000008)
  8. #define SERDIAG5 ((ULONG)0x00000010)
  9. #define SERIRPPATH ((ULONG)0x00000020)
  10. #define SERWARNING ((ULONG)0x00000100)
  11. #define SERINFO ((ULONG)0x00000200)
  12. #define SERFLOW ((ULONG)0x00000400)
  13. #define SERERRORS ((ULONG)0x00000800)
  14. #define SERBUGCHECK ((ULONG)0x00001000)
  15. // -- OXSER Diag 3 --
  16. // Additional debug levels
  17. #define PCIINFO ((ULONG)0x00002000)
  18. #define XTLINFO ((ULONG)0x00004000)
  19. #define ISRINFO ((ULONG)0x00008000)
  20. #define TXINFO ((ULONG)0x00010000)
  21. #define RXINFO ((ULONG)0x00020000)
  22. #define LSINFO ((ULONG)0x00040000)
  23. #define MSINFO ((ULONG)0x00080000)
  24. #define KICKINFO ((ULONG)0x00100000)
  25. #define FIFOINFO ((ULONG)0x00200000)
  26. #define CLOSE_STATS ((ULONG)0x00400000)
  27. #define BAUDINFO ((ULONG)0x00800000)
  28. extern ULONG SpxDebugLevel;
  29. #define SerialDump(LEVEL,STRING) \
  30. do { \
  31. ULONG _level = (LEVEL); \
  32. if (SpxDebugLevel & _level) { \
  33. DbgPrint STRING; \
  34. } \
  35. if (_level == SERBUGCHECK) { \
  36. ASSERT(FALSE); \
  37. } \
  38. } while (0)
  39. #else
  40. #define SerialDump(LEVEL,STRING) do {NOTHING;} while (0)
  41. #endif
  42. // For the above directory, the serial port will
  43. // use the following name as the suffix of the serial
  44. // ports for that directory. It will also append
  45. // a number onto the end of the name. That number
  46. // will start at 1.
  47. #define DEFAULT_SERIAL_NAME L"COM"
  48. // This define gives the default NT name for
  49. // for serial ports detected by the firmware.
  50. // This name will be appended to Device prefix
  51. // with a number following it. The number is
  52. // incremented each time encounter a serial
  53. // port detected by the firmware. Note that
  54. // on a system with multiple busses, this means
  55. // that the first port on a bus is not necessarily
  56. // \Device\Serial0.
  57. //
  58. #define DEFAULT_NT_SUFFIX L"Serial"
  59. // Default xon/xoff characters.
  60. #define SERIAL_DEF_XON 0x11
  61. #define SERIAL_DEF_XOFF 0x13
  62. // Reasons that recption may be held up.
  63. #define SERIAL_RX_DTR ((ULONG)0x01)
  64. #define SERIAL_RX_XOFF ((ULONG)0x02)
  65. #define SERIAL_RX_RTS ((ULONG)0x04)
  66. #define SERIAL_RX_DSR ((ULONG)0x08)
  67. // Reasons that transmission may be held up.
  68. #define SERIAL_TX_CTS ((ULONG)0x01)
  69. #define SERIAL_TX_DSR ((ULONG)0x02)
  70. #define SERIAL_TX_DCD ((ULONG)0x04)
  71. #define SERIAL_TX_XOFF ((ULONG)0x08)
  72. #define SERIAL_TX_BREAK ((ULONG)0x10)
  73. //////////////////////////////////////////////////////////////////////////////////////////
  74. // SPEED Port Device Extenstion.
  75. // Information specific to SPEED Ports.
  76. //////////////////////////////////////////////////////////////////////////////////////////
  77. typedef struct _PORT_DEVICE_EXTENSION
  78. {
  79. COMMON_PORT_DEVICE_EXTENSION; // Common Card Device Extension
  80. ULONG SysPortNumber; // System port number
  81. // Timing variables...
  82. LARGE_INTEGER IntervalTime; // Read interval time
  83. LARGE_INTEGER ShortIntervalAmount; // Short tread interval time
  84. LARGE_INTEGER LongIntervalAmount; // Long read interval time
  85. LARGE_INTEGER CutOverAmount; // Used to determine short/long interval time
  86. LARGE_INTEGER LastReadTime; // System time of last read
  87. PLARGE_INTEGER IntervalTimeToUse; // Interval timing delta time delay
  88. // Queued IRP lists...
  89. LIST_ENTRY ReadQueue; // Head of read IRP list, protected by cancel spinlock
  90. LIST_ENTRY WriteQueue; // Head of write IRP list, protected by cancel spinlock
  91. LIST_ENTRY MaskQueue; // Head of set/wait mask IRP list, protected by cancel spinlock
  92. LIST_ENTRY PurgeQueue; // Head of purge IRP list, protected by cancel spinlock
  93. // Current IRPs...
  94. PIRP CurrentReadIrp; // Pointer to current read IRP
  95. PIRP CurrentWriteIrp; // Pointer to current write IRP
  96. PIRP CurrentMaskIrp; // Pointer to current mask IRP
  97. PIRP CurrentPurgeIrp; // Pointer to current purge IRP
  98. PIRP CurrentWaitIrp; // Pointer to current wait IRP
  99. PIRP CurrentImmediateIrp; // Pointer to current send immediate IRP
  100. PIRP CurrentXoffIrp; // Pointer to current XOFF_COUNTER IRP
  101. // Write IRP variables...
  102. ULONG WriteLength; // Write character count in current write IRP
  103. PUCHAR WriteCurrentChar; // Pointer to write character in current write IRP
  104. // Read IRP variables...
  105. PUCHAR InterruptReadBuffer; // Read buffer current pointer in current read IRP
  106. PUCHAR ReadBufferBase; // Read buffer base pointer in current read IRP
  107. ULONG CharsInInterruptBuffer; // Characters read into read buffer
  108. // KSPIN_LOCK BufferLock; // Spinlock protecting "CharsInInterruptBuffer"
  109. PUCHAR CurrentCharSlot; // Pointer at space to store new read data
  110. PUCHAR LastCharSlot; // Last valid position in read buffer
  111. PUCHAR FirstReadableChar; // First read character in read buffer
  112. ULONG BufferSize; // Read buffer size
  113. ULONG BufferSizePt8; // 80% read buffer size
  114. ULONG NumberNeededForRead; // Number of characters requested in current read IRP
  115. // Mask IRP variables...
  116. ULONG IsrWaitMask; // Wait mask in current wait IRP
  117. ULONG HistoryMask; // History of masked events
  118. ULONG *IrpMaskLocation; // Pointer to mask location
  119. // Serial port configuration...
  120. // ULONG CurrentBaud; // Current baud rate
  121. ULONG SupportedBauds; // Bitmask defining supported baud rates
  122. SERIAL_HANDFLOW HandFlow; // Current handshaking and flow control settings
  123. UCHAR LineControl; // Current parity,databits,stopbits
  124. SERIAL_CHARS SpecialChars; // Current Special error/replacement characters
  125. SERIAL_TIMEOUTS Timeouts; // Read and write timeouts
  126. UCHAR ValidDataMask; // Read data mask
  127. UCHAR EscapeChar; // Escape character used with line/modem status strings
  128. // BOOLEAN InsertEscChar; // Indicates of EscapeChar should be inserted
  129. // Serial port status...
  130. LONG CountSinceXoff; // Nun chars read since XOFF counter started
  131. ULONG CountOfTryingToLowerRTS;// Count of processes trying to lower RTS
  132. BOOLEAN TransmitImmediate; // Indicates of transmit immediate is pending
  133. BOOLEAN EmptiedTransmit; // Indicates transmit empty
  134. UCHAR ImmediateChar; // Character to be transmitted immediately
  135. ULONG TXHolding; // Reasons for transmit blocked
  136. ULONG RXHolding; // Reasons for receive blocked
  137. ULONG ErrorWord; // Error conditions
  138. ULONG TotalCharsQueued; // Total number of queued characters in all write IRPs
  139. LONG CountOnLastRead; // Number of chars read last time interval timer DPC ran
  140. ULONG ReadByIsr; // Number of characters read during ISR
  141. KSPIN_LOCK ControlLock; // Used to protect certain fields
  142. // Deferred procedure calls...
  143. KDPC CompleteWriteDpc; // DPC used to complete write IRPs
  144. KDPC CompleteReadDpc; // DPC used to complete read IRPs
  145. KDPC TotalReadTimeoutDpc; // DPC used to handle read total timeout
  146. KDPC IntervalReadTimeoutDpc; // DPC used to handle read interval timeout
  147. KDPC TotalWriteTimeoutDpc; // DPC used to handle write total timeout
  148. KDPC CommErrorDpc; // DPC used to handle cancel on error
  149. KDPC CommWaitDpc; // DPC used to handle waking IRPs waiting on an event
  150. KDPC CompleteImmediateDpc; // DPC used to handle transmitting an immediate character
  151. KDPC TotalImmediateTimeoutDpc; // DPC used to handle immediate char timeout
  152. KDPC XoffCountTimeoutDpc; // DPC used to handle XOFF_COUNT timeout
  153. KDPC XoffCountCompleteDpc; // DPC used to complete XOFF_COUNT IRP
  154. KDPC StartTimerLowerRTSDpc; // DPC used to check for RTS lowering
  155. KDPC PerhapsLowerRTSDpc; // DPC used to check for RTS lowering
  156. // Timers...
  157. KTIMER ReadRequestTotalTimer; // Timer used to handle total read request timeout
  158. KTIMER ReadRequestIntervalTimer; // Timer used to handle interval read timeout
  159. KTIMER WriteRequestTotalTimer; // Timer used to handle total write request timeout
  160. KTIMER ImmediateTotalTimer; // Timer used to handle send immediate timeout
  161. KTIMER XoffCountTimer; // Timer used to handle XOFF_COUNT timeout
  162. KTIMER LowerRTSTimer; // Timer used to handle lower RTS timing
  163. PUART_LIB pUartLib; // Uart library finctions.
  164. PUART_OBJECT pUart;
  165. UART_CONFIG UartConfig;
  166. BOOLEAN DTR_Set;
  167. BOOLEAN RTS_Set;
  168. SET_BUFFER_SIZES BufferSizes;
  169. DWORD MaxTxFIFOSize; // Max Tx FIFO Size.
  170. DWORD MaxRxFIFOSize; // Max Rx FIFO Size.
  171. DWORD TxFIFOSize; // Tx FIFO Size.
  172. DWORD RxFIFOSize; // Rx FIFO Size.
  173. DWORD TxFIFOTrigLevel; // Tx FIFO Trigger Level.
  174. DWORD RxFIFOTrigLevel; // Rx FIFO Trigger Level.
  175. DWORD HiFlowCtrlThreshold; // High Flow Control Threshold.
  176. DWORD LoFlowCtrlThreshold; // Low Flow Control Threshold.
  177. #ifdef WMI_SUPPORT
  178. SPX_SPEED_WMI_FIFO_PROP SpeedWmiFifoProp;
  179. #endif
  180. BYTE ImmediateIndex;
  181. // This holds the isr that should be called from our own
  182. // dispatching isr for "cards" that are trying to share the
  183. // same interrupt.
  184. PKSERVICE_ROUTINE TopLevelOurIsr;
  185. // This holds the context that should be used when we
  186. // call the above service routine.
  187. PVOID TopLevelOurIsrContext;
  188. // This links together all of the different "cards" that are
  189. // trying to share the same interrupt of a non-mca machine.
  190. LIST_ENTRY TopLevelSharers;
  191. // This circular doubly linked list links together all
  192. // devices that are using the same interrupt object.
  193. // NOTE: This does not mean that they are using the
  194. // same interrupt "dispatching" routine.
  195. LIST_ENTRY CommonInterruptObject;
  196. // For reporting resource usage, we keep around the physical
  197. // address we got from the registry.
  198. PHYSICAL_ADDRESS OriginalController;
  199. // For reporting resource usage, we keep around the physical
  200. // address we got from the registry.
  201. PHYSICAL_ADDRESS OriginalInterruptStatus;
  202. // This points to the object directory that we will place
  203. // a symbolic link to our device name.
  204. UNICODE_STRING ObjectDirectory;
  205. // This points to the device name for this device
  206. // sans device prefix.
  207. UNICODE_STRING NtNameForPort;
  208. // After initialization of the driver is complete, this
  209. // will either be NULL or point to the routine that the
  210. // kernel will call when an interrupt occurs.
  211. // If the pointer is null then this is part of a list
  212. // of ports that are sharing an interrupt and this isn't
  213. // the first port that we configured for this interrupt.
  214. // If the pointer is non-null then this routine has some
  215. // kind of structure that will "eventually" get us into
  216. // the real serial isr with a pointer to this device extension.
  217. // NOTE: On an MCA bus (except for multiport cards) this
  218. // is always a pointer to the "real" serial isr.
  219. PKSERVICE_ROUTINE OurIsr;
  220. // This will generally point right to this device extension.
  221. //
  222. // However, when the port that this device extension is
  223. // "managing" was the first port initialized on a chain
  224. // of ports that were trying to share an interrupt, this
  225. // will point to a structure that will enable dispatching
  226. // to any port on the chain of sharers of this interrupt.
  227. PVOID OurIsrContext;
  228. // The base address for the set of device registers
  229. // of the serial port.
  230. PUCHAR Controller;
  231. // The base address for interrupt status register.
  232. // This is only defined in the root extension.
  233. PUCHAR InterruptStatus;
  234. // Points to the interrupt object for used by this device.
  235. PKINTERRUPT Interrupt;
  236. // Pointer to the lock variable returned for this extension when
  237. // locking down the driver
  238. PVOID LockPtr;
  239. // This value holds the span (in units of bytes) of the register
  240. // set controlling this port. This is constant over the life
  241. // of the port.
  242. ULONG SpanOfController;
  243. // This value holds the span (in units of bytes) of the interrupt
  244. // status register associated with this port. This is constant
  245. // over the life of the port.
  246. ULONG SpanOfInterruptStatus;
  247. // Hold the clock rate input to the serial part.
  248. ULONG ClockRate;
  249. // The number of characters to push out if a fifo is present.
  250. ULONG TxFifoAmount;
  251. // Set to indicate that it is ok to share interrupts within the device.
  252. ULONG PermitShare;
  253. // Set at intialization to indicate that on the current
  254. // architecture we need to unmap the base register address
  255. // when we unload the driver.
  256. BOOLEAN UnMapRegisters;
  257. // Set at intialization to indicate that on the current
  258. // architecture we need to unmap the interrupt status address
  259. // when we unload the driver.
  260. BOOLEAN UnMapStatus;
  261. // This is only accessed at interrupt level. It keeps track
  262. // of whether the holding register is empty.
  263. BOOLEAN HoldingEmpty;
  264. // This simply indicates that the port associated with this
  265. // extension is part of a multiport card.
  266. BOOLEAN PortOnAMultiportCard;
  267. // We keep the following values around so that we can connect
  268. // to the interrupt and report resources after the configuration
  269. // record is gone.
  270. ULONG Vector;
  271. KIRQL Irql;
  272. ULONG OriginalVector;
  273. ULONG OriginalIrql;
  274. KINTERRUPT_MODE InterruptMode;
  275. KAFFINITY ProcessorAffinity;
  276. ULONG AddressSpace;
  277. ULONG BusNumber;
  278. INTERFACE_TYPE InterfaceType;
  279. // These two booleans are used to indicate to the isr transmit
  280. // code that it should send the xon or xoff character. They are
  281. // only accessed at open and at interrupt level.
  282. BOOLEAN SendXonChar;
  283. BOOLEAN SendXoffChar;
  284. // This boolean will be true if a 16550 is present *and* enabled.
  285. BOOLEAN FifoPresent;
  286. // -- OXSER Mod 12 --
  287. // The Jensen does not interest us and all references to it have been
  288. // removed
  289. // This denotes that this particular port is an on the motherboard
  290. // port for the Jensen hardware. On these ports the OUT2 bit
  291. // which is used to enable/disable interrupts is always hight.
  292. // BOOLEAN Jensen;
  293. // This is the water mark that the rxfifo should be
  294. // set to when the fifo is turned on. This is not the actual
  295. // value, but the encoded value that goes into the register.
  296. UCHAR RxFifoTrigger;
  297. // Says whether this device can share interrupts with devices
  298. // other than serial devices.
  299. BOOLEAN InterruptShareable;
  300. } PORT_DEVICE_EXTENSION, *PPORT_DEVICE_EXTENSION;
  301. // PORT_DEVICE_EXTENSION.CountOnLastRead definitions...
  302. #define SERIAL_COMPLETE_READ_CANCEL ((LONG)-1)
  303. #define SERIAL_COMPLETE_READ_TOTAL ((LONG)-2)
  304. #define SERIAL_COMPLETE_READ_COMPLETE ((LONG)-3)
  305. // PORT_DEVICE_EXTENSION.LineControl definitions...
  306. #define SERIAL_5_DATA ((UCHAR)0x00)
  307. #define SERIAL_6_DATA ((UCHAR)0x01)
  308. #define SERIAL_7_DATA ((UCHAR)0x02)
  309. #define SERIAL_8_DATA ((UCHAR)0x03)
  310. #define SERIAL_DATA_MASK ((UCHAR)0x03)
  311. #define SERIAL_1_STOP ((UCHAR)0x00)
  312. #define SERIAL_1_5_STOP ((UCHAR)0x04) // Only valid for 5 data bits
  313. #define SERIAL_2_STOP ((UCHAR)0x04) // Not valid for 5 data bits
  314. #define SERIAL_STOP_MASK ((UCHAR)0x04)
  315. #define SERIAL_NONE_PARITY ((UCHAR)0x00)
  316. #define SERIAL_ODD_PARITY ((UCHAR)0x08)
  317. #define SERIAL_EVEN_PARITY ((UCHAR)0x18)
  318. #define SERIAL_MARK_PARITY ((UCHAR)0x28)
  319. #define SERIAL_SPACE_PARITY ((UCHAR)0x38)
  320. #define SERIAL_PARITY_MASK ((UCHAR)0x38)
  321. #define SERIAL_LCR_BREAK 0x40
  322. // PORT_DEVICE_EXTENSION.SpecialChars default xon/xoff characters...
  323. #define SERIAL_DEF_XON 0x11
  324. #define SERIAL_DEF_XOFF 0x13
  325. // PORT_DEVICE_EXTENSION.TXHolding definitions...
  326. #define SERIAL_TX_CTS ((ULONG)0x01)
  327. #define SERIAL_TX_DSR ((ULONG)0x02)
  328. #define SERIAL_TX_DCD ((ULONG)0x04)
  329. #define SERIAL_TX_XOFF ((ULONG)0x08)
  330. #define SERIAL_TX_BREAK ((ULONG)0x10)
  331. // PORT_DEVICE_EXTENSION.RXHolding definitions...
  332. #define SERIAL_RX_DTR ((ULONG)0x01)
  333. #define SERIAL_RX_XOFF ((ULONG)0x02)
  334. #define SERIAL_RX_RTS ((ULONG)0x04)
  335. #define SERIAL_RX_DSR ((ULONG)0x08)
  336. #define SERIAL_RX_FULL ((ULONG)0x10) // VIV: If Io8 Rx queue is full.
  337. // PORT_DEVICE_EXTENSION.LastStatus definitions...
  338. #define SERIAL_LSR_DR 0x01
  339. #define SERIAL_LSR_OE 0x02
  340. #define SERIAL_LSR_PE 0x04
  341. #define SERIAL_LSR_FE 0x08
  342. #define SERIAL_LSR_BI 0x10
  343. // 16550 Modem Control Register definitions...
  344. #define SERIAL_MCR_DTR 0x01
  345. #define SERIAL_MCR_RTS 0x02
  346. // 16550 Modem Status Register definitions...
  347. #define SERIAL_MSR_DCTS 0x01
  348. #define SERIAL_MSR_DDSR 0x02
  349. #define SERIAL_MSR_TERI 0x04
  350. #define SERIAL_MSR_DDCD 0x08
  351. #define SERIAL_MSR_CTS 0x10
  352. #define SERIAL_MSR_DSR 0x20
  353. #define SERIAL_MSR_RI 0x40
  354. #define SERIAL_MSR_DCD 0x80
  355. // These masks define the interrupts that can be enabled or disabled.
  356. //
  357. // This interrupt is used to notify that there is new incomming
  358. // data available. The SERIAL_RDA interrupt is enabled by this bit.
  359. #define SERIAL_IER_RDA 0x01
  360. // This interrupt is used to notify that there is space available
  361. // in the transmitter for another character. The SERIAL_THR
  362. // interrupt is enabled by this bit.
  363. #define SERIAL_IER_THR 0x02
  364. // This interrupt is used to notify that some sort of error occured
  365. // with the incomming data. The SERIAL_RLS interrupt is enabled by
  366. // this bit.
  367. #define SERIAL_IER_RLS 0x04
  368. // This interrupt is used to notify that some sort of change has
  369. // taken place in the modem control line. The SERIAL_MS interrupt is
  370. // enabled by this bit.
  371. #define SERIAL_IER_MS 0x08
  372. // These masks define the values of the interrupt identification
  373. // register. The low bit must be clear in the interrupt identification
  374. // register for any of these interrupts to be valid. The interrupts
  375. // are defined in priority order, with the highest value being most
  376. // important. See above for a description of what each interrupt
  377. // implies.
  378. #define SERIAL_IIR_RLS 0x06
  379. #define SERIAL_IIR_RDA 0x04
  380. #define SERIAL_IIR_CTI 0x0c
  381. #define SERIAL_IIR_THR 0x02
  382. #define SERIAL_IIR_MS 0x00
  383. // This bit mask get the value of the high two bits of the
  384. // interrupt id register. If this is a 16550 class chip
  385. // these bits will be a one if the fifo's are enbled, otherwise
  386. // they will always be zero.
  387. #define SERIAL_IIR_FIFOS_ENABLED 0xc0
  388. // If the low bit is logic one in the interrupt identification register
  389. // this implies that *NO* interrupts are pending on the device.
  390. #define SERIAL_IIR_NO_INTERRUPT_PENDING 0x01
  391. // These masks define access to the fifo control register.
  392. // Enabling this bit in the fifo control register will turn
  393. // on the fifos. If the fifos are enabled then the high two
  394. // bits of the interrupt id register will be set to one. Note
  395. // that this only occurs on a 16550 class chip. If the high
  396. // two bits in the interrupt id register are not one then
  397. // we know we have a lower model chip.
  398. #define SERIAL_FCR_ENABLE ((UCHAR)0x01)
  399. #define SERIAL_FCR_RCVR_RESET ((UCHAR)0x02)
  400. #define SERIAL_FCR_TXMT_RESET ((UCHAR)0x04)
  401. // This set of values define the high water marks (when the
  402. // interrupts trip) for the receive fifo.
  403. #define SERIAL_1_BYTE_HIGH_WATER ((UCHAR)0x00)
  404. #define SERIAL_4_BYTE_HIGH_WATER ((UCHAR)0x40)
  405. #define SERIAL_8_BYTE_HIGH_WATER ((UCHAR)0x80)
  406. #define SERIAL_14_BYTE_HIGH_WATER ((UCHAR)0xc0)
  407. // This defines the bit used to control the definition of the "first"
  408. // two registers for the 8250. These registers are the input/output
  409. // register and the interrupt enable register. When the DLAB bit is
  410. // enabled these registers become the least significant and most
  411. // significant bytes of the divisor value.
  412. #define SERIAL_LCR_DLAB 0x80
  413. // This bit is used for general purpose output.
  414. #define SERIAL_MCR_OUT1 0x04
  415. // This bit is used for general purpose output.
  416. #define SERIAL_MCR_OUT2 0x08
  417. // This bit controls the loopback testing mode of the device. Basically
  418. // the outputs are connected to the inputs (and vice versa).
  419. #define SERIAL_MCR_LOOP 0x10
  420. // This is the transmit holding register empty indicator. It is set
  421. // to indicate that the hardware is ready to accept another character
  422. // for transmission. This bit is cleared whenever a character is
  423. // written to the transmit holding register.
  424. #define SERIAL_LSR_THRE 0x20
  425. // This bit is the transmitter empty indicator. It is set whenever the
  426. // transmit holding buffer is empty and the transmit shift register
  427. // (a non-software accessable register that is used to actually put
  428. // the data out on the wire) is empty. Basically this means that all
  429. // data has been sent. It is cleared whenever the transmit holding or
  430. // the shift registers contain data.
  431. #define SERIAL_LSR_TEMT 0x40
  432. // This bit indicates that there is at least one error in the fifo.
  433. // The bit will not be turned off until there are no more errors
  434. // in the fifo.
  435. #define SERIAL_LSR_FIFOERR 0x80
  436. //
  437. // This should be more than enough space to hold then
  438. // numeric suffix of the device name.
  439. //
  440. #define DEVICE_NAME_DELTA 20
  441. //
  442. // Up to 16 Ports Per card. However for sixteen
  443. // port cards the interrupt status register must be
  444. // the indexing kind rather then the bitmask kind.
  445. //
  446. #define SERIAL_MAX_PORTS_INDEXED (16)
  447. #define SERIAL_MAX_PORTS_NONINDEXED (8)
  448. //////////////////////////////////////////////////////////////////////////////////////////
  449. // SPEED Card Device Extenstion.
  450. // Information specific to SPEED cards.
  451. //////////////////////////////////////////////////////////////////////////////////////////
  452. typedef struct _CARD_DEVICE_EXTENSION
  453. {
  454. COMMON_CARD_DEVICE_EXTENSION; // Common Card Device Extension
  455. ULONG CrystalFrequency; // Frequency of onboard crystal
  456. PHYSICAL_ADDRESS PCIConfigRegisters;
  457. ULONG SpanOfPCIConfigRegisters;
  458. PUCHAR LocalConfigRegisters;
  459. PUCHAR InterruptStatus;
  460. PPORT_DEVICE_EXTENSION Extensions[SERIAL_MAX_PORTS_INDEXED];
  461. ULONG MaskInverted;
  462. UCHAR UsablePortMask;
  463. ULONG UARTOffset;
  464. ULONG UARTRegStride;
  465. // First UART in the list to be serviced next by the ISR.
  466. PUART_OBJECT pFirstUart;
  467. UART_LIB UartLib; // Uart library finctions.
  468. ULONG CardOptions;
  469. } CARD_DEVICE_EXTENSION, *PCARD_DEVICE_EXTENSION;
  470. #endif // End of SPD_CARD.H