Make all network interrupt service routines MPSAFE part 1/3.
[dragonfly.git] / sys / dev / netif / nv / basetype.h.patch
1 $DragonFly: src/sys/dev/netif/nv/Attic/basetype.h.patch,v 1.2 2005/04/04 18:45:07 joerg Exp $
2
3 --- basetype.h.orig     2005-03-12 10:59:20.000000000 +0100
4 +++ basetype.h  2005-04-02 20:29:03.000000000 +0200
5 @@ -44,8 +44,7 @@
6  #define OUT
7  #endif
8  
9 -//
10 -// Useful "types"
11 +/* Useful "types" */
12  
13  #ifndef NULL
14  #define NULL            0
15 @@ -60,9 +59,9 @@
16  #endif
17  
18  #if 1
19 -//
20 -// Don't use as these are going to be deleted soon. Use NV_ instead
21 -//
22 +/*
23 +** Don't use as these are going to be deleted soon. Use NV_ instead
24 +*/
25  #define VOID                void
26  typedef VOID                *PVOID;
27  
28 @@ -112,7 +111,7 @@
29      typedef signed long long             NV_SINT64, *PNV_SINT64;
30  
31  #else
32 -    #if _MSC_VER >= 1200         // MSVC 6.0 onwards
33 +    #if _MSC_VER >= 1200         /* MSVC 6.0 onwards */
34          typedef unsigned __int64       NV_UINT64, *PNV_UINT64;
35          typedef signed __int64                 NV_SINT64, *PNV_SINT64;
36      #else
37 @@ -141,59 +140,59 @@
38  #endif
39  
40  
41 -//
42 -// Floating point definitions
43 -//
44 -typedef float                 NV_REAL32;   // 4-byte floating point
45 -typedef double                NV_REAL64;   // 8-byte floating point
46 +/*
47 +** Floating point definitions
48 +*/
49 +typedef float                 NV_REAL32;   /* 4-byte floating point */
50 +typedef double                NV_REAL64;   /* 8-byte floating point */
51  
52  
53  
54 -//
55 -// Bit defintions
56 -//
57 +/*
58 +** Bit defintions
59 +*/
60  #define NV_BIT(bitpos)                  (1 << (bitpos))
61  
62 -// NV_BIT_SET 
63 -// Sets the specified bit position (0..31). 
64 -// Parameter bits can be 1 byte to 4 bytes, but the caller needs to make sure bitpos fits into it.
65 -// x = 0xA0
66 -// NV_BIT_SET(x, 1)
67 -// Result: x = 0xA2
68 +/* NV_BIT_SET 
69 +** Sets the specified bit position (0..31). 
70 +** Parameter bits can be 1 byte to 4 bytes, but the caller needs to make sure bitpos fits into it.
71 +** x = 0xA0
72 +** NV_BIT_SET(x, 1)
73 +** Result: x = 0xA2 */
74  #define NV_BIT_SET(bits, bitpos)        ((bits) |= (NV_BIT(bitpos)))
75  
76 -// NV_BIT_CLEAR
77 -// Clears the specified bit position (0..31)
78 -// Parameter bits can be 1 byte to 4 bytes, but the caller needs to make sure bitpos fits into it.
79 -// x = 0xAA
80 -// NV_BIT_CLEAR(x, 1)
81 -// Result: x = 0xA8
82 +/* NV_BIT_CLEAR
83 +** Clears the specified bit position (0..31)
84 +** Parameter bits can be 1 byte to 4 bytes, but the caller needs to make sure bitpos fits into it.
85 +** x = 0xAA
86 +** NV_BIT_CLEAR(x, 1)
87 +** Result: x = 0xA8 */
88  #define NV_BIT_CLEAR(bits, bitpos)      ((bits) &= (~NV_BIT(bitpos)))
89  
90 -// NV_BIT_GET 
91 -// Gets the bit at the specified bit position (0..31)
92 -// Parameter bits can be 1 byte to 4 bytes, but the caller needs to make sure bitpos fits into it.
93 -// Result is either 1 or 0.
94 -// x = 0xAA
95 -// NV_BIT_GET(x, 1)
96 -// Result: x = 1
97 +/* NV_BIT_GET 
98 +** Gets the bit at the specified bit position (0..31)
99 +** Parameter bits can be 1 byte to 4 bytes, but the caller needs to make sure bitpos fits into it.
100 +** Result is either 1 or 0.
101 +** x = 0xAA
102 +** NV_BIT_GET(x, 1)
103 +** Result: x = 1 */
104  #define NV_BIT_GET(bits, bitpos)        (((bits) >> (bitpos)) & 0x0001)
105  
106  
107 -// NV_BIT_GETVALUE
108 -// Gets the value from a 32 bit ULONG at specified bit position.
109 -// Parameter bits needs to be 4 bytes long.
110 -// Ex. ul32 = 0xFEDCBA98
111 -// ulVal = NV_BIT_GETVALUE(ul32, 3, 0)  : Gets value from Bit position 3 to 0
112 -// Result : ulVal = 8
113 +/* NV_BIT_GETVALUE
114 +** Gets the value from a 32 bit ULONG at specified bit position.
115 +** Parameter bits needs to be 4 bytes long.
116 +** Ex. ul32 = 0xFEDCBA98
117 +** ulVal = NV_BIT_GETVALUE(ul32, 3, 0)  : Gets value from Bit position 3 to 0
118 +** Result : ulVal = 8 */
119  #define NV_BIT_GETVALUE(ulOrigValue, bitposHi, bitposLow)  (((ulOrigValue) >> (bitposLow)) & (~(0xFFFFFFFF << ((bitposHi) - (bitposLow) +1))))
120  
121 -// NV_BIT_SETVALUE
122 -// Set a value in a 32 bit ULONG at a specific bit position.
123 -// Parameter bits needs to be 4 bytes long.
124 -// Ex. ul32 = 0xFEDCBA98
125 -// NV_BIT_SETVALUE(ul32, 0xF, 3, 0)  : Sets value at Bit position 3 to 0
126 -// Result : ul32 becomes 0xFEDCBA9F
127 +/* NV_BIT_SETVALUE
128 +** Set a value in a 32 bit ULONG at a specific bit position.
129 +** Parameter bits needs to be 4 bytes long.
130 +** Ex. ul32 = 0xFEDCBA98
131 +** NV_BIT_SETVALUE(ul32, 0xF, 3, 0)  : Sets value at Bit position 3 to 0
132 +** Result : ul32 becomes 0xFEDCBA9F */
133  #define NV_BIT_SETVALUE(ulOrigValue, ulWindowValue, bitposHi, bitposLow)  \
134      ((ulOrigValue) = ((((ulOrigValue) & (~ ((0xFFFFFFFF >> (31 - (bitposHi))) & (0xFFFFFFFF << (bitposLow))))) | ((ulWindowValue) << (bitposLow)))))
135  
136 @@ -241,7 +240,7 @@
137  typedef union _NVLARGE_INTEGER {
138  
139  #if 0
140 -    // NO UNNAMED UNIONS ALLOWED !@
141 +    /* NO UNNAMED UNIONS ALLOWED !@ */
142      struct {
143          NV_UINT32   LowPart;
144          NV_SINT32   HighPart;
145 @@ -278,4 +277,4 @@
146  #define NV_API_CALL
147  #endif
148  
149 -#endif // _BASETYPE_H_
150 +#endif /* _BASETYPE_H_ */