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.

387 lines
9.2 KiB

  1. //depot/Lab01_N/Shell/osshell/cpls/usb/itemfind.h#3 - edit change 8022 (text)
  2. /*******************************************************************************
  3. *
  4. * (C) COPYRIGHT MICROSOFT CORP., 1993-1995
  5. * TITLE: ITEMFIND.H
  6. * VERSION: 1.0
  7. * AUTHOR: jsenior
  8. * DATE: 10/28/1998
  9. *
  10. ********************************************************************************
  11. *
  12. * CHANGE LOG:
  13. *
  14. * DATE REV DESCRIPTION
  15. * ---------- ------- ----------------------------------------------------------
  16. * 10/28/1998 jsenior Original implementation.
  17. *
  18. *******************************************************************************/
  19. #ifndef _USBITEMACTIONFIND_H
  20. #define _USBITEMACTIONFIND_H
  21. #include "UsbItem.h"
  22. #include "vec.h"
  23. #define USB_NUM_FRAMES 32
  24. typedef _Vec<UsbItem *> UsbItemList;
  25. //
  26. // Searching for devices
  27. //
  28. class UsbItemActionFindIsoDevices : public UsbItem::UsbItemAction {
  29. public:
  30. UsbItemActionFindIsoDevices() {
  31. ZeroMemory(interruptBW, sizeof(UINT)*USB_NUM_FRAMES); }
  32. BOOL operator()(UsbItem *Item);
  33. UsbItemList& GetIsoDevices() {return isoDevices;}
  34. void AddInterruptBW(UsbItem *);
  35. UINT InterruptBW();
  36. private:
  37. UINT interruptBW[USB_NUM_FRAMES];
  38. UsbItemList isoDevices;
  39. };
  40. class UsbItemActionFindPower : public UsbItem::UsbItemAction {
  41. public:
  42. UsbItemActionFindPower(UsbItem *HubItem) : hubItem(HubItem) {}
  43. BOOL operator()(UsbItem *Item);
  44. UsbItemList& GetPowerDevices() {return powerDevices;}
  45. UsbItemList& GetOtherDevices() {return otherDevices;}
  46. protected:
  47. UsbItemList powerDevices, otherDevices;
  48. UsbItem *hubItem;
  49. };
  50. //
  51. // Searching for hubs
  52. //
  53. #define DistanceFromControllerForHub 6
  54. #define DistanceFromControllerForDevice 7
  55. class UsbItemActionFindHubsWithFreePorts :
  56. public UsbItem::UsbItemAction {
  57. public:
  58. UsbItemActionFindHubsWithFreePorts(UsbItem *HubItem) :
  59. hubItem(HubItem) {}
  60. BOOL operator()(UsbItem *Item);
  61. static BOOL IsValid(UsbItem *Item);
  62. static BOOL IsExpanded(UsbItem *Item);
  63. UsbItemList& GetHubs() {return hubs;}
  64. protected:
  65. UsbItemList hubs;
  66. UsbItem *hubItem;
  67. };
  68. class UsbItemActionFindSelfPoweredHubsWithFreePorts :
  69. public UsbItem::UsbItemAction {
  70. public:
  71. UsbItemActionFindSelfPoweredHubsWithFreePorts(UsbItem *HubItem) :
  72. hubItem(HubItem) {}
  73. BOOL operator()(UsbItem *Item);
  74. static BOOL IsValid(UsbItem *Item);
  75. static BOOL IsExpanded(UsbItem *Item);
  76. UsbItemList& GetHubs() {return hubs;}
  77. protected:
  78. UsbItemList hubs;
  79. UsbItem *hubItem;
  80. };
  81. class UsbItemActionFindSelfPoweredHubsWithFreePortsForHub :
  82. public UsbItem::UsbItemAction {
  83. public:
  84. UsbItemActionFindSelfPoweredHubsWithFreePortsForHub(UsbItem *HubItem) :
  85. hubItem(HubItem) {}
  86. BOOL operator()(UsbItem *Item);
  87. static BOOL IsValid(UsbItem *Item);
  88. static BOOL IsExpanded(UsbItem *Item);
  89. UsbItemList& GetHubs() {return hubs;}
  90. protected:
  91. UsbItemList hubs;
  92. UsbItem *hubItem;
  93. };
  94. class UsbItemActionFindBusPoweredHubsOnSelfPoweredHubs :
  95. public UsbItem::UsbItemAction {
  96. public:
  97. UsbItemActionFindBusPoweredHubsOnSelfPoweredHubs(UsbItem *Item) :
  98. item(Item) {}
  99. BOOL operator()(UsbItem *Item);
  100. static BOOL IsValid(UsbItem *Item);
  101. static BOOL IsExpanded(UsbItem *Item);
  102. UsbItemList& GetDevices() {return devices;}
  103. protected:
  104. UsbItemList devices;
  105. UsbItem *item;
  106. };
  107. //
  108. // Searching for ports
  109. //
  110. class UsbItemActionFindFreePortsOnSelfPoweredHubs :
  111. public UsbItem::UsbItemAction {
  112. public:
  113. UsbItemActionFindFreePortsOnSelfPoweredHubs(UsbItem *HubItem) :
  114. hubItem(HubItem) {}
  115. BOOL operator()(UsbItem *Item);
  116. static BOOL IsValid(UsbItem *Item);
  117. static BOOL IsExpanded(UsbItem *Item);
  118. UsbItemList& GetHubs() {return hubs;}
  119. protected:
  120. UsbItemList hubs;
  121. UsbItem *hubItem;
  122. };
  123. class UsbItemActionFindOvercurrentHubPort :
  124. public UsbItem::UsbItemAction {
  125. public:
  126. UsbItemActionFindOvercurrentHubPort(String &HubName, ULONG Port) :
  127. device(NULL) {hubName = HubName; portIndex = Port;}
  128. BOOL operator()(UsbItem *Item);
  129. static BOOL IsValid(UsbItem *Item);
  130. static BOOL IsExpanded(UsbItem *Item);
  131. UsbItem *GetDevice() {return device;}
  132. protected:
  133. static String hubName;
  134. static ULONG portIndex;
  135. UsbItem *device;
  136. };
  137. //
  138. // Searching for devices
  139. //
  140. class UsbItemActionFindLowPoweredDevicesOnSelfPoweredHubs :
  141. public UsbItem::UsbItemAction {
  142. public:
  143. UsbItemActionFindLowPoweredDevicesOnSelfPoweredHubs(UsbItem *Item) :
  144. item(Item) {}
  145. BOOL operator()(UsbItem *Item);
  146. static BOOL IsValid(UsbItem *Item);
  147. static BOOL IsExpanded(UsbItem *Item);
  148. UsbItemList& GetDevices() {return devices;}
  149. protected:
  150. UsbItemList devices;
  151. UsbItem *item;
  152. };
  153. class UsbItemActionFindDevicesOnHubs :
  154. public UsbItem::UsbItemAction {
  155. public:
  156. UsbItemActionFindDevicesOnHubs(UsbItem *Item) :
  157. item(Item) {}
  158. BOOL operator()(UsbItem *Item);
  159. static BOOL IsValid(UsbItem *Item);
  160. static BOOL IsExpanded(UsbItem *Item);
  161. UsbItemList& GetDevices() {return devices;}
  162. protected:
  163. UsbItemList devices;
  164. UsbItem *item;
  165. };
  166. class UsbItemActionFindUnknownPoweredDevicesOnSelfPoweredHubs :
  167. public UsbItem::UsbItemAction {
  168. public:
  169. UsbItemActionFindUnknownPoweredDevicesOnSelfPoweredHubs(UsbItem *Item) :
  170. item(Item) {}
  171. BOOL operator()(UsbItem *Item);
  172. static BOOL IsValid(UsbItem *Item);
  173. static BOOL IsExpanded(UsbItem *Item);
  174. UsbItemList& GetDevices() {return devices;}
  175. protected:
  176. UsbItemList devices;
  177. UsbItem *item;
  178. };
  179. class UsbItemActionFindHighPoweredDevicesOnSelfPoweredHubs :
  180. public UsbItem::UsbItemAction {
  181. public:
  182. UsbItemActionFindHighPoweredDevicesOnSelfPoweredHubs(UsbItem *Item) :
  183. item(Item) {}
  184. BOOL operator()(UsbItem *Item);
  185. static BOOL IsValid(UsbItem *Item);
  186. static BOOL IsExpanded(UsbItem *Item);
  187. UsbItemList& GetDevices() {return devices;}
  188. protected:
  189. UsbItemList devices;
  190. UsbItem *item;
  191. };
  192. class UsbItemActionFindOvercurrentDevice :
  193. public UsbItem::UsbItemAction {
  194. public:
  195. UsbItemActionFindOvercurrentDevice(DEVINST DevInst) :
  196. device(NULL) {devInst = DevInst;}
  197. BOOL operator()(UsbItem *Item);
  198. static BOOL IsValid(UsbItem *Item);
  199. static BOOL IsExpanded(UsbItem *Item);
  200. UsbItem *GetDevice() {return device;}
  201. protected:
  202. static DEVINST devInst;
  203. UsbItem *device;
  204. };
  205. class UsbItemActionFindUsb2xDevicesOnUsb2xHubs :
  206. public UsbItem::UsbItemAction {
  207. public:
  208. UsbItemActionFindUsb2xDevicesOnUsb2xHubs(UsbItem *Item) :
  209. item(Item) {}
  210. BOOL operator()(UsbItem *Item);
  211. static BOOL IsValid(UsbItem *Item);
  212. static BOOL IsExpanded(UsbItem *Item);
  213. UsbItemList& GetDevices() {return devices;}
  214. protected:
  215. UsbItemList devices;
  216. UsbItem *item;
  217. };
  218. class UsbItemActionFindUnknownDevicesOnUsb2xHubs :
  219. public UsbItem::UsbItemAction {
  220. public:
  221. UsbItemActionFindUnknownDevicesOnUsb2xHubs(UsbItem *Item) :
  222. item(Item) {}
  223. BOOL operator()(UsbItem *Item);
  224. static BOOL IsValid(UsbItem *Item);
  225. static BOOL IsExpanded(UsbItem *Item);
  226. UsbItemList& GetDevices() {return devices;}
  227. protected:
  228. UsbItemList devices;
  229. UsbItem *item;
  230. };
  231. class UsbItemActionFindUsb1xDevicesOnUsb2xHubs :
  232. public UsbItem::UsbItemAction {
  233. public:
  234. UsbItemActionFindUsb1xDevicesOnUsb2xHubs(UsbItem *Item) :
  235. item(Item) {}
  236. BOOL operator()(UsbItem *Item);
  237. static BOOL IsValid(UsbItem *Item);
  238. static BOOL IsExpanded(UsbItem *Item);
  239. UsbItemList& GetDevices() {return devices;}
  240. protected:
  241. UsbItemList devices;
  242. UsbItem *item;
  243. };
  244. class UsbItemActionFindFreePortsOnUsb2xHubs :
  245. public UsbItem::UsbItemAction {
  246. public:
  247. UsbItemActionFindFreePortsOnUsb2xHubs(UsbItem *HubItem) :
  248. hubItem(HubItem) {}
  249. BOOL operator()(UsbItem *Item);
  250. static BOOL IsValid(UsbItem *Item);
  251. static BOOL IsExpanded(UsbItem *Item);
  252. UsbItemList& GetHubs() {return hubs;}
  253. protected:
  254. UsbItemList hubs;
  255. UsbItem *hubItem;
  256. };
  257. class UsbItemActionFindUsb2xHubsWithFreePorts :
  258. public UsbItem::UsbItemAction {
  259. public:
  260. UsbItemActionFindUsb2xHubsWithFreePorts(UsbItem *HubItem) :
  261. hubItem(HubItem) {}
  262. BOOL operator()(UsbItem *Item);
  263. static BOOL IsValid(UsbItem *Item);
  264. static BOOL IsExpanded(UsbItem *Item);
  265. UsbItemList& GetHubs() {return hubs;}
  266. protected:
  267. UsbItemList hubs;
  268. UsbItem *hubItem;
  269. };
  270. class UsbItemActionFindUsb2xHubs :
  271. public UsbItem::UsbItemAction {
  272. public:
  273. UsbItemActionFindUsb2xHubs(UsbItem *HubItem) :
  274. hubItem(HubItem) {}
  275. BOOL operator()(UsbItem *Item);
  276. static BOOL IsValid(UsbItem *Item);
  277. static BOOL IsExpanded(UsbItem *Item);
  278. UsbItemList& GetHubs() {return hubs;}
  279. protected:
  280. UsbItemList hubs;
  281. UsbItem *hubItem;
  282. };
  283. class UsbItemActionFindDevicesOnSelfPoweredHubs :
  284. public UsbItem::UsbItemAction {
  285. public:
  286. UsbItemActionFindDevicesOnSelfPoweredHubs(UsbItem *Item) :
  287. item(Item) {}
  288. BOOL operator()(UsbItem *Item);
  289. static BOOL IsValid(UsbItem *Item);
  290. static BOOL IsExpanded(UsbItem *Item);
  291. UsbItemList& GetDevices() {return devices;}
  292. protected:
  293. UsbItemList devices;
  294. UsbItem *item;
  295. };
  296. inline BOOL TrueAlways(UsbItem *item)
  297. {
  298. return TRUE;
  299. }
  300. #endif //