2 * Copyright (C) 2009-2010, Shao Miller <shao.miller@yrdsb.edu.on.ca>.
3 * Copyright 2006-2008, V.
4 * For WinAoE contact information, see http://winaoe.org/
6 * This file is part of WinVBlock, derived from WinAoE.
8 * WinVBlock is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * WinVBlock is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with WinVBlock. If not, see <http://www.gnu.org/licenses/>.
31 * A bus thread routine.
33 * @v bus The bus to be used in the thread routine.
35 * If you implement your own bus thread routine, you should call
36 * bus__process_work_items() within its loop.
38 typedef void STDCALL WV_F_BUS_THREAD(IN WV_SP_BUS_T);
39 typedef WV_F_BUS_THREAD * WV_FP_BUS_THREAD;
42 typedef struct WV_BUS_T {
43 struct device__type * device;
44 PDEVICE_OBJECT LowerDeviceObject;
45 PDEVICE_OBJECT PhysicalDeviceObject;
46 winvblock__uint32 Children;
47 struct device__type * first_child;
50 winvblock__any_ptr ext;
51 device__free_func * prev_free;
52 UNICODE_STRING dev_name;
53 UNICODE_STRING dos_dev_name;
54 winvblock__bool named;
55 LIST_ENTRY work_items;
56 KSPIN_LOCK work_items_lock;
58 WV_FP_BUS_THREAD thread;
64 } WV_S_BUS_T, * WV_SP_BUS_T;
66 /* A child PDO node on a bus. Treat this as an opaque type. */
67 typedef struct WV_BUS_NODE {
73 } WV_S_BUS_NODE, * WV_SP_BUS_NODE;
76 extern NTSTATUS STDCALL WvBusGetDevCapabilities(
78 IN PDEVICE_CAPABILITIES
80 extern winvblock__lib_func void bus__init(WV_SP_BUS_T);
81 extern winvblock__lib_func WV_SP_BUS_T bus__create(void);
82 extern winvblock__lib_func winvblock__bool STDCALL bus__add_child(
84 IN struct device__type *
86 extern winvblock__lib_func WV_SP_BUS_T bus__get(struct device__type *);
87 extern winvblock__lib_func void bus__process_work_items(WV_SP_BUS_T);
88 extern winvblock__lib_func NTSTATUS bus__start_thread(WV_SP_BUS_T);
89 extern winvblock__lib_func winvblock__bool STDCALL WvBusInitNode(
93 extern winvblock__lib_func NTSTATUS STDCALL WvBusAddNode(
97 extern winvblock__lib_func NTSTATUS STDCALL WvBusRemoveNode(WV_SP_BUS_NODE);
99 #endif /* WV_M_BUS_H_ */