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.

165 lines
4.9 KiB

  1. /****************************************************************************
  2. ** COPYRIGHT (C) 1994-1997 INTEL CORPORATION **
  3. ** DEVELOPED FOR MICROSOFT BY INTEL CORP., HILLSBORO, OREGON **
  4. ** HTTP://WWW.INTEL.COM/ **
  5. ** THIS FILE IS PART OF THE INTEL ETHEREXPRESS PRO/100B(TM) AND **
  6. ** ETHEREXPRESS PRO/100+(TM) NDIS 5.0 MINIPORT SAMPLE DRIVER **
  7. ****************************************************************************/
  8. /****************************************************************************
  9. Module Name:
  10. e100_sup.h (inlinef.h)
  11. This driver runs on the following hardware:
  12. - 82558 based PCI 10/100Mb ethernet adapters
  13. (aka Intel EtherExpress(TM) PRO Adapters)
  14. Environment:
  15. Kernel Mode - Or whatever is the equivalent on WinNT
  16. Revision History
  17. - JCB 8/14/97 Example Driver Created
  18. - Dchen 11-01-99 Modified for the new sample driver
  19. *****************************************************************************/
  20. //-----------------------------------------------------------------------------
  21. // Procedure: WaitScb
  22. //
  23. // Description: This routine checks to see if the D100 has accepted a command.
  24. // It does so by checking the command field in the SCB, which will
  25. // be zeroed by the D100 upon accepting a command. The loop waits
  26. // for up to 600 milliseconds for command acceptance.
  27. //
  28. // Arguments:
  29. // Adapter - ptr to Adapter object instance
  30. //
  31. // Returns:
  32. // TRUE if the SCB cleared within 600 milliseconds.
  33. // FALSE if it didn't clear within 600 milliseconds
  34. //-----------------------------------------------------------------------------
  35. __inline BOOLEAN WaitScb(
  36. IN PMP_ADAPTER Adapter)
  37. {
  38. BOOLEAN bResult;
  39. HW_CSR volatile *pCSRAddress = Adapter->CSRAddress;
  40. MP_STALL_AND_WAIT(pCSRAddress->ScbCommandLow == 0, 600, bResult);
  41. if(!bResult)
  42. {
  43. DBGPRINT(MP_ERROR, ("WaitScb failed, ScbCommandLow=%x\n", pCSRAddress->ScbCommandLow));
  44. if(pCSRAddress->ScbCommandLow != 0x80)
  45. {
  46. ASSERT(FALSE);
  47. }
  48. MP_SET_HARDWARE_ERROR(Adapter);
  49. }
  50. return bResult;
  51. }
  52. //-----------------------------------------------------------------------------
  53. // Procedure: D100IssueScbCommand
  54. //
  55. // Description: This general routine will issue a command to the D100.
  56. //
  57. // Arguments:
  58. // Adapter - ptr to Adapter object instance.
  59. // ScbCommand - The command that is to be issued
  60. // WaitForSCB - A boolean value indicating whether or not a wait for SCB
  61. // must be done before the command is issued to the chip
  62. //
  63. // Returns:
  64. // TRUE if the command was issued to the chip successfully
  65. // FALSE if the command was not issued to the chip
  66. //-----------------------------------------------------------------------------
  67. __inline NDIS_STATUS D100IssueScbCommand(
  68. IN PMP_ADAPTER Adapter,
  69. IN UCHAR ScbCommandLow,
  70. IN BOOLEAN WaitForScb)
  71. {
  72. if(WaitForScb == TRUE)
  73. {
  74. if(!WaitScb(Adapter))
  75. {
  76. return(NDIS_STATUS_HARD_ERRORS);
  77. }
  78. }
  79. Adapter->CSRAddress->ScbCommandLow = ScbCommandLow;
  80. return(NDIS_STATUS_SUCCESS);
  81. }
  82. // routines.c
  83. BOOLEAN MdiRead(
  84. IN PMP_ADAPTER Adapter,
  85. IN ULONG RegAddress,
  86. IN ULONG PhyAddress,
  87. IN BOOLEAN Recoverable,
  88. IN OUT PUSHORT DataValue);
  89. VOID MdiWrite(
  90. IN PMP_ADAPTER Adapter,
  91. IN ULONG RegAddress,
  92. IN ULONG PhyAddress,
  93. IN USHORT DataValue);
  94. NDIS_STATUS D100SubmitCommandBlockAndWait(IN PMP_ADAPTER Adapter);
  95. VOID DumpStatsCounters(IN PMP_ADAPTER Adapter);
  96. NDIS_MEDIA_STATE NICGetMediaState(IN PMP_ADAPTER Adapter);
  97. VOID NICIssueSelectiveReset(PMP_ADAPTER Adapter);
  98. VOID NICIssueFullReset(PMP_ADAPTER Adapter);
  99. // physet.c
  100. VOID ResetPhy(IN PMP_ADAPTER Adapter);
  101. NDIS_STATUS PhyDetect(IN PMP_ADAPTER Adapter);
  102. NDIS_STATUS ScanAndSetupPhy(IN PMP_ADAPTER Adapter);
  103. VOID SelectPhy(
  104. IN PMP_ADAPTER Adapter,
  105. IN UINT SelectPhyAddress,
  106. IN BOOLEAN WaitAutoNeg);
  107. NDIS_STATUS SetupPhy(
  108. IN PMP_ADAPTER Adapter);
  109. VOID FindPhySpeedAndDpx(
  110. IN PMP_ADAPTER Adapter,
  111. IN UINT PhyId);
  112. // eeprom.c
  113. USHORT GetEEpromAddressSize(
  114. IN USHORT Size);
  115. USHORT GetEEpromSize(
  116. IN PUCHAR CSRBaseIoAddress);
  117. USHORT ReadEEprom(
  118. IN PUCHAR CSRBaseIoAddress,
  119. IN USHORT Reg,
  120. IN USHORT AddressSize);
  121. VOID ShiftOutBits(
  122. IN USHORT data,
  123. IN USHORT count,
  124. IN PUCHAR CSRBaseIoAddress);
  125. USHORT ShiftInBits(
  126. IN PUCHAR CSRBaseIoAddress);
  127. VOID RaiseClock(
  128. IN OUT USHORT *x,
  129. IN PUCHAR CSRBaseIoAddress);
  130. VOID LowerClock(
  131. IN OUT USHORT *x,
  132. IN PUCHAR CSRBaseIoAddress);
  133. VOID EEpromCleanup(
  134. IN PUCHAR CSRBaseIoAddress);