📄 serialdevice.h
字号:
// about. It is only accessed with the cancel spinlock
// held.
ULONG m_TotalCharsQueued;
// This holds a count of the number of characters read
// the last time the interval timer dpc fired. It
// is a long (rather than a ulong) since the other read
// completion routines use negative values to indicate
// to the interval timer that it should complete the read
// if the interval timer DPC was lurking in some DPC queue when
// some other way to complete occurs.
LONG m_CountOnLastRead;
// This is a count of the number of characters read by the
// isr routine. It is *ONLY* written at isr level. We can
// read it at dispatch level.
ULONG m_ReadByIsr;
// This holds the current baud rate for the device.
ULONG m_CurrentBaud;
// This is the number of characters read since the XoffCounter
// was started. This variable is only accessed at device level.
// If it is greater than zero, it implies that there is an
// XoffCounter ioctl in the queue.
LONG m_CountSinceXoff;
//
// This ulong is incremented each time something tries to start
// the execution path that tries to lower the RTS line when
// doing transmit toggling. If it "bumps" into another path
// (indicated by a false return value from queueing a dpc
// and a TRUE return value tring to start a timer) it will
// decrement the count. These increments and decrements
// are all done at device level. Note that in the case
// of a bump while trying to start the timer, we have to
// go up to device level to do the decrement.
ULONG m_CountOfTryingToLowerRTS;
// This ULONG is used to keep track of the "named" (in ntddser.h)
// baud rates that this particular device supports.
ULONG m_SupportedBauds;
// Hold the clock rate input to the serial part.
ULONG m_ClockRate;
// The number of characters to push out if a fifo is present.
ULONG m_TxFifoAmount;
// Set to indicate that it is ok to share interrupts within the device.
ULONG m_PermitShare;
// Holds the timeout controls for the device. This value
// is set by the Ioctl processing.
//
// It should only be accessed under protection of the control
// lock since more than one request can be in the control dispatch
// routine at one time.
SERIAL_TIMEOUTS m_Timeouts;
// This holds the various characters that are used
// for replacement on errors and also for flow control.
//
// They are only set at interrupt level.
SERIAL_CHARS m_SpecialChars;
// This structure holds the handshake and control flow
// settings for the serial driver.
//
// It is only set at interrupt level. It can be
// be read at any level with the control lock held.
SERIAL_HANDFLOW m_HandFlow;
// Holds performance statistics that applications can query.
// Reset on each open. Only set at device level.
SERIALPERF_STATS m_PerfStats;
// This holds what we believe to be the current value of
// the line control register.
//
// It should only be accessed under protection of the control
// lock since more than one request can be in the control dispatch
// routine at one time.
UCHAR m_LineControl;
// We keep track of whether the somebody has the device currently
// opened with a simple boolean. We need to know this so that
// spurious interrupts from the device (especially during initialization)
// will be ignored. This value is only accessed in the ISR and
// is only set via synchronization routines. We may be able
// to get rid of this boolean when the code is more fleshed out.
BOOLEAN m_DeviceIsOpened;
// Set at intialization to indicate that on the current
// architecture we need to unmap the base register address
// when we unload the driver.
BOOLEAN m_UnMapRegisters;
// Set at intialization to indicate that on the current
// architecture we need to unmap the interrupt status address
// when we unload the driver.
BOOLEAN m_UnMapStatus;
// This is only accessed at interrupt level. It keeps track
// of whether the holding register is empty.
BOOLEAN m_HoldingEmpty;
// This variable is only accessed at interrupt level. It
// indicates that we want to transmit a character immediately.
// That is - in front of any characters that could be transmitting
// from a normal write.
BOOLEAN m_TransmitImmediate;
// This variable is only accessed at interrupt level. Whenever
// a wait is initiated this variable is set to false.
// Whenever any kind of character is written it is set to true.
// Whenever the write queue is found to be empty the code that
// is processing that completing irp will synchronize with the interrupt.
// If this synchronization code finds that the variable is true and that
// there is a wait on the transmit queue being empty then it is
// certain that the queue was emptied and that it has happened since
// the wait was initiated.
BOOLEAN m_EmptiedTransmit;
// This simply indicates that the port associated with this
// device is part of a multiport card.
BOOLEAN m_PortOnAMultiportCard;
// We hold the character that should be transmitted immediately.
//
// Note that we can't use this to determine whether there is
// a character to send because the character to send could be
// zero.
UCHAR m_ImmediateChar;
// This holds the mask that will be used to mask off unwanted
// data bits of the received data (valid data bits can be 5,6,7,8)
// The mask will normally be 0xff. This is set while the control
// lock is held since it wouldn't have adverse effects on the
// isr if it is changed in the middle of reading characters.
// (What it would do to the app is another question - but then
// the app asked the driver to do it.)
UCHAR m_ValidDataMask;
// The application can turn on a mode,via the
// IOCTL_SERIAL_LSRMST_INSERT ioctl, that will cause the
// serial driver to insert the line status or the modem
// status into the RX stream. The parameter with the ioctl
// is a pointer to a UCHAR. If the value of the UCHAR is
// zero, then no insertion will ever take place. If the
// value of the UCHAR is non-zero (and not equal to the
// xon/xoff characters), then the serial driver will insert.
UCHAR m_EscapeChar;
// These two booleans are used to indicate to the isr transmit
// code that it should send the xon or xoff character. They are
// only accessed at open and at interrupt level.
BOOLEAN m_SendXonChar;
BOOLEAN m_SendXoffChar;
// This boolean will be true if a 16550 is present *and* enabled.
BOOLEAN m_FifoPresent;
// This denotes that this particular port is an on the motherboard
// port for the Jensen hardware. On these ports the OUT2 bit
// which is used to enable/disable interrupts is always hight.
BOOLEAN m_Jensen;
// This is the water mark that the rxfifo should be
// set to when the fifo is turned on. This is not the actual
// value, but the encoded value that goes into the register.
UCHAR m_RxFifoTrigger;
// Says whether this device can share interrupts with devices
// other than serial devices.
BOOLEAN m_InterruptShareable;
// Records whether we actually created the symbolic link name
// at driver load time. If we didn't create it, we won't try
// to destroy it when we unload.
BOOLEAN m_CreatedSymbolicLink;
// This lock will be used to protect various fields in
// the device that are set (& read) in the extension
// by the io controls.
KdSpinLock m_ControlLock;
// This points to a DPC used to complete read requests.
KdDpc m_KdDpc_CompleteWrite;
// This points to a DPC used to complete read requests.
KdDpc m_KdDpc_CompleteRead;
// This dpc is fired off if a comm error occurs. It will
// execute a dpc routine that will cancel all pending reads
// and writes.
KdDpc m_KdDpc_CommError;
// This dpc is fired off if an event occurs and there was
// a irp waiting on that event. A dpc routine will execute
// that completes the irp.
KdDpc m_KdDpc_CommWait;
// This dpc is fired off when the transmit immediate char
// character is given to the hardware. It will simply complete
// the irp.
KdDpc m_KdDpc_CompleteImmediate;
// This dpc is fired off if the xoff counter actually runs down
// to zero.
KdDpc m_KdDpc_XoffCountComplete;
// This dpc is fired off only from device level to start off
// a timer that will queue a dpc to check if the RTS line
// should be lowered when we are doing transmit toggling.
KdDpc m_KdDpc_StartTimerLowerRTSDpc;
// This is the kernal timer structure used to handle
// total read request timing.
KdTimedCallback m_KdTimer_TotalReadTimeoutDpc;
// This is the kernal timer structure used to handle
// interval read request timing.
KdTimedCallback m_KdTimer_ReadIntervalTimerDpc;
// This is the kernal timer structure used to handle
// total time request timing.
KdTimedCallback m_KdTimer_WriteRequestTotalTimerDpc;
// This is the kernal timer structure used to handle
// total time request timing.
KdTimedCallback m_KdTimer_ReadRequestTotalTimerDpc;
// This is the kernal timer structure used to handle
// total time request timing.
KdTimedCallback m_KdTimer_ImmediateTotalTimerDpc;
// This timer is used to timeout the xoff counter io.
KdTimedCallback m_KdTimer_XoffCountTimerDpc;
// This timer is used to invoke a dpc one character time
// after the timer is set. That dpc will be used to check
// whether we should lower the RTS line if we are doing
// transmit toggling.
KdTimedCallback m_KdTimer_LowerRTSTimerDpc;
};
typedef KdSerialDevice * PKdSerialDevice;
#endif //__SERIAL_DEVICE__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -