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.

900 lines
21 KiB

  1. /*++
  2. Copyright (c) 1990, 1991, 1992, 1993 - 1997 Microsoft Corporation
  3. Module Name :
  4. serialp.h
  5. Abstract:
  6. Prototypes and macros that are used throughout the driver.
  7. Author:
  8. Anthony V. Ercolano September 26, 1991
  9. --*/
  10. typedef
  11. NTSTATUS
  12. (*PSERIAL_START_ROUTINE) (
  13. IN PSERIAL_DEVICE_EXTENSION
  14. );
  15. typedef
  16. VOID
  17. (*PSERIAL_GET_NEXT_ROUTINE) (
  18. IN PIRP *CurrentOpIrp,
  19. IN PLIST_ENTRY QueueToProcess,
  20. OUT PIRP *NewIrp,
  21. IN BOOLEAN CompleteCurrent,
  22. PSERIAL_DEVICE_EXTENSION Extension
  23. );
  24. NTSTATUS
  25. SerialRead(
  26. IN PDEVICE_OBJECT DeviceObject,
  27. IN PIRP Irp
  28. );
  29. NTSTATUS
  30. SerialStartRead(
  31. IN PSERIAL_DEVICE_EXTENSION Extension
  32. );
  33. VOID
  34. SerialCompleteRead(
  35. IN PKDPC Dpc,
  36. IN PVOID DeferredContext,
  37. IN PVOID SystemContext1,
  38. IN PVOID SystemContext2
  39. );
  40. VOID
  41. SerialReadTimeout(
  42. IN PKDPC Dpc,
  43. IN PVOID DeferredContext,
  44. IN PVOID SystemContext1,
  45. IN PVOID SystemContext2
  46. );
  47. NTSTATUS
  48. DriverEntry(
  49. IN PDRIVER_OBJECT DriverObject,
  50. IN PUNICODE_STRING RegistryPath
  51. );
  52. VOID
  53. SerialIntervalReadTimeout(
  54. IN PKDPC Dpc,
  55. IN PVOID DeferredContext,
  56. IN PVOID SystemContext1,
  57. IN PVOID SystemContext2
  58. );
  59. NTSTATUS
  60. SerialFlush(
  61. IN PDEVICE_OBJECT DeviceObject,
  62. IN PIRP Irp
  63. );
  64. NTSTATUS
  65. SerialWrite(
  66. IN PDEVICE_OBJECT DeviceObject,
  67. IN PIRP Irp
  68. );
  69. NTSTATUS
  70. SerialStartWrite(
  71. IN PSERIAL_DEVICE_EXTENSION Extension
  72. );
  73. VOID
  74. SerialGetNextWrite(
  75. IN PIRP *CurrentOpIrp,
  76. IN PLIST_ENTRY QueueToProcess,
  77. IN PIRP *NewIrp,
  78. IN BOOLEAN CompleteCurrent,
  79. IN PSERIAL_DEVICE_EXTENSION Extension
  80. );
  81. VOID
  82. SerialCompleteWrite(
  83. IN PKDPC Dpc,
  84. IN PVOID DeferredContext,
  85. IN PVOID SystemContext1,
  86. IN PVOID SystemContext2
  87. );
  88. BOOLEAN
  89. SerialProcessEmptyTransmit(
  90. IN PVOID Context
  91. );
  92. VOID
  93. SerialWriteTimeout(
  94. IN PKDPC Dpc,
  95. IN PVOID DeferredContext,
  96. IN PVOID SystemContext1,
  97. IN PVOID SystemContext2
  98. );
  99. VOID
  100. SerialCommError(
  101. IN PKDPC Dpc,
  102. IN PVOID DeferredContext,
  103. IN PVOID SystemContext1,
  104. IN PVOID SystemContext2
  105. );
  106. NTSTATUS
  107. SerialCleanup(
  108. IN PDEVICE_OBJECT DeviceObject,
  109. IN PIRP Irp
  110. );
  111. NTSTATUS
  112. SerialInitOneController(IN PDEVICE_OBJECT PDevObj, IN PCONFIG_DATA PConfigData);
  113. NTSTATUS
  114. SerialCreateOpen(
  115. IN PDEVICE_OBJECT DeviceObject,
  116. IN PIRP Irp
  117. );
  118. NTSTATUS
  119. SerialClose(
  120. IN PDEVICE_OBJECT DeviceObject,
  121. IN PIRP Irp
  122. );
  123. BOOLEAN
  124. SerialSetDTR(
  125. IN PVOID Context
  126. );
  127. BOOLEAN
  128. SerialClrDTR(
  129. IN PVOID Context
  130. );
  131. BOOLEAN
  132. SerialSetRTS(
  133. IN PVOID Context
  134. );
  135. BOOLEAN
  136. SerialClrRTS(
  137. IN PVOID Context
  138. );
  139. BOOLEAN
  140. SerialSetChars(
  141. IN PVOID Context
  142. );
  143. BOOLEAN
  144. SerialSetBaud(
  145. IN PVOID Context
  146. );
  147. BOOLEAN
  148. SerialSetLineControl(
  149. IN PVOID Context
  150. );
  151. BOOLEAN
  152. SerialSetupNewHandFlow(
  153. IN PSERIAL_DEVICE_EXTENSION Extension,
  154. IN PSERIAL_HANDFLOW NewHandFlow
  155. );
  156. BOOLEAN
  157. SerialSetHandFlow(
  158. IN PVOID Context
  159. );
  160. BOOLEAN
  161. SerialTurnOnBreak(
  162. IN PVOID Context
  163. );
  164. BOOLEAN
  165. SerialTurnOffBreak(
  166. IN PVOID Context
  167. );
  168. BOOLEAN
  169. SerialPretendXoff(
  170. IN PVOID Context
  171. );
  172. BOOLEAN
  173. SerialPretendXon(
  174. IN PVOID Context
  175. );
  176. VOID
  177. SerialHandleReducedIntBuffer(
  178. IN PSERIAL_DEVICE_EXTENSION Extension
  179. );
  180. VOID
  181. SerialProdXonXoff(
  182. IN PSERIAL_DEVICE_EXTENSION Extension,
  183. IN BOOLEAN SendXon
  184. );
  185. NTSTATUS
  186. SerialIoControl(
  187. IN PDEVICE_OBJECT DeviceObject,
  188. IN PIRP Irp
  189. );
  190. NTSTATUS
  191. SerialStartMask(
  192. IN PSERIAL_DEVICE_EXTENSION Extension
  193. );
  194. VOID
  195. SerialCancelWait(
  196. IN PDEVICE_OBJECT DeviceObject,
  197. IN PIRP Irp
  198. );
  199. VOID
  200. SerialCompleteWait(
  201. IN PKDPC Dpc,
  202. IN PVOID DeferredContext,
  203. IN PVOID SystemContext1,
  204. IN PVOID SystemContext2
  205. );
  206. VOID
  207. SerialStartImmediate(
  208. IN PSERIAL_DEVICE_EXTENSION Extension
  209. );
  210. VOID
  211. SerialCompleteImmediate(
  212. IN PKDPC Dpc,
  213. IN PVOID DeferredContext,
  214. IN PVOID SystemContext1,
  215. IN PVOID SystemContext2
  216. );
  217. VOID
  218. SerialTimeoutImmediate(
  219. IN PKDPC Dpc,
  220. IN PVOID DeferredContext,
  221. IN PVOID SystemContext1,
  222. IN PVOID SystemContext2
  223. );
  224. VOID
  225. SerialTimeoutXoff(
  226. IN PKDPC Dpc,
  227. IN PVOID DeferredContext,
  228. IN PVOID SystemContext1,
  229. IN PVOID SystemContext2
  230. );
  231. VOID
  232. SerialCompleteXoff(
  233. IN PKDPC Dpc,
  234. IN PVOID DeferredContext,
  235. IN PVOID SystemContext1,
  236. IN PVOID SystemContext2
  237. );
  238. NTSTATUS
  239. SerialStartPurge(
  240. IN PSERIAL_DEVICE_EXTENSION Extension
  241. );
  242. BOOLEAN
  243. SerialPurgeInterruptBuff(
  244. IN PVOID Context
  245. );
  246. NTSTATUS
  247. SerialQueryInformationFile(
  248. IN PDEVICE_OBJECT DeviceObject,
  249. IN PIRP Irp
  250. );
  251. NTSTATUS
  252. SerialSetInformationFile(
  253. IN PDEVICE_OBJECT DeviceObject,
  254. IN PIRP Irp
  255. );
  256. VOID
  257. SerialKillAllReadsOrWrites(
  258. IN PDEVICE_OBJECT DeviceObject,
  259. IN PLIST_ENTRY QueueToClean,
  260. IN PIRP *CurrentOpIrp
  261. );
  262. VOID
  263. SerialGetNextIrp(
  264. IN PIRP *CurrentOpIrp,
  265. IN PLIST_ENTRY QueueToProcess,
  266. OUT PIRP *NextIrp,
  267. IN BOOLEAN CompleteCurrent,
  268. IN PSERIAL_DEVICE_EXTENSION extension
  269. );
  270. VOID
  271. SerialGetNextIrpLocked(IN PIRP *CurrentOpIrp, IN PLIST_ENTRY QueueToProcess,
  272. OUT PIRP *NextIrp, IN BOOLEAN CompleteCurrent,
  273. IN PSERIAL_DEVICE_EXTENSION extension, IN KIRQL OldIrql);
  274. VOID
  275. SerialTryToCompleteCurrent(
  276. IN PSERIAL_DEVICE_EXTENSION Extension,
  277. IN PKSYNCHRONIZE_ROUTINE SynchRoutine OPTIONAL,
  278. IN KIRQL IrqlForRelease,
  279. IN NTSTATUS StatusToUse,
  280. IN PIRP *CurrentOpIrp,
  281. IN PLIST_ENTRY QueueToProcess,
  282. IN PKTIMER IntervalTimer,
  283. IN PKTIMER TotalTimer,
  284. IN PSERIAL_START_ROUTINE Starter,
  285. IN PSERIAL_GET_NEXT_ROUTINE GetNextIrp,
  286. IN LONG RefType
  287. );
  288. NTSTATUS
  289. SerialStartOrQueue(
  290. IN PSERIAL_DEVICE_EXTENSION Extension,
  291. IN PIRP Irp,
  292. IN PLIST_ENTRY QueueToExamine,
  293. IN PIRP *CurrentOpIrp,
  294. IN PSERIAL_START_ROUTINE Starter
  295. );
  296. VOID
  297. SerialCancelQueued(
  298. PDEVICE_OBJECT DeviceObject,
  299. PIRP Irp
  300. );
  301. NTSTATUS
  302. SerialCompleteIfError(
  303. PDEVICE_OBJECT DeviceObject,
  304. PIRP Irp
  305. );
  306. ULONG
  307. SerialHandleModemUpdate(
  308. IN PSERIAL_DEVICE_EXTENSION Extension,
  309. IN BOOLEAN DoingTX
  310. );
  311. BOOLEAN
  312. SerialISR(
  313. IN PKINTERRUPT InterruptObject,
  314. IN PVOID Context
  315. );
  316. NTSTATUS
  317. SerialGetDivisorFromBaud(
  318. IN ULONG ClockRate,
  319. IN LONG DesiredBaud,
  320. OUT PSHORT AppropriateDivisor
  321. );
  322. VOID
  323. SerialUnload(
  324. IN PDRIVER_OBJECT DriverObject
  325. );
  326. BOOLEAN
  327. SerialReset(
  328. IN PVOID Context
  329. );
  330. BOOLEAN
  331. SerialPerhapsLowerRTS(
  332. IN PVOID Context
  333. );
  334. VOID
  335. SerialStartTimerLowerRTS(
  336. IN PKDPC Dpc,
  337. IN PVOID DeferredContext,
  338. IN PVOID SystemContext1,
  339. IN PVOID SystemContext2
  340. );
  341. VOID
  342. SerialInvokePerhapsLowerRTS(
  343. IN PKDPC Dpc,
  344. IN PVOID DeferredContext,
  345. IN PVOID SystemContext1,
  346. IN PVOID SystemContext2
  347. );
  348. VOID
  349. SerialCleanupDevice(
  350. IN PSERIAL_DEVICE_EXTENSION Extension
  351. );
  352. UCHAR
  353. SerialProcessLSR(
  354. IN PSERIAL_DEVICE_EXTENSION Extension
  355. );
  356. LARGE_INTEGER
  357. SerialGetCharTime(
  358. IN PSERIAL_DEVICE_EXTENSION Extension
  359. );
  360. BOOLEAN
  361. SerialSharerIsr(
  362. IN PKINTERRUPT InterruptObject,
  363. IN PVOID Context
  364. );
  365. BOOLEAN
  366. SerialMarkClose(
  367. IN PVOID Context
  368. );
  369. BOOLEAN
  370. SerialIndexedMultiportIsr(
  371. IN PKINTERRUPT InterruptObject,
  372. IN PVOID Context
  373. );
  374. BOOLEAN
  375. SerialBitMappedMultiportIsr(
  376. IN PKINTERRUPT InterruptObject,
  377. IN PVOID Context
  378. );
  379. VOID
  380. SerialPutChar(
  381. IN PSERIAL_DEVICE_EXTENSION Extension,
  382. IN UCHAR CharToPut
  383. );
  384. BOOLEAN
  385. SerialGetStats(
  386. IN PVOID Context
  387. );
  388. BOOLEAN
  389. SerialClearStats(
  390. IN PVOID Context
  391. );
  392. NTSTATUS
  393. SerialCloseComplete(
  394. IN PDEVICE_OBJECT DeviceObject,
  395. IN PIRP Irp,
  396. IN PVOID Context
  397. );
  398. NTSTATUS
  399. SerialPnpDispatch(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp);
  400. NTSTATUS
  401. SerialPowerDispatch(
  402. IN PDEVICE_OBJECT DeviceObject,
  403. IN PIRP Irp
  404. );
  405. NTSTATUS
  406. SerialSetPowerD0(
  407. IN PDEVICE_OBJECT DeviceObject,
  408. IN PIRP Irp
  409. );
  410. NTSTATUS
  411. SerialSetPowerD3(
  412. IN PDEVICE_OBJECT DeviceObject,
  413. IN PIRP Irp
  414. );
  415. NTSTATUS
  416. SerialOpenClose(
  417. IN PDEVICE_OBJECT DeviceObject,
  418. IN PIRP Irp
  419. );
  420. NTSTATUS
  421. SerialGetConfigDefaults(
  422. IN PSERIAL_FIRMWARE_DATA DriverDefaultsPtr,
  423. IN PUNICODE_STRING RegistryPath
  424. );
  425. VOID
  426. SerialGetProperties(
  427. IN PSERIAL_DEVICE_EXTENSION Extension,
  428. IN PSERIAL_COMMPROP Properties
  429. );
  430. NTSTATUS
  431. SerialEnumerateLegacy(IN PDRIVER_OBJECT DriverObject,
  432. IN PUNICODE_STRING RegistryPath,
  433. IN PSERIAL_FIRMWARE_DATA DriverDefaultsPtr);
  434. NTSTATUS
  435. SerialMigrateLegacyRegistry(IN PDEVICE_OBJECT PPdo,
  436. IN PSERIAL_USER_DATA PUserData,
  437. IN BOOLEAN IsMulti);
  438. NTSTATUS
  439. SerialBuildResourceList(OUT PCM_RESOURCE_LIST PResourceList,
  440. OUT PULONG PPartialCount,
  441. IN PSERIAL_USER_DATA PUserData);
  442. NTSTATUS
  443. SerialTranslateResourceList(IN PDRIVER_OBJECT DriverObject,
  444. IN PKEY_BASIC_INFORMATION UserSubKey,
  445. OUT PCM_RESOURCE_LIST PTrResourceList,
  446. IN PCM_RESOURCE_LIST PResourceList,
  447. IN ULONG PartialCount,
  448. IN PSERIAL_USER_DATA PUserData);
  449. NTSTATUS
  450. SerialBuildRequirementsList(OUT PIO_RESOURCE_REQUIREMENTS_LIST PRequiredList,
  451. IN ULONG PartialCount,
  452. IN PSERIAL_USER_DATA PUserData);
  453. BOOLEAN
  454. SerialIsUserDataValid(IN PDRIVER_OBJECT DriverObject,
  455. IN PKEY_BASIC_INFORMATION UserSubKey,
  456. IN PRTL_QUERY_REGISTRY_TABLE Parameters,
  457. IN ULONG DefaultInterfaceType,
  458. IN PSERIAL_USER_DATA PUserData);
  459. NTSTATUS
  460. SerialControllerCallBack(
  461. IN PVOID Context,
  462. IN PUNICODE_STRING PathName,
  463. IN INTERFACE_TYPE BusType,
  464. IN ULONG BusNumber,
  465. IN PKEY_VALUE_FULL_INFORMATION *BusInformation,
  466. IN CONFIGURATION_TYPE ControllerType,
  467. IN ULONG ControllerNumber,
  468. IN PKEY_VALUE_FULL_INFORMATION *ControllerInformation,
  469. IN CONFIGURATION_TYPE PeripheralType,
  470. IN ULONG PeripheralNumber,
  471. IN PKEY_VALUE_FULL_INFORMATION *PeripheralInformation
  472. );
  473. VOID
  474. SerialLogError(
  475. IN PDRIVER_OBJECT DriverObject,
  476. IN PDEVICE_OBJECT DeviceObject OPTIONAL,
  477. IN PHYSICAL_ADDRESS P1,
  478. IN PHYSICAL_ADDRESS P2,
  479. IN ULONG SequenceNumber,
  480. IN UCHAR MajorFunctionCode,
  481. IN UCHAR RetryCount,
  482. IN ULONG UniqueErrorValue,
  483. IN NTSTATUS FinalStatus,
  484. IN NTSTATUS SpecificIOStatus,
  485. IN ULONG LengthOfInsert1,
  486. IN PWCHAR Insert1,
  487. IN ULONG LengthOfInsert2,
  488. IN PWCHAR Insert2
  489. );
  490. NTSTATUS
  491. SerialAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PLowerDevObj);
  492. NTSTATUS
  493. SerialCreateDevObj(IN PDRIVER_OBJECT DriverObject,
  494. OUT PDEVICE_OBJECT *NewDeviceObject);
  495. NTSTATUS
  496. SerialStartDevice(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp);
  497. NTSTATUS
  498. SerialGetRegistryKeyValue (IN HANDLE Handle, IN PWCHAR KeyNameString,
  499. IN ULONG KeyNameStringLength, IN PVOID Data,
  500. IN ULONG DataLength);
  501. NTSTATUS
  502. SerialPnpDispatch(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp);
  503. NTSTATUS
  504. SerialGetPortInfo(IN PDEVICE_OBJECT PDevObj, IN PCM_RESOURCE_LIST PResList,
  505. IN PCM_RESOURCE_LIST PTrResList, OUT PCONFIG_DATA PConfig,
  506. IN PSERIAL_USER_DATA PUserData);
  507. NTSTATUS
  508. SerialFinishStartDevice(IN PDEVICE_OBJECT PDevObj,
  509. IN PCM_RESOURCE_LIST PResList,
  510. IN PCM_RESOURCE_LIST PTrResList,
  511. IN PSERIAL_USER_DATA PUserData);
  512. NTSTATUS
  513. SerialPutRegistryKeyValue (
  514. IN HANDLE Handle,
  515. IN PWCHAR KeyNameString,
  516. IN ULONG KeyNameStringLength,
  517. IN ULONG Dtype,
  518. IN PVOID Data,
  519. IN ULONG DataLength
  520. );
  521. NTSTATUS
  522. SerialInitController(IN PDEVICE_OBJECT PDevObj, IN PCONFIG_DATA PConfigData);
  523. NTSTATUS
  524. SerialInitMultiPort(IN PSERIAL_DEVICE_EXTENSION PDevExt,
  525. IN PCONFIG_DATA PConfigData, IN PDEVICE_OBJECT PDevObj);
  526. NTSTATUS
  527. SerialFindInitController(IN PDEVICE_OBJECT PDevObj, IN PCONFIG_DATA PConfig);
  528. BOOLEAN
  529. SerialCIsrSw(IN PKINTERRUPT InterruptObject, IN PVOID Context);
  530. NTSTATUS
  531. SerialDoExternalNaming(IN PSERIAL_DEVICE_EXTENSION PDevExt,
  532. IN PDRIVER_OBJECT PDrvObj);
  533. PVOID
  534. SerialGetMappedAddress(
  535. IN INTERFACE_TYPE BusType,
  536. IN ULONG BusNumber,
  537. PHYSICAL_ADDRESS IoAddress,
  538. ULONG NumberOfBytes,
  539. ULONG AddressSpace,
  540. PBOOLEAN MappedAddress
  541. );
  542. NTSTATUS
  543. SerialItemCallBack(
  544. IN PVOID Context,
  545. IN PUNICODE_STRING PathName,
  546. IN INTERFACE_TYPE BusType,
  547. IN ULONG BusNumber,
  548. IN PKEY_VALUE_FULL_INFORMATION *BusInformation,
  549. IN CONFIGURATION_TYPE ControllerType,
  550. IN ULONG ControllerNumber,
  551. IN PKEY_VALUE_FULL_INFORMATION *ControllerInformation,
  552. IN CONFIGURATION_TYPE PeripheralType,
  553. IN ULONG PeripheralNumber,
  554. IN PKEY_VALUE_FULL_INFORMATION *PeripheralInformation
  555. );
  556. BOOLEAN
  557. SerialDoesPortExist(
  558. IN PSERIAL_DEVICE_EXTENSION Extension,
  559. PUNICODE_STRING InsertString,
  560. IN ULONG ForceFifo,
  561. IN ULONG LogFifo
  562. );
  563. SERIAL_MEM_COMPARES
  564. SerialMemCompare(
  565. IN PHYSICAL_ADDRESS A,
  566. IN ULONG SpanOfA,
  567. IN PHYSICAL_ADDRESS B,
  568. IN ULONG SpanOfB
  569. );
  570. VOID
  571. SerialUndoExternalNaming(
  572. IN PSERIAL_DEVICE_EXTENSION Extension
  573. );
  574. NTSTATUS
  575. SerialIRPPrologue(IN PIRP PIrp, IN PSERIAL_DEVICE_EXTENSION PDevExt);
  576. VOID
  577. SerialIRPEpilogue(IN PSERIAL_DEVICE_EXTENSION PDevExt);
  578. NTSTATUS
  579. SerialIoCallDriver(PSERIAL_DEVICE_EXTENSION PDevExt, PDEVICE_OBJECT PDevObj,
  580. PIRP PIrp);
  581. NTSTATUS
  582. SerialPoCallDriver(PSERIAL_DEVICE_EXTENSION PDevExt, PDEVICE_OBJECT PDevObj,
  583. PIRP PIrp);
  584. NTSTATUS
  585. SerialRemoveDevObj(IN PDEVICE_OBJECT PDevObj);
  586. VOID
  587. SerialReleaseResources(IN PSERIAL_DEVICE_EXTENSION PDevExt);
  588. VOID
  589. SerialKillPendingIrps(PDEVICE_OBJECT DeviceObject);
  590. VOID
  591. SerialDisableUART(IN PVOID Context);
  592. VOID
  593. SerialDrainUART(IN PSERIAL_DEVICE_EXTENSION PDevExt,
  594. IN PLARGE_INTEGER PDrainTime);
  595. NTSTATUS
  596. SerialSystemControlDispatch(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp);
  597. NTSTATUS
  598. SerialSetWmiDataItem(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp,
  599. IN ULONG GuidIndex, IN ULONG InstanceIndex,
  600. IN ULONG DataItemId,
  601. IN ULONG BufferSize, IN PUCHAR PBuffer);
  602. NTSTATUS
  603. SerialSetWmiDataBlock(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp,
  604. IN ULONG GuidIndex, IN ULONG InstanceIndex,
  605. IN ULONG BufferSize,
  606. IN PUCHAR PBuffer);
  607. NTSTATUS
  608. SerialQueryWmiDataBlock(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp,
  609. IN ULONG GuidIndex,
  610. IN ULONG InstanceIndex,
  611. IN ULONG InstanceCount,
  612. IN OUT PULONG InstanceLengthArray,
  613. IN ULONG OutBufferSize,
  614. OUT PUCHAR PBuffer);
  615. NTSTATUS
  616. SerialQueryWmiRegInfo(IN PDEVICE_OBJECT PDevObj, OUT PULONG PRegFlags,
  617. OUT PUNICODE_STRING PInstanceName,
  618. OUT PUNICODE_STRING *PRegistryPath,
  619. OUT PUNICODE_STRING MofResourceName,
  620. OUT PDEVICE_OBJECT *Pdo);
  621. VOID
  622. SerialRestoreDeviceState(IN PSERIAL_DEVICE_EXTENSION PDevExt);
  623. VOID
  624. SerialSaveDeviceState(IN PSERIAL_DEVICE_EXTENSION PDevExt);
  625. NTSTATUS
  626. SerialSyncCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp,
  627. IN PKEVENT SerialSyncEvent);
  628. NTSTATUS
  629. SerialGotoPowerState(IN PDEVICE_OBJECT PDevObj,
  630. IN PSERIAL_DEVICE_EXTENSION PDevExt,
  631. IN DEVICE_POWER_STATE DevPowerState);
  632. NTSTATUS
  633. SerialFilterIrps(IN PIRP PIrp, IN PSERIAL_DEVICE_EXTENSION PDevExt);
  634. VOID
  635. SerialKillAllStalled(IN PDEVICE_OBJECT PDevObj);
  636. VOID
  637. SerialUnstallIrps(IN PSERIAL_DEVICE_EXTENSION PDevExt);
  638. NTSTATUS
  639. SerialInternalIoControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
  640. NTSTATUS
  641. SerialSendWaitWake(PSERIAL_DEVICE_EXTENSION PDevExt);
  642. NTSTATUS
  643. SerialWakeCompletion(IN PDEVICE_OBJECT PDevObj, IN UCHAR MinorFunction,
  644. IN POWER_STATE PowerState, IN PVOID Context,
  645. IN PIO_STATUS_BLOCK IoStatus);
  646. UINT32
  647. SerialReportMaxBaudRate(ULONG Bauds);
  648. BOOLEAN
  649. SerialSetMCRContents(IN PVOID Context);
  650. BOOLEAN
  651. SerialGetMCRContents(IN PVOID Context);
  652. BOOLEAN
  653. SerialSetFCRContents(IN PVOID Context);
  654. NTSTATUS
  655. SerialTossWMIRequest(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp,
  656. IN ULONG GuidIndex);
  657. VOID
  658. SerialDpcEpilogue(IN PSERIAL_DEVICE_EXTENSION PDevExt, IN PKDPC PDpc);
  659. BOOLEAN
  660. SerialInsertQueueDpc(IN PRKDPC Dpc, IN PVOID Sarg1, IN PVOID Sarg2,
  661. IN PSERIAL_DEVICE_EXTENSION PDevExt);
  662. BOOLEAN
  663. SerialSetTimer(IN PKTIMER Timer, IN LARGE_INTEGER DueTime,
  664. IN PKDPC Dpc OPTIONAL, IN PSERIAL_DEVICE_EXTENSION PDevExt);
  665. BOOLEAN
  666. SerialCancelTimer(IN PKTIMER Timer, IN PSERIAL_DEVICE_EXTENSION PDevExt);
  667. VOID
  668. SerialUnlockPages(IN PKDPC PDpc, IN PVOID PDeferredContext,
  669. IN PVOID PSysContext1, IN PVOID PSysContext2);
  670. VOID
  671. SerialMarkHardwareBroken(IN PSERIAL_DEVICE_EXTENSION PDevExt);
  672. VOID
  673. SerialDisableInterfacesResources(IN PDEVICE_OBJECT PDevObj,
  674. IN BOOLEAN DisableUART);
  675. VOID
  676. SerialSetDeviceFlags(IN PSERIAL_DEVICE_EXTENSION PDevExt, OUT PULONG PFlags,
  677. IN ULONG Value, IN BOOLEAN Set);
  678. typedef struct _SERIAL_UPDATE_CHAR {
  679. PSERIAL_DEVICE_EXTENSION Extension;
  680. ULONG CharsCopied;
  681. BOOLEAN Completed;
  682. } SERIAL_UPDATE_CHAR,*PSERIAL_UPDATE_CHAR;
  683. //
  684. // The following simple structure is used to send a pointer
  685. // the device extension and an ioctl specific pointer
  686. // to data.
  687. //
  688. typedef struct _SERIAL_IOCTL_SYNC {
  689. PSERIAL_DEVICE_EXTENSION Extension;
  690. PVOID Data;
  691. } SERIAL_IOCTL_SYNC,*PSERIAL_IOCTL_SYNC;
  692. #define SerialSetFlags(PDevExt, Value) \
  693. SerialSetDeviceFlags((PDevExt), &(PDevExt)->Flags, (Value), TRUE)
  694. #define SerialClearFlags(PDevExt, Value) \
  695. SerialSetDeviceFlags((PDevExt), &(PDevExt)->Flags, (Value), FALSE)
  696. #define SerialSetAccept(PDevExt, Value) \
  697. SerialSetDeviceFlags((PDevExt), &(PDevExt)->DevicePNPAccept, (Value), TRUE)
  698. #define SerialClearAccept(PDevExt, Value) \
  699. SerialSetDeviceFlags((PDevExt), &(PDevExt)->DevicePNPAccept, (Value), FALSE)
  700. //
  701. // The following three macros are used to initialize, set
  702. // and clear references in IRPs that are used by
  703. // this driver. The reference is stored in the fourth
  704. // argument of the irp, which is never used by any operation
  705. // accepted by this driver.
  706. //
  707. #define SERIAL_REF_ISR (0x00000001)
  708. #define SERIAL_REF_CANCEL (0x00000002)
  709. #define SERIAL_REF_TOTAL_TIMER (0x00000004)
  710. #define SERIAL_REF_INT_TIMER (0x00000008)
  711. #define SERIAL_REF_XOFF_REF (0x00000010)
  712. #define SERIAL_INIT_REFERENCE(Irp) { \
  713. ASSERT(sizeof(ULONG_PTR) <= sizeof(PVOID)); \
  714. IoGetCurrentIrpStackLocation((Irp))->Parameters.Others.Argument4 = NULL; \
  715. }
  716. #define SERIAL_SET_REFERENCE(Irp,RefType) \
  717. do { \
  718. LONG _refType = (RefType); \
  719. PULONG_PTR _arg4 = (PVOID)&IoGetCurrentIrpStackLocation((Irp))->Parameters.Others.Argument4; \
  720. ASSERT(!(*_arg4 & _refType)); \
  721. *_arg4 |= _refType; \
  722. } while (0)
  723. #define SERIAL_CLEAR_REFERENCE(Irp,RefType) \
  724. do { \
  725. LONG _refType = (RefType); \
  726. PULONG_PTR _arg4 = (PVOID)&IoGetCurrentIrpStackLocation((Irp))->Parameters.Others.Argument4; \
  727. ASSERT(*_arg4 & _refType); \
  728. *_arg4 &= ~_refType; \
  729. } while (0)
  730. #define SERIAL_REFERENCE_COUNT(Irp) \
  731. ((ULONG_PTR)((IoGetCurrentIrpStackLocation((Irp))->Parameters.Others.Argument4)))