📄 serialdevice.h
字号:
// so that the interval timer dpc routine determine if the
// interval time has passed for the IO.
LARGE_INTEGER m_IntervalTime;
// These two values hold the "constant" time that we should use
// to delay for the read interval time.
LARGE_INTEGER m_ShortIntervalAmount;
LARGE_INTEGER m_LongIntervalAmount;
//
// This holds the value that we use to determine if we should use
// the long interval delay or the short interval delay.
//
LARGE_INTEGER m_CutOverAmount;
// This holds the system time when we last time we had
// checked that we had actually read characters. Used
// for interval timing.
LARGE_INTEGER m_LastReadTime;
// This points to the device name for this device
// sans device prefix.
KdString m_sNtNameForPort;
// This points to the symbolic link name that will be
// linked to the actual nt device name.
KdString m_sSymbolicLinkName;
// This points the the delta time that we should use to
// delay for interval timing.
PLARGE_INTEGER m_IntervalTimeToUse;
// After initialization of the driver is complete, this
// will either be NULL or point to the routine that the
// kernel will call when an interrupt occurs.
//
// If the pointer is null then this is part of a list
// of ports that are sharing an interrupt and this isn't
// the first port that we configured for this interrupt.
//
// If the pointer is non-null then this routine has some
// kind of structure that will "eventually" get us into
// the real serial isr with a pointer to this device.
//
// NOTE: On an MCA bus (except for multiport cards) this
// is always a pointer to the "real" serial isr.
// This will generally point right to this device.
//
// However, when the port that this device is
// "managing" was the first port initialized on a chain
// of ports that were trying to share an interrupt, this
// will point to a structure that will enable dispatching
// to any port on the chain of sharers of this interrupt.
SERIAL_ISR_CONTEXT m_Isr;
// The base address for the set of device registers
// of the serial port.
KdMapKernel *m_pController;
// The base address for interrupt status register.
// This is only defined in the root device.
KdMapKernel *m_pInterruptStatus;
// Points to the interrupt object for used by this device.
KdIrq m_KdInterrupt;
// This list head is used to contain the time ordered list
// of read requests. Access to this list is protected by
// the global cancel spinlock.
LIST_ENTRY m_ReadQueue;
// This list head is used to contain the time ordered list
// of write requests. Access to this list is protected by
// the global cancel spinlock.
LIST_ENTRY m_WriteQueue;
// This list head is used to contain the time ordered list
// of set and wait mask requests. Access to this list is protected by
// the global cancel spinlock.
LIST_ENTRY m_MaskQueue;
// Holds the serialized list of purge requests.
LIST_ENTRY m_PurgeQueue;
// This points to the irp that is currently being processed
// for the read queue. This field is initialized by the open to
// NULL.
//
// This value is only set at dispatch level. It may be
// read at interrupt level.
KdIrp m_CurrentReadIrp;
// This points to the irp that is currently being processed
// for the write queue.
//
// This value is only set at dispatch level. It may be
// read at interrupt level.
KdIrp m_CurrentWriteIrp;
// Points to the irp that is currently being processed to
// affect the wait mask operations.
KdIrp m_CurrentMaskIrp;
// Points to the irp that is currently being processed to
// purge the read/write queues and buffers.
KdIrp m_CurrentPurgeIrp;
// Points to the current irp that is waiting on a comm event.
KdIrp m_CurrentWaitIrp;
// Points to the irp that is being used to send an immediate
// character.
KdIrp m_CurrentImmediateIrp;
// Points to the irp that is being used to count the number
// of characters received after an xoff (as currently defined
// by the IOCTL_SERIAL_XOFF_COUNTER ioctl) is sent.
KdIrp m_CurrentXoffIrp;
// Holds the number of bytes remaining in the current write
// irp.
//
// This location is only accessed while at interrupt level.
ULONG m_WriteLength;
// Holds a pointer to the current character to be sent in
// the current write.
//
// This location is only accessed while at interrupt level.
PUCHAR m_WriteCurrentChar;
// This is a buffer for the read processing.
//
// The buffer works as a ring. When the character is read from
// the device it will be place at the end of the ring.
//
// Characters are only placed in this buffer at interrupt level
// although character may be read at any level. The pointers
// that manage this buffer may not be updated except at interrupt
// level.
PUCHAR m_InterruptReadBuffer;
// This is a pointer to the first character of the buffer into
// which the interrupt service routine is copying characters.
PUCHAR m_ReadBufferBase;
// This is a count of the number of characters in the interrupt
// buffer. This value is set and read at interrupt level. Note
// that this value is only *incremented* at interrupt level so
// it is safe to read it at any level. When characters are
// copied out of the read buffer, this count is decremented by
// a routine that synchronizes with the ISR.
ULONG m_CharsInInterruptBuffer;
// Points to the first available position for a newly received
// character. This variable is only accessed at interrupt level and
// buffer initialization code.
PUCHAR m_CurrentCharSlot;
// This variable is used to contain the last available position
// in the read buffer. It is updated at open and at interrupt
// level when switching between the users buffer and the interrupt
// buffer.
PUCHAR m_LastCharSlot;
// This marks the first character that is available to satisfy
// a read request. Note that while this always points to valid
// memory, it may not point to a character that can be sent to
// the user. This can occur when the buffer is empty.
PUCHAR m_FirstReadableChar;
// Pointer to the lock variable returned for this device when
// locking down the driver
PVOID m_LockPtr;
// This variable holds the size of whatever buffer we are currently
// using.
ULONG m_BufferSize;
// This variable holds .8 of BufferSize. We don't want to recalculate
// this real often - It's needed when so that an application can be
// "notified" that the buffer is getting full.
ULONG m_BufferSizePt8;
// This value holds the number of characters desired for a
// particular read. It is initially set by read length in the
// IRP. It is decremented each time more characters are placed
// into the "users" buffer buy the code that reads characters
// out of the typeahead buffer into the users buffer. If the
// typeahead buffer is exhausted by the read, and the reads buffer
// is given to the isr to fill, this value is becomes meaningless.
ULONG m_NumberNeededForRead;
// This mask will hold the bitmask sent down via the set mask
// ioctl. It is used by the interrupt service routine to determine
// if the occurrence of "events" (in the serial drivers understanding
// of the concept of an event) should be noted.
ULONG m_IsrWaitMask;
// This mask will always be a subset of the IsrWaitMask. While
// at device level, if an event occurs that is "marked" as interesting
// in the IsrWaitMask, the driver will turn on that bit in this
// history mask. The driver will then look to see if there is a
// request waiting for an event to occur. If there is one, it
// will copy the value of the history mask into the wait irp, zero
// the history mask, and complete the wait irp. If there is no
// waiting request, the driver will be satisfied with just recording
// that the event occurred. If a wait request should be queued,
// the driver will look to see if the history mask is non-zero. If
// it is non-zero, the driver will copy the history mask into the
// irp, zero the history mask, and then complete the irp.
ULONG m_HistoryMask;
// This is a pointer to the where the history mask should be
// placed when completing a wait. It is only accessed at
// device level.
//
// We have a pointer here to assist us to synchronize completing a wait.
// If this is non-zero, then we have wait outstanding, and the isr still
// knows about it. We make this pointer null so that the isr won't
// attempt to complete the wait.
//
// We still keep a pointer around to the wait irp, since the actual
// pointer to the wait irp will be used for the "common" irp completion
// path.
ULONG *m_IrpMaskLocation;
// This mask holds all of the reason that transmission
// is not proceeding. Normal transmission can not occur
// if this is non-zero.
//
// This is only written from interrupt level.
// This could be (but is not) read at any level.
ULONG m_TXHolding;
// This mask holds all of the reason that reception
// is not proceeding. Normal reception can not occur
// if this is non-zero.
//
// This is only written from interrupt level.
// This could be (but is not) read at any level.
ULONG m_RXHolding;
// This holds the reasons that the driver thinks it is in
// an error state.
//
// This is only written from interrupt level.
// This could be (but is not) read at any level.
ULONG m_ErrorWord;
// This keeps a total of the number of characters that
// are in all of the "write" irps that the driver knows
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -