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.

903 lines
19 KiB

  1. /*--------------------------------------------------------------------------
  2. *
  3. * Copyright (C) Cyclades Corporation, 1996-2001.
  4. * All rights reserved.
  5. *
  6. * Cyclom-Y Port Driver
  7. *
  8. * This file: cyyportp.h
  9. *
  10. * Description: Prototypes and macros that are used throughout
  11. * the driver.
  12. *
  13. * Notes: This code supports Windows 2000 and x86 processor.
  14. *
  15. * Complies with Cyclades SW Coding Standard rev 1.3.
  16. *
  17. *--------------------------------------------------------------------------
  18. */
  19. /*-------------------------------------------------------------------------
  20. *
  21. * Change History
  22. *
  23. *--------------------------------------------------------------------------
  24. *
  25. *
  26. *--------------------------------------------------------------------------
  27. */
  28. typedef
  29. NTSTATUS
  30. (*PSERIAL_START_ROUTINE) (
  31. IN PCYY_DEVICE_EXTENSION
  32. );
  33. typedef
  34. VOID
  35. (*PSERIAL_GET_NEXT_ROUTINE) (
  36. IN PIRP *CurrentOpIrp,
  37. IN PLIST_ENTRY QueueToProcess,
  38. OUT PIRP *NewIrp,
  39. IN BOOLEAN CompleteCurrent,
  40. PCYY_DEVICE_EXTENSION Extension
  41. );
  42. // cyyinit.c prototypes
  43. NTSTATUS
  44. DriverEntry(
  45. IN PDRIVER_OBJECT DriverObject,
  46. IN PUNICODE_STRING RegistryPath
  47. );
  48. VOID
  49. CyyDisableInterfacesResources(IN PDEVICE_OBJECT PDevObj,
  50. BOOLEAN DisableUART);
  51. VOID
  52. CyyKillPendingIrps(PDEVICE_OBJECT DeviceObject);
  53. CYY_MEM_COMPARES
  54. CyyMemCompare(
  55. IN PHYSICAL_ADDRESS A,
  56. IN ULONG SpanOfA,
  57. IN PHYSICAL_ADDRESS B,
  58. IN ULONG SpanOfB
  59. );
  60. VOID
  61. CyyReleaseResources(IN PCYY_DEVICE_EXTENSION PDevExt);
  62. NTSTATUS
  63. CyyRemoveDevObj(IN PDEVICE_OBJECT PDevObj);
  64. BOOLEAN
  65. CyyDoesPortExist(
  66. IN PCYY_DEVICE_EXTENSION Extension,
  67. IN PUNICODE_STRING InsertString
  68. );
  69. BOOLEAN
  70. CyyReset(
  71. IN PVOID Context
  72. );
  73. VOID
  74. CyyUnload(
  75. IN PDRIVER_OBJECT DriverObject
  76. );
  77. NTSTATUS
  78. CyyInitController(IN PDEVICE_OBJECT PDevObj, IN PCONFIG_DATA PConfigData);
  79. VOID
  80. CyyResetBoard( PCYY_DEVICE_EXTENSION Extension );
  81. NTSTATUS
  82. CyyFindInitController(IN PDEVICE_OBJECT PDevObj, IN PCONFIG_DATA PConfig);
  83. PUCHAR
  84. GetMyMappedCD1400Address(IN PUCHAR BoardMemory, IN ULONG PortIndex, IN ULONG IsPci);
  85. PHYSICAL_ADDRESS
  86. GetMyPhysicalCD1400Address(IN PHYSICAL_ADDRESS BoardMemory, IN ULONG PortIndex, IN ULONG IsPci);
  87. VOID
  88. CyyCommError(
  89. IN PKDPC Dpc,
  90. IN PVOID DeferredContext,
  91. IN PVOID SystemContext1,
  92. IN PVOID SystemContext2
  93. );
  94. // end cyyinit.c
  95. NTSTATUS
  96. CyyRead(
  97. IN PDEVICE_OBJECT DeviceObject,
  98. IN PIRP Irp
  99. );
  100. NTSTATUS
  101. CyyStartRead(
  102. IN PCYY_DEVICE_EXTENSION Extension
  103. );
  104. VOID
  105. CyyCompleteRead(
  106. IN PKDPC Dpc,
  107. IN PVOID DeferredContext,
  108. IN PVOID SystemContext1,
  109. IN PVOID SystemContext2
  110. );
  111. VOID
  112. CyyReadTimeout(
  113. IN PKDPC Dpc,
  114. IN PVOID DeferredContext,
  115. IN PVOID SystemContext1,
  116. IN PVOID SystemContext2
  117. );
  118. VOID
  119. CyyIntervalReadTimeout(
  120. IN PKDPC Dpc,
  121. IN PVOID DeferredContext,
  122. IN PVOID SystemContext1,
  123. IN PVOID SystemContext2
  124. );
  125. NTSTATUS
  126. CyyFlush(
  127. IN PDEVICE_OBJECT DeviceObject,
  128. IN PIRP Irp
  129. );
  130. NTSTATUS
  131. CyyWrite(
  132. IN PDEVICE_OBJECT DeviceObject,
  133. IN PIRP Irp
  134. );
  135. NTSTATUS
  136. CyyStartWrite(
  137. IN PCYY_DEVICE_EXTENSION Extension
  138. );
  139. VOID
  140. CyyGetNextWrite(
  141. IN PIRP *CurrentOpIrp,
  142. IN PLIST_ENTRY QueueToProcess,
  143. IN PIRP *NewIrp,
  144. IN BOOLEAN CompleteCurrent,
  145. IN PCYY_DEVICE_EXTENSION Extension
  146. );
  147. VOID
  148. CyyCompleteWrite(
  149. IN PKDPC Dpc,
  150. IN PVOID DeferredContext,
  151. IN PVOID SystemContext1,
  152. IN PVOID SystemContext2
  153. );
  154. BOOLEAN
  155. CyyTxStart(
  156. IN PVOID Context
  157. );
  158. BOOLEAN
  159. CyySendXon(
  160. IN PVOID Context
  161. );
  162. BOOLEAN
  163. CyySendXoff(
  164. IN PVOID Context
  165. );
  166. BOOLEAN
  167. CyyProcessEmptyTransmit(
  168. IN PVOID Context
  169. );
  170. VOID
  171. CyyWriteTimeout(
  172. IN PKDPC Dpc,
  173. IN PVOID DeferredContext,
  174. IN PVOID SystemContext1,
  175. IN PVOID SystemContext2
  176. );
  177. NTSTATUS
  178. CyyCleanup(
  179. IN PDEVICE_OBJECT DeviceObject,
  180. IN PIRP Irp
  181. );
  182. NTSTATUS
  183. CyyCreateOpen(
  184. IN PDEVICE_OBJECT DeviceObject,
  185. IN PIRP Irp
  186. );
  187. NTSTATUS
  188. CyyClose(
  189. IN PDEVICE_OBJECT DeviceObject,
  190. IN PIRP Irp
  191. );
  192. VOID
  193. CyyDisableCd1400Channel(IN PVOID Context);
  194. BOOLEAN
  195. CyySetDTR(
  196. IN PVOID Context
  197. );
  198. BOOLEAN
  199. CyyClrDTR(
  200. IN PVOID Context
  201. );
  202. BOOLEAN
  203. CyySetRTS(
  204. IN PVOID Context
  205. );
  206. BOOLEAN
  207. CyyClrRTS(
  208. IN PVOID Context
  209. );
  210. BOOLEAN
  211. CyyGetDTRRTS(
  212. IN PVOID Context
  213. );
  214. BOOLEAN
  215. CyySetChars(
  216. IN PVOID Context
  217. );
  218. BOOLEAN
  219. CyySetBaud(
  220. IN PVOID Context
  221. );
  222. BOOLEAN
  223. CyySetLineControl(
  224. IN PVOID Context
  225. );
  226. BOOLEAN
  227. CyySetupNewHandFlow(
  228. IN PCYY_DEVICE_EXTENSION Extension,
  229. IN PSERIAL_HANDFLOW NewHandFlow
  230. );
  231. BOOLEAN
  232. CyySetHandFlow(
  233. IN PVOID Context
  234. );
  235. BOOLEAN
  236. CyyTurnOnBreak(
  237. IN PVOID Context
  238. );
  239. BOOLEAN
  240. CyyTurnOffBreak(
  241. IN PVOID Context
  242. );
  243. BOOLEAN
  244. CyyPretendXoff(
  245. IN PVOID Context
  246. );
  247. BOOLEAN
  248. CyyPretendXon(
  249. IN PVOID Context
  250. );
  251. VOID
  252. CyyHandleReducedIntBuffer(
  253. IN PCYY_DEVICE_EXTENSION Extension
  254. );
  255. VOID
  256. CyyProdXonXoff(
  257. IN PCYY_DEVICE_EXTENSION Extension,
  258. IN BOOLEAN SendXon
  259. );
  260. NTSTATUS
  261. CyyIoControl(
  262. IN PDEVICE_OBJECT DeviceObject,
  263. IN PIRP Irp
  264. );
  265. NTSTATUS
  266. CyyStartMask(
  267. IN PCYY_DEVICE_EXTENSION Extension
  268. );
  269. VOID
  270. CyyCancelWait(
  271. IN PDEVICE_OBJECT DeviceObject,
  272. IN PIRP Irp
  273. );
  274. VOID
  275. CyyCompleteWait(
  276. IN PKDPC Dpc,
  277. IN PVOID DeferredContext,
  278. IN PVOID SystemContext1,
  279. IN PVOID SystemContext2
  280. );
  281. VOID
  282. CyyStartImmediate(
  283. IN PCYY_DEVICE_EXTENSION Extension
  284. );
  285. VOID
  286. CyyCompleteImmediate(
  287. IN PKDPC Dpc,
  288. IN PVOID DeferredContext,
  289. IN PVOID SystemContext1,
  290. IN PVOID SystemContext2
  291. );
  292. VOID
  293. CyyTimeoutImmediate(
  294. IN PKDPC Dpc,
  295. IN PVOID DeferredContext,
  296. IN PVOID SystemContext1,
  297. IN PVOID SystemContext2
  298. );
  299. VOID
  300. CyyTimeoutXoff(
  301. IN PKDPC Dpc,
  302. IN PVOID DeferredContext,
  303. IN PVOID SystemContext1,
  304. IN PVOID SystemContext2
  305. );
  306. VOID
  307. CyyCompleteXoff(
  308. IN PKDPC Dpc,
  309. IN PVOID DeferredContext,
  310. IN PVOID SystemContext1,
  311. IN PVOID SystemContext2
  312. );
  313. NTSTATUS
  314. CyyStartPurge(
  315. IN PCYY_DEVICE_EXTENSION Extension
  316. );
  317. BOOLEAN
  318. CyyPurgeInterruptBuff(
  319. IN PVOID Context
  320. );
  321. NTSTATUS
  322. CyyQueryInformationFile(
  323. IN PDEVICE_OBJECT DeviceObject,
  324. IN PIRP Irp
  325. );
  326. NTSTATUS
  327. CyySetInformationFile(
  328. IN PDEVICE_OBJECT DeviceObject,
  329. IN PIRP Irp
  330. );
  331. VOID
  332. CyyKillAllReadsOrWrites(
  333. IN PDEVICE_OBJECT DeviceObject,
  334. IN PLIST_ENTRY QueueToClean,
  335. IN PIRP *CurrentOpIrp
  336. );
  337. VOID
  338. CyyGetNextIrp(
  339. IN PIRP *CurrentOpIrp,
  340. IN PLIST_ENTRY QueueToProcess,
  341. OUT PIRP *NextIrp,
  342. IN BOOLEAN CompleteCurrent,
  343. IN PCYY_DEVICE_EXTENSION Extension
  344. );
  345. VOID
  346. CyyTryToCompleteCurrent(
  347. IN PCYY_DEVICE_EXTENSION Extension,
  348. IN PKSYNCHRONIZE_ROUTINE SynchRoutine OPTIONAL,
  349. IN KIRQL IrqlForRelease,
  350. IN NTSTATUS StatusToUse,
  351. IN PIRP *CurrentOpIrp,
  352. IN PLIST_ENTRY QueueToProcess,
  353. IN PKTIMER IntervalTimer,
  354. IN PKTIMER TotalTimer,
  355. IN PSERIAL_START_ROUTINE Starter,
  356. IN PSERIAL_GET_NEXT_ROUTINE GetNextIrp,
  357. IN LONG RefType
  358. );
  359. NTSTATUS
  360. CyyStartOrQueue(
  361. IN PCYY_DEVICE_EXTENSION Extension,
  362. IN PIRP Irp,
  363. IN PLIST_ENTRY QueueToExamine,
  364. IN PIRP *CurrentOpIrp,
  365. IN PSERIAL_START_ROUTINE Starter
  366. );
  367. VOID
  368. CyyCancelQueued(
  369. PDEVICE_OBJECT DeviceObject,
  370. PIRP Irp
  371. );
  372. NTSTATUS
  373. CyyCompleteIfError(
  374. PDEVICE_OBJECT DeviceObject,
  375. PIRP Irp
  376. );
  377. ULONG
  378. CyyHandleModemUpdate(
  379. IN PCYY_DEVICE_EXTENSION Extension,
  380. IN BOOLEAN DoingTX
  381. );
  382. ULONG
  383. CyyHandleModemUpdateForModem(
  384. IN PCYY_DEVICE_EXTENSION Extension,
  385. IN BOOLEAN DoingTX,
  386. IN UCHAR misr
  387. );
  388. BOOLEAN
  389. CyyIsr(
  390. IN PKINTERRUPT InterruptObject,
  391. IN PVOID Context
  392. );
  393. BOOLEAN
  394. CyyDispatchISR(
  395. IN PKINTERRUPT InterruptObject,
  396. IN PVOID Context
  397. );
  398. BOOLEAN
  399. CyyPerhapsLowerRTS(
  400. IN PVOID Context
  401. );
  402. VOID
  403. CyyStartTimerLowerRTS(
  404. IN PKDPC Dpc,
  405. IN PVOID DeferredContext,
  406. IN PVOID SystemContext1,
  407. IN PVOID SystemContext2
  408. );
  409. VOID
  410. CyyInvokePerhapsLowerRTS(
  411. IN PKDPC Dpc,
  412. IN PVOID DeferredContext,
  413. IN PVOID SystemContext1,
  414. IN PVOID SystemContext2
  415. );
  416. VOID
  417. CyyCleanupDevice(
  418. IN PCYY_DEVICE_EXTENSION Extension
  419. );
  420. BOOLEAN
  421. CyyProcessLSR(
  422. IN PCYY_DEVICE_EXTENSION Extension,
  423. IN UCHAR Rdsr,
  424. IN UCHAR RxChar
  425. );
  426. LARGE_INTEGER
  427. CyyGetCharTime(
  428. IN PCYY_DEVICE_EXTENSION Extension
  429. );
  430. BOOLEAN
  431. CyySharerIsr(
  432. IN PKINTERRUPT InterruptObject,
  433. IN PVOID Context
  434. );
  435. BOOLEAN
  436. CyyMarkClose(
  437. IN PVOID Context
  438. );
  439. BOOLEAN
  440. CyyIndexedMultiportIsr(
  441. IN PKINTERRUPT InterruptObject,
  442. IN PVOID Context
  443. );
  444. BOOLEAN
  445. CyyBitMappedMultiportIsr(
  446. IN PKINTERRUPT InterruptObject,
  447. IN PVOID Context
  448. );
  449. VOID
  450. CyyPutChar(
  451. IN PCYY_DEVICE_EXTENSION Extension,
  452. IN UCHAR CharToPut
  453. );
  454. BOOLEAN
  455. CyyGetStats(
  456. IN PVOID Context
  457. );
  458. BOOLEAN
  459. CyyClearStats(
  460. IN PVOID Context
  461. );
  462. VOID
  463. CyyLog(
  464. IN PDRIVER_OBJECT DriverObject,
  465. NTSTATUS msgId
  466. );
  467. VOID
  468. CyyLogData(
  469. IN PDRIVER_OBJECT DriverObject,
  470. NTSTATUS msgId,
  471. ULONG dump1,
  472. ULONG dump2
  473. );
  474. VOID
  475. CyyILog(
  476. IN PDRIVER_OBJECT DriverObject,
  477. NTSTATUS msgId
  478. );
  479. VOID
  480. CyyILogParam(
  481. IN PDRIVER_OBJECT DriverObject,
  482. NTSTATUS msgId,
  483. ULONG dumpParameter,
  484. ULONG base
  485. );
  486. VOID
  487. CyyCDCmd(
  488. PCYY_DEVICE_EXTENSION Extension,
  489. UCHAR cmd
  490. );
  491. // cyreg.c
  492. NTSTATUS
  493. CyyGetConfigDefaults(
  494. IN PCYY_REGISTRY_DATA DriverDefaultsPtr,
  495. IN PUNICODE_STRING RegistryPath
  496. );
  497. NTSTATUS
  498. CyyGetRegistryKeyValue (
  499. IN HANDLE Handle,
  500. IN PWCHAR KeyNameString,
  501. IN ULONG KeyNameStringLength,
  502. IN PVOID Data,
  503. IN ULONG DataLength
  504. );
  505. ULONG
  506. CyyGetRegistryKeyValueLength (
  507. IN HANDLE Handle,
  508. IN PWCHAR KeyNameString,
  509. IN ULONG KeyNameStringLength);
  510. NTSTATUS
  511. CyyPutRegistryKeyValue(IN HANDLE Handle, IN PWCHAR PKeyNameString,
  512. IN ULONG KeyNameStringLength, IN ULONG Dtype,
  513. IN PVOID PData, IN ULONG DataLength);
  514. // cyypnp.c
  515. NTSTATUS
  516. CyyAddDevice(
  517. IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PLowerDevObj);
  518. //NTSTATUS
  519. //CyyCreateDevObj(IN PDRIVER_OBJECT DriverObject,
  520. // OUT PDEVICE_OBJECT *NewDeviceObject);
  521. NTSTATUS
  522. CyyCreateDevObj(IN PDRIVER_OBJECT DriverObject,
  523. IN PDEVICE_OBJECT PPdo,
  524. OUT PDEVICE_OBJECT *NewDeviceObject);
  525. NTSTATUS
  526. CyyFinishStartDevice(IN PDEVICE_OBJECT PDevObj,
  527. IN PCM_RESOURCE_LIST PResList,
  528. IN PCM_RESOURCE_LIST PTrResList);
  529. NTSTATUS
  530. CyyGetPortInfo(IN PDEVICE_OBJECT PDevObj, IN PCM_RESOURCE_LIST PResList,
  531. IN PCM_RESOURCE_LIST PTrResList, OUT PCONFIG_DATA PConfig);
  532. NTSTATUS
  533. CyyStartDevice(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp);
  534. NTSTATUS
  535. CyySyncCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp,
  536. IN PKEVENT CyySyncEvent);
  537. NTSTATUS
  538. CyyPnpDispatch(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp);
  539. NTSTATUS
  540. CyyDoExternalNaming(IN PCYY_DEVICE_EXTENSION PDevExt,
  541. IN PDRIVER_OBJECT PDrvObj);
  542. VOID
  543. CyyUndoExternalNaming(IN PCYY_DEVICE_EXTENSION Extension);
  544. UINT32
  545. CyyReportMaxBaudRate(ULONG Bauds);
  546. // cyyioctl.c
  547. VOID
  548. CyyGetProperties(
  549. IN PCYY_DEVICE_EXTENSION Extension,
  550. IN PSERIAL_COMMPROP Properties
  551. );
  552. NTSTATUS
  553. CyyInternalIoControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
  554. BOOLEAN
  555. CyySetMCRContents(IN PVOID Context);
  556. BOOLEAN
  557. CyyGetMCRContents(IN PVOID Context);
  558. BOOLEAN
  559. CyySetFCRContents(IN PVOID Context);
  560. // cypower.c
  561. NTSTATUS
  562. CyyPowerDispatch(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp);
  563. NTSTATUS
  564. CyyGotoPowerState(IN PDEVICE_OBJECT PDevObj,
  565. IN PCYY_DEVICE_EXTENSION PDevExt,
  566. IN DEVICE_POWER_STATE DevPowerState);
  567. NTSTATUS
  568. CyySendWaitWake(PCYY_DEVICE_EXTENSION PDevExt);
  569. //VOID
  570. //CyyRestoreDeviceState(IN PCYY_DEVICE_EXTENSION PDevExt);
  571. BOOLEAN
  572. CyyRestoreDeviceState(
  573. IN PVOID Context
  574. );
  575. NTSTATUS
  576. CyySetPowerD0(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp);
  577. NTSTATUS
  578. CyySetPowerD3(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp);
  579. //VOID
  580. //CyySaveDeviceState(IN PCYY_DEVICE_EXTENSION PDevExt);
  581. BOOLEAN
  582. CyySaveDeviceState(
  583. IN PVOID Context
  584. );
  585. NTSTATUS
  586. CyyWakeCompletion(IN PDEVICE_OBJECT PDevObj, IN UCHAR MinorFunction,
  587. IN POWER_STATE PowerState, IN PVOID Context,
  588. IN PIO_STATUS_BLOCK IoStatus);
  589. // cywmi.c
  590. NTSTATUS
  591. CyyQueryWmiDataBlock(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp,
  592. IN ULONG GuidIndex,
  593. IN ULONG InstanceIndex,
  594. IN ULONG InstanceCount,
  595. IN OUT PULONG InstanceLengthArray,
  596. IN ULONG OutBufferSize,
  597. OUT PUCHAR PBuffer);
  598. NTSTATUS
  599. CyyQueryWmiRegInfo(IN PDEVICE_OBJECT PDevObj, OUT PULONG PRegFlags,
  600. OUT PUNICODE_STRING PInstanceName,
  601. OUT PUNICODE_STRING *PRegistryPath,
  602. OUT PUNICODE_STRING MofResourceName,
  603. OUT PDEVICE_OBJECT *Pdo);
  604. NTSTATUS
  605. CyySetWmiDataBlock(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp,
  606. IN ULONG GuidIndex, IN ULONG InstanceIndex,
  607. IN ULONG BufferSize,
  608. IN PUCHAR PBuffer);
  609. NTSTATUS
  610. CyySetWmiDataItem(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp,
  611. IN ULONG GuidIndex, IN ULONG InstanceIndex,
  612. IN ULONG DataItemId,
  613. IN ULONG BufferSize, IN PUCHAR PBuffer);
  614. NTSTATUS
  615. CyySystemControlDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
  616. NTSTATUS
  617. CyyTossWMIRequest(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp,
  618. IN ULONG GuidIndex);
  619. // cyyutils.c
  620. BOOLEAN
  621. CyyCancelTimer(IN PKTIMER Timer, IN PCYY_DEVICE_EXTENSION PDevExt);
  622. VOID
  623. CyyDpcEpilogue(IN PCYY_DEVICE_EXTENSION PDevExt, PKDPC PDpc);
  624. VOID
  625. CyyGetNextIrpLocked(
  626. IN PIRP *CurrentOpIrp,
  627. IN PLIST_ENTRY QueueToProcess,
  628. OUT PIRP *NextIrp,
  629. IN BOOLEAN CompleteCurrent,
  630. IN PCYY_DEVICE_EXTENSION extension,
  631. IN KIRQL OldIrql
  632. );
  633. BOOLEAN
  634. CyyInsertQueueDpc(IN PRKDPC PDpc, IN PVOID Sarg1, IN PVOID Sarg2,
  635. IN PCYY_DEVICE_EXTENSION PDevExt);
  636. NTSTATUS
  637. CyyIRPPrologue(IN PIRP PIrp, IN PCYY_DEVICE_EXTENSION PDevExt);
  638. VOID
  639. CyyIRPEpilogue(IN PCYY_DEVICE_EXTENSION PDevExt);
  640. NTSTATUS
  641. CyyIoCallDriver(PCYY_DEVICE_EXTENSION PDevExt, PDEVICE_OBJECT PDevObj,
  642. PIRP PIrp);
  643. VOID
  644. CyyKillAllStalled(IN PDEVICE_OBJECT PDevObj);
  645. VOID
  646. CyyLogError(
  647. IN PDRIVER_OBJECT DriverObject,
  648. IN PDEVICE_OBJECT DeviceObject OPTIONAL,
  649. IN PHYSICAL_ADDRESS P1,
  650. IN PHYSICAL_ADDRESS P2,
  651. IN ULONG SequenceNumber,
  652. IN UCHAR MajorFunctionCode,
  653. IN UCHAR RetryCount,
  654. IN ULONG UniqueErrorValue,
  655. IN NTSTATUS FinalStatus,
  656. IN NTSTATUS SpecificIOStatus,
  657. IN ULONG LengthOfInsert1,
  658. IN PWCHAR Insert1,
  659. IN ULONG LengthOfInsert2,
  660. IN PWCHAR Insert2
  661. );
  662. VOID
  663. CyyMarkHardwareBroken(IN PCYY_DEVICE_EXTENSION PDevExt);
  664. NTSTATUS
  665. CyyPoCallDriver(PCYY_DEVICE_EXTENSION PDevExt, PDEVICE_OBJECT PDevObj,
  666. PIRP PIrp);
  667. VOID
  668. CyySetDeviceFlags(IN PCYY_DEVICE_EXTENSION PDevExt, OUT PULONG PFlags,
  669. IN ULONG Value, IN BOOLEAN Set);
  670. BOOLEAN
  671. CyySetTimer(IN PKTIMER Timer, IN LARGE_INTEGER DueTime,
  672. IN PKDPC Dpc OPTIONAL, IN PCYY_DEVICE_EXTENSION PDevExt);
  673. VOID
  674. CyyUnlockPages(IN PKDPC PDpc, IN PVOID PDeferredContext,
  675. IN PVOID PSysContext1, IN PVOID PSysContext2);
  676. VOID
  677. CyyUnstallIrps(IN PCYY_DEVICE_EXTENSION PDevExt);
  678. // End of prototypes
  679. typedef struct _SERIAL_UPDATE_CHAR {
  680. PCYY_DEVICE_EXTENSION Extension;
  681. ULONG CharsCopied;
  682. BOOLEAN Completed;
  683. } SERIAL_UPDATE_CHAR,*PSERIAL_UPDATE_CHAR;
  684. //
  685. // The following simple structure is used to send a pointer
  686. // the device extension and an ioctl specific pointer
  687. // to data.
  688. //
  689. typedef struct _CYY_IOCTL_SYNC {
  690. PCYY_DEVICE_EXTENSION Extension;
  691. PVOID Data;
  692. } CYY_IOCTL_SYNC,*PCYY_IOCTL_SYNC;
  693. typedef struct _CYY_IOCTL_BAUD {
  694. PCYY_DEVICE_EXTENSION Extension;
  695. ULONG Baud;
  696. } CYY_IOCTL_BAUD,*PCYY_IOCTL_BAUD;
  697. #define CyySetFlags(PDevExt, Value) \
  698. CyySetDeviceFlags((PDevExt), &(PDevExt)->Flags, (Value), TRUE)
  699. #define CyyClearFlags(PDevExt, Value) \
  700. CyySetDeviceFlags((PDevExt), &(PDevExt)->Flags, (Value), FALSE)
  701. #define CyySetAccept(PDevExt, Value) \
  702. CyySetDeviceFlags((PDevExt), &(PDevExt)->DevicePNPAccept, (Value), TRUE)
  703. #define CyyClearAccept(PDevExt, Value) \
  704. CyySetDeviceFlags((PDevExt), &(PDevExt)->DevicePNPAccept, (Value), FALSE)
  705. //
  706. // The following three macros are used to initialize, set
  707. // and clear references in IRPs that are used by
  708. // this driver. The reference is stored in the fourth
  709. // argument of the irp, which is never used by any operation
  710. // accepted by this driver.
  711. //
  712. #define SERIAL_REF_ISR (0x00000001)
  713. #define SERIAL_REF_CANCEL (0x00000002)
  714. #define SERIAL_REF_TOTAL_TIMER (0x00000004)
  715. #define SERIAL_REF_INT_TIMER (0x00000008)
  716. #define SERIAL_REF_XOFF_REF (0x00000010)
  717. #define SERIAL_INIT_REFERENCE(Irp) { \
  718. ASSERT(sizeof(ULONG_PTR) <= sizeof(PVOID)); \
  719. IoGetCurrentIrpStackLocation((Irp))->Parameters.Others.Argument4 = NULL; \
  720. }
  721. #define SERIAL_SET_REFERENCE(Irp,RefType) \
  722. do { \
  723. LONG _refType = (RefType); \
  724. PULONG_PTR _arg4 = (PVOID)&IoGetCurrentIrpStackLocation((Irp))->Parameters.Others.Argument4; \
  725. ASSERT(!(*_arg4 & _refType)); \
  726. *_arg4 |= _refType; \
  727. } while (0)
  728. #define SERIAL_CLEAR_REFERENCE(Irp,RefType) \
  729. do { \
  730. LONG _refType = (RefType); \
  731. PULONG_PTR _arg4 = (PVOID)&IoGetCurrentIrpStackLocation((Irp))->Parameters.Others.Argument4; \
  732. ASSERT(*_arg4 & _refType); \
  733. *_arg4 &= ~_refType; \
  734. } while (0)
  735. #define SERIAL_REFERENCE_COUNT(Irp) \
  736. ((ULONG_PTR)((IoGetCurrentIrpStackLocation((Irp))->Parameters.Others.Argument4)))