Add TAG macro definition.
[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 #define NDIS50 1 /* Use NDIS 5.0 structures by default */
14
15 #ifdef _MSC_VER
16 #include <basetsd.h>
17 #include <ntddk.h>
18 #include <windef.h>
19 #include <ndis.h>
20 #else /* _MSC_VER */
21 #include <ddk/ntddk.h>
22 #include <ddk/ndis.h>
23 #include <ddk/xfilter.h>
24 #include <ddk/afilter.h>
25 typedef struct _ATM_ADDRESS *PATM_ADDRESS;
26 /* FIXME: Get rid of this dependance. */
27 #include <ddk/ntapi.h>
28 #endif /* _MSC_VER */
29
30 struct _ADAPTER_BINDING;
31
32 typedef struct _INTERNAL_NDIS_MINIPORT_WORK_ITEM {
33 SINGLE_LIST_ENTRY Link;
34 struct _ADAPTER_BINDING *AdapterBinding;
35 NDIS_MINIPORT_WORK_ITEM RealWorkItem;
36 } INTERNAL_NDIS_MINIPORT_WORK_ITEM, *PINTERNAL_NDIS_MINIPORT_WORK_ITEM;
37
38 #include "miniport.h"
39 #include "protocol.h"
40
41 #include <debug.h>
42
43 /* Exported functions */
44 #ifdef _MSC_VER
45 #define EXPORT __declspec(dllexport)
46 #else
47 #define EXPORT STDCALL
48 #endif
49
50 #define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
51 #define NDIS_TAG 0x4e4d4953
52
53 #ifdef DBG
54
55 #define DEBUG_REFCHECK(Object) { \
56 if ((Object)->RefCount <= 0) { \
57 NDIS_DbgPrint(MIN_TRACE, ("Object at (0x%X) has invalid reference count (%d).\n", \
58 (Object), (Object)->RefCount)); \
59 } \
60 }
61
62 #else
63
64 #define DEBUG_REFCHECK(Object)
65
66 #endif
67
68
69 /*
70 * VOID ReferenceObject(
71 * PVOID Object)
72 */
73 #define ReferenceObject(Object) \
74 { \
75 DEBUG_REFCHECK(Object); \
76 NDIS_DbgPrint(DEBUG_REFCOUNT, ("Referencing object at (0x%X). RefCount (%d).\n", \
77 (Object), (Object)->RefCount)); \
78 \
79 InterlockedIncrement((PLONG)&((Object)->RefCount)); \
80 }
81
82 /*
83 * VOID DereferenceObject(
84 * PVOID Object)
85 */
86 #define DereferenceObject(Object) \
87 { \
88 DEBUG_REFCHECK(Object); \
89 NDIS_DbgPrint(DEBUG_REFCOUNT, ("Dereferencing object at (0x%X). RefCount (%d).\n", \
90 (Object), (Object)->RefCount)); \
91 \
92 if (InterlockedDecrement((PLONG)&((Object)->RefCount)) == 0) \
93 PoolFreeBuffer(Object); \
94 }
95
96
97 #define MIN(value1, value2) \
98 ((value1 < value2)? value1 : value2)
99
100 #define MAX(value1, value2) \
101 ((value1 > value2)? value1 : value2)
102
103 #endif /* __NDISSYS_H */
104
105 /* EOF */