Source code of Windows XP (NT5)
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.

153 lines
3.3 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1993 - 1998
  3. Module Name:
  4. epp.c
  5. Abstract:
  6. This module contains the common code to perform all EPP related tasks
  7. for EPP Software and EPP Hardware modes.
  8. Author:
  9. Don Redford - July 29, 1998
  10. Environment:
  11. Kernel mode
  12. Revision History :
  13. --*/
  14. #include "pch.h"
  15. NTSTATUS
  16. ParEppSetAddress(
  17. IN PDEVICE_EXTENSION Extension,
  18. IN UCHAR Address
  19. );
  20. NTSTATUS
  21. ParEppSetAddress(
  22. IN PDEVICE_EXTENSION Extension,
  23. IN UCHAR Address
  24. )
  25. /*++
  26. Routine Description:
  27. Sets an EPP Address.
  28. Arguments:
  29. Extension - Supplies the device extension.
  30. Address - The bus address to be set.
  31. Return Value:
  32. None.
  33. --*/
  34. {
  35. PUCHAR Controller;
  36. // LARGE_INTEGER Start;
  37. // LARGE_INTEGER End;
  38. // UCHAR dsr;
  39. UCHAR dcr;
  40. // dvdr
  41. ParDump2(PARINFO, ("ParEppSetAddress: Entering\n"));
  42. Controller = Extension->Controller;
  43. Extension->CurrentPhase = PHASE_FORWARD_XFER;
  44. dcr = GetControl (Controller);
  45. WRITE_PORT_UCHAR(Controller + DATA_OFFSET, Address);
  46. // KeStallExecutionProcessor(1);
  47. //
  48. // Event 56
  49. //
  50. dcr = UPDATE_DCR( dcr, DONT_CARE, DONT_CARE, DONT_CARE,
  51. INACTIVE, DONT_CARE, INACTIVE );
  52. StoreControl (Controller, dcr);
  53. //
  54. // Event 58
  55. //
  56. if (!CHECK_DSR(Controller,
  57. ACTIVE, DONT_CARE, DONT_CARE,
  58. DONT_CARE, DONT_CARE,
  59. DEFAULT_RECEIVE_TIMEOUT)) {
  60. //
  61. // Return the device to Idle.
  62. //
  63. dcr = UPDATE_DCR( dcr, DONT_CARE, DONT_CARE, DONT_CARE,
  64. ACTIVE, DONT_CARE, INACTIVE );
  65. StoreControl (Controller, dcr);
  66. // KeStallExecutionProcessor(1);
  67. dcr = UPDATE_DCR( dcr, DONT_CARE, DONT_CARE, DONT_CARE,
  68. ACTIVE, DONT_CARE, ACTIVE );
  69. StoreControl (Controller, dcr);
  70. Extension->CurrentPhase = PHASE_FORWARD_IDLE;
  71. // dvdr
  72. ParDump2(PARINFO, ("ParEppSetAddress: Leaving with IO Device Error Event 58\n"));
  73. return STATUS_IO_DEVICE_ERROR;
  74. }
  75. //
  76. // Event 59
  77. //
  78. dcr = UPDATE_DCR( dcr, DONT_CARE, DONT_CARE, DONT_CARE,
  79. ACTIVE, DONT_CARE, INACTIVE );
  80. StoreControl (Controller, dcr);
  81. //
  82. // Event 60
  83. //
  84. if (!CHECK_DSR(Controller,
  85. INACTIVE, DONT_CARE, DONT_CARE,
  86. DONT_CARE, DONT_CARE,
  87. DEFAULT_RECEIVE_TIMEOUT)) {
  88. dcr = UPDATE_DCR( dcr, DONT_CARE, DONT_CARE, DONT_CARE,
  89. ACTIVE, DONT_CARE, ACTIVE );
  90. StoreControl (Controller, dcr);
  91. Extension->CurrentPhase = PHASE_FORWARD_IDLE;
  92. // dvdr
  93. ParDump2(PARINFO, ("ParEppSetAddress: Leaving with IO Device Error Event 60\n"));
  94. return STATUS_IO_DEVICE_ERROR;
  95. }
  96. //
  97. // Event 61
  98. //
  99. dcr = UPDATE_DCR( dcr, DONT_CARE, DONT_CARE, DONT_CARE,
  100. ACTIVE, DONT_CARE, ACTIVE );
  101. StoreControl (Controller, dcr);
  102. Extension->CurrentPhase = PHASE_FORWARD_IDLE;
  103. // dvdr
  104. ParDump2(PARINFO, ("ParEppSetAddress: Leaving with STATUS_SUCCESS\n"));
  105. return STATUS_SUCCESS;
  106. }