Get rid of NdisWorkItemHalt.
[reactos.git] / reactos / drivers / net / ndis / include / ndissys.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS NDIS library
4 * FILE: ndissys.h
5 * PURPOSE: NDIS library definitions
6 * NOTES: Spin lock acquire order:
7 * - Miniport list lock
8 * - Adapter list lock
9 */
10 #ifndef __NDISSYS_H
11 #define __NDISSYS_H
12
13 typedef unsigned long NDIS_STATS;
14 #include <ndis.h>
15 #include <xfilter.h>
16 #include <afilter.h>
17
18 #if _MSC_VER
19 /* FIXME: These were removed and are no longer used! */
20 #define NdisWorkItemSendLoopback NdisWorkItemReserved
21 #else /* _MSC_VER */
22 /* FIXME: We miss the ATM headers. */
23 typedef struct _ATM_ADDRESS *PATM_ADDRESS;
24 #endif /* _MSC_VER */
25
26 /* FIXME: This should go away once NDK will be compatible with MS DDK headers. */
27 #if _MSC_VER
28 NTSTATUS NTAPI ZwDuplicateObject(IN HANDLE, IN HANDLE, IN HANDLE, OUT PHANDLE, IN ACCESS_MASK, IN ULONG, IN ULONG);
29 #else
30 #include <ndk/ntndk.h>
31 #endif
32
33 #define NDIS_MINIPORT_WORK_QUEUE_SIZE 10
34
35 struct _ADAPTER_BINDING;
36
37 typedef struct _INTERNAL_NDIS_MINIPORT_WORK_ITEM {
38 SINGLE_LIST_ENTRY Link;
39 struct _ADAPTER_BINDING *AdapterBinding;
40 NDIS_MINIPORT_WORK_ITEM RealWorkItem;
41 } INTERNAL_NDIS_MINIPORT_WORK_ITEM, *PINTERNAL_NDIS_MINIPORT_WORK_ITEM;
42
43 typedef struct _NDISI_PACKET_POOL {
44 NDIS_SPIN_LOCK SpinLock;
45 struct _NDIS_PACKET *FreeList;
46 UINT PacketLength;
47 UCHAR Buffer[1];
48 } NDISI_PACKET_POOL, * PNDISI_PACKET_POOL;
49
50 #include "miniport.h"
51 #include "protocol.h"
52
53 #include <debug.h>
54
55 /* Exported functions */
56 #ifndef EXPORT
57 #define EXPORT NTAPI
58 #endif
59
60 #define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
61 #define NDIS_TAG 0x4e4d4953
62
63 #ifdef DBG
64
65 #define DEBUG_REFCHECK(Object) { \
66 if ((Object)->RefCount <= 0) { \
67 NDIS_DbgPrint(MIN_TRACE, ("Object at (0x%X) has invalid reference count (%d).\n", \
68 (Object), (Object)->RefCount)); \
69 } \
70 }
71
72 #else
73
74 #define DEBUG_REFCHECK(Object)
75
76 #endif
77
78
79 /*
80 * VOID ReferenceObject(
81 * PVOID Object)
82 */
83 #define ReferenceObject(Object) \
84 { \
85 DEBUG_REFCHECK(Object); \
86 NDIS_DbgPrint(DEBUG_REFCOUNT, ("Referencing object at (0x%X). RefCount (%d).\n", \
87 (Object), (Object)->RefCount)); \
88 \
89 InterlockedIncrement((PLONG)&((Object)->RefCount)); \
90 }
91
92 /*
93 * VOID DereferenceObject(
94 * PVOID Object)
95 */
96 #define DereferenceObject(Object) \
97 { \
98 DEBUG_REFCHECK(Object); \
99 NDIS_DbgPrint(DEBUG_REFCOUNT, ("Dereferencing object at (0x%X). RefCount (%d).\n", \
100 (Object), (Object)->RefCount)); \
101 \
102 if (InterlockedDecrement((PLONG)&((Object)->RefCount)) == 0) \
103 PoolFreeBuffer(Object); \
104 }
105
106
107 #define MIN(value1, value2) \
108 ((value1 < value2)? value1 : value2)
109
110 #define MAX(value1, value2) \
111 ((value1 > value2)? value1 : value2)
112
113 #endif /* __NDISSYS_H */
114
115 /* EOF */