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.

231 lines
5.3 KiB

  1. // Warning, this file is going away.
  2. // It has been replaced with smbus.h which has been added to the DDK
  3. /*++
  4. Copyright (c) 1990 Microsoft Corporation
  5. Module Name:
  6. smb.h
  7. Abstract:
  8. SMBus Class Driver Header File
  9. Author:
  10. Ken Reneris
  11. Environment:
  12. Notes:
  13. Revision History:
  14. --*/
  15. //
  16. // SMB Request packet
  17. //
  18. #define SMB_MAX_DATA_SIZE 32
  19. typedef struct {
  20. UCHAR Status; // Completion status
  21. UCHAR Protocol;
  22. UCHAR Address;
  23. UCHAR Command;
  24. UCHAR BlockLength;
  25. UCHAR Data[SMB_MAX_DATA_SIZE];
  26. } SMB_REQUEST, *PSMB_REQUEST;
  27. //
  28. // Protocol values
  29. //
  30. #define SMB_WRITE_QUICK 0x00 // Issue quick command data bit = 0
  31. #define SMB_READ_QUICK 0x01 // Issue quick command data bit = 1
  32. #define SMB_SEND_BYTE 0x02
  33. #define SMB_RECEIVE_BYTE 0x03
  34. #define SMB_WRITE_BYTE 0x04
  35. #define SMB_READ_BYTE 0x05
  36. #define SMB_WRITE_WORD 0x06
  37. #define SMB_READ_WORD 0x07
  38. #define SMB_WRITE_BLOCK 0x08
  39. #define SMB_READ_BLOCK 0x09
  40. #define SMB_PROCESS_CALL 0x0A
  41. #define SMB_MAXIMUM_PROTOCOL 0x0A
  42. //
  43. // SMB Bus Status codes
  44. //
  45. #define SMB_STATUS_OK 0x00
  46. #define SMB_UNKNOWN_FAILURE 0x07
  47. #define SMB_ADDRESS_NOT_ACKNOWLEDGED 0x10
  48. #define SMB_DEVICE_ERROR 0x11
  49. #define SMB_COMMAND_ACCESS_DENIED 0x12
  50. #define SMB_UNKNOWN_ERROR 0x13
  51. #define SMB_DEVICE_ACCESS_DENIED 0x17
  52. #define SMB_TIMEOUT 0x18
  53. #define SMB_UNSUPPORTED_PROTOCOL 0x19
  54. #define SMB_BUS_BUSY 0x1A
  55. //
  56. // Alarm register/deregister requests
  57. //
  58. typedef
  59. VOID
  60. (*SMB_ALARM_NOTIFY) (
  61. PVOID Context,
  62. UCHAR Address,
  63. USHORT Data
  64. );
  65. // input buffer is SMB_REGISTER_ALARM. output buffer is PVOID handle for registration.
  66. // PVOID is passed in via DEREGISTER request to free registration
  67. typedef struct {
  68. UCHAR MinAddress; // Min address for notifications
  69. UCHAR MaxAddress; // Max address for notifications
  70. SMB_ALARM_NOTIFY NotifyFunction;
  71. PVOID NotifyContext;
  72. } SMB_REGISTER_ALARM, *PSMB_REGISTER_ALARM;
  73. //
  74. // Internal ioctls to SMB class driver
  75. //
  76. #define SMB_BUS_REQUEST CTL_CODE(FILE_DEVICE_UNKNOWN, 0, METHOD_NEITHER, FILE_ANY_ACCESS)
  77. #define SMB_REGISTER_ALARM_NOTIFY CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_NEITHER, FILE_ANY_ACCESS)
  78. #define SMB_DEREGISTER_ALARM_NOTIFY CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_NEITHER, FILE_ANY_ACCESS)
  79. //
  80. // Shared SMB Class / Miniport driver structure
  81. //
  82. typedef
  83. NTSTATUS
  84. (*SMB_RESET_DEVICE)(
  85. IN struct _SMB_CLASS *SmbClass,
  86. IN PVOID SmbMiniport
  87. );
  88. typedef
  89. VOID
  90. (*SMB_START_IO)(
  91. IN struct _SMB_CLASS *SmbClass,
  92. IN PVOID SmbMiniport
  93. );
  94. typedef
  95. NTSTATUS
  96. (*SMB_STOP_DEVICE)(
  97. IN struct _SMB_CLASS *SmbClass,
  98. IN PVOID SmbMiniport
  99. );
  100. typedef struct _SMB_CLASS {
  101. USHORT MajorVersion;
  102. USHORT MinorVersion;
  103. PVOID Miniport; // Miniport extension data
  104. PDEVICE_OBJECT DeviceObject; // Device object for this miniport
  105. PDEVICE_OBJECT PDO; // PDO for this miniport
  106. PDEVICE_OBJECT LowerDeviceObject;
  107. //
  108. // Current IO
  109. //
  110. PIRP CurrentIrp; // current request
  111. PSMB_REQUEST CurrentSmb; // pointer to SMB_REQUEST in the CurrentIrp
  112. //
  113. // Miniport functions
  114. //
  115. SMB_RESET_DEVICE ResetDevice; // Initialize/Reset, start device
  116. SMB_START_IO StartIo; // Perform IO
  117. SMB_STOP_DEVICE StopDevice; // Stop device
  118. } SMB_CLASS, *PSMB_CLASS;
  119. #define SMB_CLASS_MAJOR_VERSION 0x0001
  120. #define SMB_CLASS_MINOR_VERSION 0x0000
  121. //
  122. // Class driver initializtion functions
  123. //
  124. #if !defined(SMBCLASS)
  125. #define SMBCLASSAPI DECLSPEC_IMPORT
  126. #else
  127. #define SMBCLASSAPI
  128. #endif
  129. typedef
  130. NTSTATUS
  131. (*PSMB_INITIALIZE_MINIPORT) (
  132. IN PSMB_CLASS SmbClass,
  133. IN PVOID MiniportExtension,
  134. IN PVOID MiniportContext
  135. );
  136. NTSTATUS
  137. SMBCLASSAPI
  138. SmbClassInitializeDevice (
  139. IN ULONG MajorVersion,
  140. IN ULONG MinorVersion,
  141. IN PDRIVER_OBJECT DriverObject
  142. );
  143. NTSTATUS
  144. SMBCLASSAPI
  145. SmbClassCreateFdo (
  146. IN PDRIVER_OBJECT DriverObject,
  147. IN PDEVICE_OBJECT PDO,
  148. IN ULONG MiniportExtensionSize,
  149. IN PSMB_INITIALIZE_MINIPORT MiniportInitialize,
  150. IN PVOID MiniportContext,
  151. OUT PDEVICE_OBJECT *FDO
  152. );
  153. //
  154. // Class driver interface functions for use by the miniport
  155. //
  156. VOID
  157. SMBCLASSAPI
  158. SmbClassCompleteRequest (
  159. IN PSMB_CLASS SmbClass
  160. );
  161. VOID
  162. SMBCLASSAPI
  163. SmbClassAlarm (
  164. IN PSMB_CLASS SmbClass,
  165. IN UCHAR Address,
  166. IN USHORT Data
  167. );
  168. VOID
  169. SMBCLASSAPI
  170. SmbClassLockDevice (
  171. IN PSMB_CLASS SmbClass
  172. );
  173. VOID
  174. SMBCLASSAPI
  175. SmbClassUnlockDevice (
  176. IN PSMB_CLASS SmbClass
  177. );