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.

178 lines
5.7 KiB

  1. /*****************************************************************************
  2. ** **
  3. ** COPYRIGHT (C) 2000, 2001 MKNET CORPORATION **
  4. ** DEVELOPED FOR THE MK7100-BASED VFIR PCI CONTROLLER. **
  5. ** **
  6. *****************************************************************************/
  7. /**********************************************************************
  8. Module Name:
  9. WINCOMM.H
  10. Comments:
  11. **********************************************************************/
  12. #ifndef _WINCOMM_H
  13. #define _WINCOMM_H
  14. #define MK7_NDIS_MAJOR_VERSION 5
  15. #define MK7_NDIS_MINOR_VERSION 0
  16. #define MK7_DRIVER_VERSION ((MK7_NDIS_MAJOR_VERSION*0x100) + MK7_NDIS_MINOR_VERSION)
  17. #define MK7_MAJOR_VERSION 0
  18. #define MK7_MINOR_VERSION 1
  19. #define MK7_LETTER_VERSION 'a'
  20. // SIR
  21. #define NDIS_IRDA_SPEED_2400 (UINT)(0 << 0) // Not supported
  22. #define NDIS_IRDA_SPEED_9600 (UINT)(1 << 1)
  23. #define NDIS_IRDA_SPEED_19200 (UINT)(1 << 2)
  24. #define NDIS_IRDA_SPEED_38400 (UINT)(1 << 3)
  25. #define NDIS_IRDA_SPEED_57600 (UINT)(1 << 4)
  26. #define NDIS_IRDA_SPEED_115200 (UINT)(1 << 5)
  27. // MIR
  28. #define NDIS_IRDA_SPEED_576K (UINT)(1 << 6)
  29. #define NDIS_IRDA_SPEED_1152K (UINT)(1 << 7)
  30. // FIR
  31. #define NDIS_IRDA_SPEED_4M (UINT)(1 << 8)
  32. // VFIR
  33. #define NDIS_IRDA_SPEED_16M (UINT)(1 << 9)
  34. //
  35. // Speed bit masks
  36. //
  37. #define ALL_SLOW_IRDA_SPEEDS ( \
  38. NDIS_IRDA_SPEED_9600 | \
  39. NDIS_IRDA_SPEED_19200 | NDIS_IRDA_SPEED_38400 | \
  40. NDIS_IRDA_SPEED_57600 | NDIS_IRDA_SPEED_115200)
  41. #define ALL_IRDA_SPEEDS ( \
  42. ALL_SLOW_IRDA_SPEEDS | NDIS_IRDA_SPEED_576K | NDIS_IRDA_SPEED_1152K | \
  43. NDIS_IRDA_SPEED_4M | NDIS_IRDA_SPEED_16M)
  44. // For processing Registry entries
  45. #define MK7_OFFSET(field) ( (UINT) FIELD_OFFSET(MK7_ADAPTER,field) )
  46. #define MK7_SIZE(field) sizeof( ((MK7_ADAPTER *)0)->field )
  47. // NDIS multisend capability may send >1 pkt for TX at a time.
  48. // This comes down in an array. Since we queue them up and process
  49. // TX at a time, this number does not necessarily have to match
  50. // the count of TX ring size.
  51. #define MAX_ARRAY_SEND_PACKETS 8
  52. // limit our receive routine to indicating this many at a time
  53. // IMPORTANT: Keep this less than TCB or ringsize count for now or
  54. // the algorithm may break
  55. #define MAX_ARRAY_RECEIVE_PACKETS 16
  56. //#define MAX_ARRAY_RECEIVE_PACKETS 1
  57. #define NUM_BYTES_PROTOCOL_RESERVED_SECTION 16
  58. // NDIS BusType values
  59. #define ISABUS 1
  60. #define EISABUS 2
  61. #define PCIBUS 5
  62. // IRDA-5 ?
  63. //- Driver defaults
  64. #define LOOKAHEAD_SIZE 222
  65. //- Macros peculiar to NT
  66. //- The highest physical address that can be allocated to buffers.
  67. // Non-page system mem.
  68. // 1.0.0 NDIS requirements
  69. #define MEMORY_TAG 'tNKM'
  70. //#define ALLOC_SYS_MEM(_pbuffer, _length) NdisAllocateMemory( \
  71. // (PVOID*)(_pbuffer), \
  72. // (_length), \
  73. // 0, \
  74. // HighestAcceptableMax)
  75. #define ALLOC_SYS_MEM(_pbuffer, _length) NdisAllocateMemoryWithTag( \
  76. (PVOID*)(_pbuffer), \
  77. (_length), \
  78. (ULONG)MEMORY_TAG)
  79. #define FREE_SYS_MEM(_buffer,_length) NdisFreeMemory((_buffer), (_length), 0)
  80. #define MAX_PCI_CARDS 12
  81. //-------------------------------------------------------------------------
  82. // PCI Cards found - returns hardware info after scanning for devices
  83. //-------------------------------------------------------------------------
  84. typedef struct _PCI_CARDS_FOUND_STRUC
  85. {
  86. USHORT NumFound;
  87. struct
  88. {
  89. ULONG BaseIo;
  90. UCHAR ChipRevision;
  91. // ULONG SubVendor_DeviceID;
  92. USHORT SlotNumber; // Ndis Slot number
  93. // ULONG MemPhysAddress; // CSR Physical address
  94. UCHAR Irq;
  95. } PciSlotInfo[MAX_PCI_CARDS];
  96. } PCI_CARDS_FOUND_STRUC, *PPCI_CARDS_FOUND_STRUC;
  97. // Uniquely defines the location of the error
  98. #define MKLogError(_Adapt, _EvId, _ErrCode, _Spec1) \
  99. NdisWriteErrorLogEntry((NDIS_HANDLE)(_Adapt)->MK7AdapterHandle, \
  100. (NDIS_ERROR_CODE)(_ErrCode), (ULONG) 3, (ULONG)(_EvId), \
  101. (ULONG)(_Spec1), (ULONG_PTR)(_Adapt))
  102. // Each entry in the error log will be tagged with a unique event code so that
  103. // we'll be able to grep the driver source code for that specific event, and
  104. // get an idea of why that particular event was logged. Each time a new
  105. // "MKLogError" statement is added to the code, a new Event tag should be
  106. // added below.
  107. //
  108. // RYM10-2
  109. // "-" indicates being used in new code,
  110. // "x" not used in new code.
  111. // "X" not even used in the original code.
  112. typedef enum _MK_EVENT_VIEWER_CODES
  113. {
  114. EVENT_0, // - couldn't register the specified interrupt
  115. EVENT_1, // - One of our PCI cards didn't get required resources
  116. EVENT_2, // x bad node address (it was a multicast address)
  117. EVENT_3, // x failed self-test
  118. EVENT_4, // X Wait for SCB failed
  119. EVENT_5, // X NdisRegisterAdapter failed for the MAC driver
  120. EVENT_6, // x WaitSCB failed
  121. EVENT_7, // X Command complete status was never posted to the SCB
  122. EVENT_8, // X Couldn't find a phy at over-ride address 0
  123. EVENT_9, // x Invalid duplex or speed setting with the detected phy
  124. EVENT_10, // - Couldn't setup adapter memory
  125. EVENT_11, // - couldn't allocate enough map registers
  126. EVENT_12, // - couldn't allocate enough RRD/TRD non-cached memory
  127. EVENT_13, // - couldn't allocate enough RCB/RPD or TCB cached memory
  128. EVENT_14, // - couldn't allocate enough RX non-cached shared memory
  129. EVENT_15, // - couldn't allocate enough TX non-cached shared memory
  130. EVENT_16, // - Didn't find any PCI boards
  131. EVENT_17, // 11 // X Multiple PCI were found, but none matched our id.
  132. EVENT_18, // 12 // - NdisMPciAssignResources Error
  133. EVENT_19, // 13 // X Didn't Find Any PCI Boards that matched our subven/subdev
  134. EVENT_20, // 14 // x ran out of cached memory to allocate in async allocation
  135. EVENT_30 // 1e // X WAIT_TRUE timed out
  136. } MK_EVENT_VIEWER_CODES;
  137. #endif // _WINCOMM.H