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.

131 lines
2.7 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 PPDO_EXTENSION Pdx,
  18. IN UCHAR Address
  19. );
  20. NTSTATUS
  21. ParEppSetAddress(
  22. IN PPDO_EXTENSION Pdx,
  23. IN UCHAR Address
  24. )
  25. /*++
  26. Routine Description:
  27. Sets an EPP Address.
  28. Arguments:
  29. Pdx - Supplies the device extension.
  30. Address - The bus address to be set.
  31. Return Value:
  32. None.
  33. --*/
  34. {
  35. PUCHAR Controller;
  36. UCHAR dcr;
  37. DD((PCE)Pdx,DDT,"ParEppSetAddress: Entering\n");
  38. Controller = Pdx->Controller;
  39. P5SetPhase( Pdx, PHASE_FORWARD_XFER );
  40. dcr = GetControl (Controller);
  41. P5WritePortUchar(Controller + DATA_OFFSET, Address);
  42. //
  43. // Event 56
  44. //
  45. dcr = UPDATE_DCR( dcr, DONT_CARE, DONT_CARE, DONT_CARE, INACTIVE, DONT_CARE, INACTIVE );
  46. StoreControl (Controller, dcr);
  47. //
  48. // Event 58
  49. //
  50. if( !CHECK_DSR(Controller, ACTIVE, DONT_CARE, DONT_CARE, DONT_CARE, DONT_CARE, DEFAULT_RECEIVE_TIMEOUT) ) {
  51. //
  52. // Return the device to Idle.
  53. //
  54. dcr = UPDATE_DCR( dcr, DONT_CARE, DONT_CARE, DONT_CARE, ACTIVE, DONT_CARE, INACTIVE );
  55. StoreControl (Controller, dcr);
  56. dcr = UPDATE_DCR( dcr, DONT_CARE, DONT_CARE, DONT_CARE, ACTIVE, DONT_CARE, ACTIVE );
  57. StoreControl (Controller, dcr);
  58. P5SetPhase( Pdx, PHASE_FORWARD_IDLE );
  59. DD((PCE)Pdx,DDE,"ParEppSetAddress: Leaving with IO Device Error Event 58\n");
  60. return STATUS_IO_DEVICE_ERROR;
  61. }
  62. //
  63. // Event 59
  64. //
  65. dcr = UPDATE_DCR( dcr, DONT_CARE, DONT_CARE, DONT_CARE, ACTIVE, DONT_CARE, INACTIVE );
  66. StoreControl (Controller, dcr);
  67. //
  68. // Event 60
  69. //
  70. if( !CHECK_DSR(Controller, INACTIVE, DONT_CARE, DONT_CARE, DONT_CARE, DONT_CARE, DEFAULT_RECEIVE_TIMEOUT) ) {
  71. dcr = UPDATE_DCR( dcr, DONT_CARE, DONT_CARE, DONT_CARE, ACTIVE, DONT_CARE, ACTIVE );
  72. StoreControl (Controller, dcr);
  73. P5SetPhase( Pdx, PHASE_FORWARD_IDLE );
  74. DD((PCE)Pdx,DDE,"ParEppSetAddress - Leaving with IO Device Error Event 60\n");
  75. return STATUS_IO_DEVICE_ERROR;
  76. }
  77. //
  78. // Event 61
  79. //
  80. dcr = UPDATE_DCR( dcr, DONT_CARE, DONT_CARE, DONT_CARE, ACTIVE, DONT_CARE, ACTIVE );
  81. StoreControl( Controller, dcr );
  82. P5SetPhase( Pdx, PHASE_FORWARD_IDLE );
  83. return STATUS_SUCCESS;
  84. }