Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[cascardo/linux.git] / drivers / staging / wlags49_h2 / hcfcfg.h
1
2 #ifndef HCFCFG_H
3 #define HCFCFG_H 1
4
5 /*************************************************************************************************************
6 *
7 * FILE   : hcfcfg.tpl // hcfcfg.h
8 *
9 * DATE   : $Date: 2004/08/05 11:47:10 $   $Revision: 1.6 $
10 * Original: 2004/04/08 15:18:16    Revision: 1.40      Tag: t20040408_01
11 * Original: 2004/04/01 15:32:55    Revision: 1.38      Tag: t7_20040401_01
12 * Original: 2004/03/10 15:39:28    Revision: 1.34      Tag: t20040310_01
13 * Original: 2004/03/03 14:10:12    Revision: 1.32      Tag: t20040304_01
14 * Original: 2004/03/02 09:27:12    Revision: 1.30      Tag: t20040302_03
15 * Original: 2004/02/24 13:00:28    Revision: 1.25      Tag: t20040224_01
16 * Original: 2004/02/18 17:13:57    Revision: 1.23      Tag: t20040219_01
17 *
18 * AUTHOR : Nico Valster
19 *
20 * DESC   : HCF Customization Macros
21 * hcfcfg.tpl list all #defines which must be specified to:
22 *   adjust the HCF functions defined in HCF.C to the characteristics of a specific environment
23 *               o maximum sizes for messages
24 *               o Endianness
25 *       Compiler specific macros
26 *               o port I/O macros
27 *               o type definitions
28 *
29 * By copying HCFCFG.TPL to HCFCFG.H and -if needed- modifying the #defines the WCI functionality can be
30 * tailored
31 *
32 * Supported environments:
33 * WVLAN_41      Miniport                                                                NDIS 3.1
34 * WVLAN_42      Packet                                                                  Microsoft Visual C 1.5
35 * WVLAN_43      16 bits DOS ODI                                                 Microsoft Visual C 1.5
36 * WVLAN_44      32 bits ODI (__NETWARE_386__)                   WATCOM
37 * WVLAN_45      MAC_OS                                                                  MPW?, Symantec?
38 * WVLAN_46      Windows CE (_WIN32_WCE)                                 Microsoft ?
39 * WVLAN_47      LINUX  (__LINUX__)                                              GCC, discarded, based on GPL'ed HCF-light
40 * WVLAN_48      Miniport                                                                NDIS 5
41 * WVLAN_49      LINUX  (__LINUX__)                                              GCC, originally based on pre-compiled HCF_library
42 *                                                                                                       migrated to use the HCF sources when Lucent Technologies
43 *                                                                                                       brought the HCF module under GPL
44 * WVLAN_51      Miniport USB                                                    NDIS 5
45 * WVLAN_52      Miniport                                                                NDIS 4
46 * WVLAN_53      VxWorks END Station driver
47 * WVLAN_54      VxWorks END Access Point driver
48 * WVLAN_81      WavePoint                                                               BORLAND C
49 * WCITST        Inhouse test tool                                               Microsoft Visual C 1.5
50 * WSU           WaveLAN Station Update                                  Microsoft Visual C ??
51 * SCO UNIX      not yet actually used ?                                 ?
52 * __ppc         OEM supplied                                                    ?
53 * _AM29K        OEM supplied                                                    ?
54 * ?                     OEM supplied                                                    Microtec Research 80X86 Compiler
55 *
56 **************************************************************************************************************
57 *
58 *
59 * SOFTWARE LICENSE
60 *
61 * This software is provided subject to the following terms and conditions,
62 * which you should read carefully before using the software.  Using this
63 * software indicates your acceptance of these terms and conditions.  If you do
64 * not agree with these terms and conditions, do not use the software.
65 *
66 * COPYRIGHT © 1994 - 1995      by AT&T.                                All Rights Reserved
67 * COPYRIGHT © 1996 - 2000 by Lucent Technologies.      All Rights Reserved
68 * COPYRIGHT © 2001 - 2004      by Agere Systems Inc.   All Rights Reserved
69 * All rights reserved.
70 *
71 * Redistribution and use in source or binary forms, with or without
72 * modifications, are permitted provided that the following conditions are met:
73 *
74 * . Redistributions of source code must retain the above copyright notice, this
75 *    list of conditions and the following Disclaimer as comments in the code as
76 *    well as in the documentation and/or other materials provided with the
77 *    distribution.
78 *
79 * . Redistributions in binary form must reproduce the above copyright notice,
80 *    this list of conditions and the following Disclaimer in the documentation
81 *    and/or other materials provided with the distribution.
82 *
83 * . Neither the name of Agere Systems Inc. nor the names of the contributors
84 *    may be used to endorse or promote products derived from this software
85 *    without specific prior written permission.
86 *
87 * Disclaimer
88 *
89 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
90 * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
91 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  ANY
92 * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
93 * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
94 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
95 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
96 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
97 * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
98 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
99 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
100 * DAMAGE.
101 *
102 *
103 *************************************************************************************************************/
104
105 /*      Alignment
106 *       Some platforms can access words on odd boundaries (with possibly an performance impact), at other
107 *       platforms such an access may result in a memory access violation.
108 *       It is assumed that everywhere where the HCF casts a char pointer into a word pointer, the alignment
109 *       criteria are met. This put some restrictions on the MSF, which are assumed to be "automatically" fulfilled
110 *       at the applicable platforms
111 *       To assert this assumption, the macro HCF_ALIGN can be defined. The default value is 1, meaning byte
112 *       alignment (or no alignment), a value of 2 means word alignment, a value of 4 means double word alignment
113 */
114
115 /*****************************    IN_PORT_STRING_8_16  S a m p l e s *****************************************
116
117                 // C implementation which let the processor handle the word-at-byte-boundary problem
118 #define IN_PORT_STRING_8_16( port, addr, n) while ( n-- )       \
119         { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_8 FAR*)addr)+=2; }
120
121                 // C implementation which handles the word-at-byte-boundary problem
122 #define IN_PORT_STRING_8_16( port, addr, n)     while ( n-- )    \
123         { hcf_16 i = IN_PORT_WORD(port); *((hcf_8 FAR*)addr)++ = (hcf_8)i; *((hcf_8 FAR*)addr)++ = (hcf_8)(i>>8);}
124
125                 // Assembler implementation
126 #define IN_PORT_STRING_8_16( port, addr, len) __asm             \
127 {                                                                                                               \
128         __asm push di                                                                           \
129         __asm push es                                                                           \
130         __asm mov cx,len                                                                        \
131         __asm les di,addr                                                                       \
132         __asm mov dx,port                                                                       \
133         __asm rep insw                                                                          \
134         __asm pop es                                                                            \
135         __asm pop di                                                                            \
136 }
137
138
139 *****************************   OUT_PORT_STRING_8_16  S a m p l e s ******************************************
140
141                 // C implementation which let the processor handle the word-at-byte-boundary problem
142 #define OUT_PORT_STRING_8_16( port, addr, n)    while ( n-- ) \
143         { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; ((hcf_8 FAR*)addr)+=2; }
144
145                 // C implementation which handles the word-at-byte-boundary problem
146 #define OUT_PORT_STRING_8_16( port, addr, n)    while ( n-- ) \
147         { OUT_PORT_WORD( port, *((hcf_8 FAR*)addr) | *(((hcf_8 FAR*)addr)+1)<<8  ); (hcf_8 FAR*)addr+=2; }
148
149                 // Assembler implementation
150 #define OUT_PORT_STRING_8_16( port, addr, len) __asm    \
151 {                                                                                                               \
152         __asm push si                                                                           \
153         __asm push ds                                                                           \
154         __asm mov cx,len                                                                        \
155         __asm lds si,addr                                                                       \
156         __asm mov dx,port                                                                       \
157         __asm rep outsw                                                                         \
158         __asm pop ds                                                                            \
159         __asm pop si                                                                            \
160 }
161
162 *************************************************************************************************************/
163
164
165 /************************************************************************************************/
166 /******************  C O M P I L E R   S P E C I F I C   M A C R O S  ***************************/
167 /************************************************************************************************/
168 /*************************************************************************************************
169 *
170 *                       !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
171 *                       !!!! Do not call these macros with parameters which introduce side effects !!!!
172 *                       !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
173 *
174 *
175 * By selecting the appropriate Macro definitions by means of modifying the "#ifdef 0/1" lines, the HCF can be
176 * adjusted for the I/O characteristics of a specific compiler
177 *
178 * If needed the macros can be modified or replaced with definitions appropriate for your personal platform.
179 * If you need to make such changes it is appreciated if you inform Agere Systems
180 * That way the changes can become part of the next release of the WCI
181 *
182 * For convenience of the MSF-programmer, all macros are allowed to modify their parameters (although some
183 * might argue that this would constitute bad coding practice). This has its implications on the HCF, e.g. as a
184 * consequence these macros should not be called with parameters which have side effects, e.g auto-increment.
185 *
186 * in the Microsoft implementation of inline assembly it is O.K. to corrupt all flags except the direction flag
187 * and to corrupt all registers except the segment registers and EDI, ESI, ESP and EBP (or their 16 bits
188 * equivalents).  Other environments may have other constraints
189 *
190 * in the Intel environment it is O.K to have a word (as a 16 bits quantity) at a byte boundary, hence
191 * IN_/OUT_PORT_STRING_8_16 can move words between PC-memory and NIC-memory with as only constraint that the
192 * words are on a word boundary in NIC-memory. This does not hold true for all conceivable environments, e.g.
193 * an Motorola 68xxx does not allow this. Probably/hopefully the boundary conditions imposed by these type of
194 * platforms prevent this case from materializing.  If this is not the case, OUT_PORT_STRING_8_16 must be coded
195 * by combining two Host memory hcf_8 values at a time to a single hcf_16 value to be passed to the NIC and
196 * IN_PORT_STRING_8_16 the single hcf_16 retrieved from the NIC must be split in two hcf_8 values to be stored
197 * in Host memory (see the sample code above)
198 *
199 *       The prototypes and functional description of the macros are:
200 *
201 *       hcf_16  IN_PORT_WORD( hcf_16 port )
202 *                       Reads a word (16 bits) from the specified port
203 *
204 *       void    OUT_PORT_WORD( hcf_16 port, hcf_16 value)
205 *                       Writes a word (16 bits) to the specified port
206 *
207 *       hcf_16  IN_PORT_DWORD( hcf_16 port )
208 *                       Reads a dword (32 bits) from the specified port
209 *
210 *       void    OUT_PORT_DWORD( hcf_16 port, hcf_32 value)
211 *                       Writes a dword (32 bits) to the specified port
212 *
213 *       void    IN_PORT_STRING_8_16( port, addr, len)
214 *                       Reads len number of words (16 bits) from NIC memory via the specified port to the (FAR)
215 *                       byte-pointer addr in PC-RAM
216 *                       Note that len specifies the number of words, NOT the number of bytes
217 *                       !!!NOTE, although len specifies the number of words, addr MUST be a char pointer NOTE!!!
218 *                       See also the common notes for IN_PORT_STRING_8_16 and OUT_PORT_STRING_8_16
219 *
220 *       void    OUT_PORT_STRING_8_16( port, addr, len)
221 *                       Writes len number of words (16 bits) from the (FAR) byte-pointer addr in PC-RAM via the specified
222 *                       port to NIC memory
223 *                       Note that len specifies the number of words, NOT the number of bytes.
224 *                       !!!NOTE, although len specifies the number of words, addr MUST be a char pointer NOTE!!!
225 *
226 *                       The peculiar combination of word-length and char pointers for IN_PORT_STRING_8_16 as well as
227 *                       OUT_PORT_STRING_8_16 is justified by the assumption that it offers a more optimal algorithm
228 *
229 *       void    IN_PORT_STRING_32( port, addr, len)
230 *                       Reads len number of double-words (32 bits) from NIC memory via the specified port to the (FAR)
231 *                       double-word address addr in PC-RAM
232 *
233 *       void    OUT_PORT_STRING_32( port, addr, len)
234 *                       Writes len number of double-words (32 bits) from the (FAR) double-word address addr in PC-RAM via
235 *                       the specified port to NIC memory
236 *
237 *                       !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
238 *                       !!!! Do not call these macros with parameters which introduce side effects !!!!
239 *                       !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
240 *
241 *************************************************************************************************/
242
243 /****************************  define INT Types  ******************************/
244 typedef unsigned char                   hcf_8;
245 typedef unsigned short                  hcf_16;
246 typedef unsigned long                   hcf_32;
247
248 /****************************  define I/O Types  ******************************/
249 #define HCF_IO_MEM                      0x0001  // memory mapped I/O    ( 0: Port I/O )
250 #define HCF_IO_32BITS                   0x0002  // 32Bits support               ( 0: only 16 Bits I/O)
251
252 /****************************** #define HCF_TYPE ********************************/
253 #define HCF_TYPE_NONE                   0x0000  // No type
254 #define HCF_TYPE_WPA                    0x0001  // WPA support
255 #define HCF_TYPE_USB                    0x0002  // reserved (USB Dongle driver support)
256 //#define HCF_TYPE_HII                  0x0004  // Hermes-II, to discriminate H-I and H-II CFG_HCF_OPT_STRCT
257 #define HCF_TYPE_WARP                   0x0008  // WARP F/W
258 #define HCF_TYPE_PRELOADED              0x0040  // pre-loaded F/W
259 #define HCF_TYPE_HII5                   0x0080  // Hermes-2.5 H/W
260 #define HCF_TYPE_CCX                    0x0100  // CKIP
261 #define HCF_TYPE_BEAGLE_HII5    0x0200  // Beagle Hermes-2.5 H/W
262 #define HCF_TYPE_TX_DELAY               0x4000  // Delayed transmission ( non-DMA only)
263
264 /****************************** #define HCF_ASSERT ******************************/
265 #define HCF_ASSERT_NONE                 0x0000  // No assert support
266 #define HCF_ASSERT_PRINTF               0x0001  // Hermes generated debug info
267 #define HCF_ASSERT_SW_SUP               0x0002  // logging via Hermes support register
268 #define HCF_ASSERT_MB                   0x0004  // logging via Mailbox
269 #define HCF_ASSERT_RT_MSF_RTN   0x4000  // dynamically binding of msf_assert routine
270 #define HCF_ASSERT_LNK_MSF_RTN  0x8000  // statically binding of msf_assert routine
271
272 /****************************** #define HCF_ENCAP *******************************/
273 #define HCF_ENC_NONE                    0x0000  // No encapsulation support
274 #define HCF_ENC                                 0x0001  // HCF handles En-/Decapsulation
275 #define HCF_ENC_SUP                             0x0002  // HCF supports MSF to handle En-/Decapsulation
276
277 /****************************** #define HCF_EXT *********************************/
278 #define HCF_EXT_NONE                    0x0000  // No expanded features
279 #define HCF_EXT_INFO_LOG                0x0001  // logging of Hermes Info frames
280 //#define HCF_EXT_INT_TX_OK             0x0002  // RESERVED!!! monitoring successful Tx message
281 #define HCF_EXT_INT_TX_EX               0x0004  // monitoring unsuccessful Tx message
282 //#define HCF_EXT_MON_MODE              0x0008  // LEGACY
283 #define HCF_EXT_TALLIES_FW              0x0010  // support for up to 32 Hermes Engineering tallies
284 #define HCF_EXT_TALLIES_HCF             0x0020  // support for up to 8 HCF Engineering tallies
285 #define HCF_EXT_NIC_ACCESS              0x0040  // direct access via Aux-ports and to Hermes registers and commands
286 #define HCF_EXT_MB                              0x0080  // MailBox code expanded
287 #define HCF_EXT_IFB_STRCT               0x0100  // MSF custom pointer in IFB
288 #define HCF_EXT_DESC_STRCT              0x0200  // MSF custom pointer in Descriptor
289 #define HCF_EXT_TX_CONT                 0x4000  // Continuous transmit test
290 #define HCF_EXT_INT_TICK                0x8000  // enables TimerTick interrupt generation
291
292 /****************************** #define HCF_SLEEP *******************************/
293 #define HCF_DDS                                 0x0001  // Disconnected Deep Sleep
294 #define HCF_CDS                                 0x0002  // Connected Deep Sleep
295
296 /****************************** #define HCF_TALLIES ******************************/
297 #define HCF_TALLIES_NONE                0x0000  // No tally support
298 #define HCF_TALLIES_NIC                 0x0001  // Hermes Tallies accumulated in IFB
299 #define HCF_TALLIES_HCF                 0x0002  // HCF Tallies accumulated in IFB
300 #define HCF_TALLIES_RESET               0x8000  // Tallies in IFB are reset when reported via hcf_get_info
301
302 /************************************************************************************************/
303 /******************************************  L I N U X  *****************************************/
304 /************************************************************************************************/
305
306 #ifdef WVLAN_49
307 #include <asm/io.h>
308 //#include <linux/module.h>
309 #include <wl_version.h>
310
311 /* The following macro ensures that no symbols are exported, minimizing the chance of a symbol
312    collision in the kernel */
313 //EXPORT_NO_SYMBOLS;  //;?this place seems not appropriately to me
314
315 //#define HCF_SLEEP (HCF_CDS | HCF_DDS )
316 #define HCF_SLEEP (HCF_CDS)
317
318 /* Note: Non-WARP firmware all support WPA. However the original Agere
319  * linux driver does not enable WPA. Enabling WPA here causes whatever
320  * preliminary WPA logic to be included, some of which may be specific
321  * to HERMESI.
322  *
323  * Various comment are clear that WARP and WPA are not compatible
324  * (which may just mean WARP does WPA in a different fashion).
325  */
326
327 /* #define HCF_TYPE    (HCF_TYPE_HII5|HCF_TYPE_STA|HCF_TYPE_AP) */
328 #ifdef HERMES25
329 #ifdef WARP
330 #define HCF_TYPE    ( HCF_TYPE_WARP | HCF_TYPE_HII5 )
331 #else
332 #define HCF_TYPE    (HCF_TYPE_HII5 | HCF_TYPE_WPA)
333 #endif /* WARP */
334 #else
335 #define HCF_TYPE    HCF_TYPE_WPA
336 #endif /* HERMES25 */
337
338 #ifdef ENABLE_DMA
339 #define HCF_DMA         1
340 #endif // ENABLE_DMA
341
342 /* We now need a switch to include support for the Mailbox and other necessary extensions */
343 #define HCF_EXT ( HCF_EXT_MB | HCF_EXT_INFO_LOG | HCF_EXT_INT_TICK )//get deepsleep exercise going
344
345 /* ;? The Linux MSF still uses these definitions; define it here until it's removed */
346 #ifndef HCF_TYPE_HII
347 #define HCF_TYPE_HII 0x0004
348 #endif
349
350 #ifndef HCF_TYPE_AP
351 #define HCF_TYPE_AP  0x0010
352 #endif
353
354 #ifndef HCF_TYPE_STA
355 #define HCF_TYPE_STA 0x0020
356 #endif  // HCF_TYPE_STA
357
358 /* Guarantees word alignment */
359 #define HCF_ALIGN               2
360
361 /* Endian macros CNV_INT_TO_LITTLE() and CNV_LITTLE_TO_INT() were renamed to
362    CNV_SHORT_TO_LITTLE() and CNV_LITTLE_TO_SHORT() */
363 #ifndef CNV_INT_TO_LITTLE
364 #define CNV_INT_TO_LITTLE   CNV_SHORT_TO_LITTLE
365 #endif
366
367 #ifndef CNV_LITTLE_TO_INT
368 #define CNV_LITTLE_TO_INT   CNV_LITTLE_TO_SHORT
369 #endif
370
371 #define HCF_ERR_BUSY                    0x06
372
373 /* UIL defines were removed from the HCF */
374 #define UIL_SUCCESS                                     HCF_SUCCESS
375 #define UIL_ERR_TIME_OUT                        HCF_ERR_TIME_OUT
376 #define UIL_ERR_NO_NIC                          HCF_ERR_NO_NIC
377 #define UIL_ERR_LEN                                     HCF_ERR_LEN
378 #define UIL_ERR_MIN                                     HCF_ERR_MAX     /*end of HCF errors which are passed through to UIL
379                                                                                                   *** ** *** ****** ***** *** ****** ******* ** ***  */
380 #define UIL_ERR_IN_USE                          0x44
381 #define UIL_ERR_WRONG_IFB                       0x46
382 #define UIL_ERR_MAX                                     0x7F            /*upper boundary of UIL errors without HCF-pendant
383                                                   ***** ******** ** *** ****** ******* *** *******  */
384 #define UIL_ERR_BUSY                        HCF_ERR_BUSY
385 #define UIL_ERR_DIAG_1                      HCF_ERR_DIAG_1
386 #define UIL_FAILURE                                     0xFF    /* 20010705 nv this relick should be eridicated */
387 #define UIL_ERR_PIF_CONFLICT            0x40    //obsolete
388 #define UIL_ERR_INCOMP_DRV                      0x41    //obsolete
389 #define UIL_ERR_DOS_CALL                        0x43    //obsolete
390 #define UIL_ERR_NO_DRV                          0x42    //obsolete
391 #define UIL_ERR_NSTL                            0x45    //obsolete
392
393
394
395 #if 0  //;? #ifdef get this going LATER HERMES25
396 #define HCF_IO              HCF_IO_32BITS
397 #define HCF_DMA             1
398 #define HCF_DESC_STRCT_EXT  4
399
400 /* Switch for BusMaster DMA support. Note that the above define includes the DMA-specific HCF
401    code in the build. This define sets the MSF to use DMA; if ENABLE_DMA is not defined, then
402    port I/O will be used in the build */
403 #ifndef BUS_PCMCIA
404 #define ENABLE_DMA
405 #endif  // USE_PCMCIA
406
407 #endif  // HERMES25
408
409
410 /* Overrule standard WaveLAN Packet Size when in DMA mode */
411 #ifdef ENABLE_DMA
412 #define HCF_MAX_PACKET_SIZE 2304
413 #else
414 #define HCF_MAX_PACKET_SIZE 1514
415 #endif  // ENABLE_DMA
416
417 /* The following sets the component ID, as well as the versioning. See also wl_version.h */
418 #define MSF_COMPONENT_ID        COMP_ID_LINUX
419
420 #define MSF_COMPONENT_VAR                       DRV_VARIANT
421 #define MSF_COMPONENT_MAJOR_VER     DRV_MAJOR_VERSION
422 #define MSF_COMPONENT_MINOR_VER     DRV_MINOR_VERSION
423
424 /* Define the following to turn on assertions in the HCF */
425 //#define HCF_ASSERT  0x8000
426 #define HCF_ASSERT                      HCF_ASSERT_LNK_MSF_RTN  // statically binding of msf_assert routine
427
428 #ifdef USE_BIG_ENDIAN
429 #define HCF_BIG_ENDIAN  1
430 #else
431 #define HCF_BIG_ENDIAN  0
432 #endif  /* USE_BIG_ENDIAN */
433
434 /* Define the following if your system uses memory-mapped IO */
435 //#define HCF_MEM_IO
436
437 /* The following defines the standard macros required by the HCF to move data to/from the card */
438 #define IN_PORT_BYTE(port)                      ((hcf_8)inb( (hcf_io)(port) ))
439 #define IN_PORT_WORD(port)                      ((hcf_16)inw( (hcf_io)(port) ))
440 #define OUT_PORT_BYTE(port, value)      (outb( (hcf_8) (value), (hcf_io)(port) ))
441 #define OUT_PORT_WORD(port, value)      (outw((hcf_16) (value), (hcf_io)(port) ))
442
443 #define IN_PORT_STRING_16(port, dst, n)    insw((hcf_io)(port), dst, n)
444 #define OUT_PORT_STRING_16(port, src, n)   outsw((hcf_io)(port), src, n)
445 //#define IN_PORT_STRINGL(port, dst, n)   insl((port), (dst), (n))
446 //#define OUT_PORT_STRINGL(port, src, n)  outsl((port), (src), (n))
447 #define IN_PORT_STRING_32(port, dst, n)   insl((port), (dst), (n))
448 #define OUT_PORT_STRING_32(port, src, n)  outsl((port), (src), (n))
449 #define IN_PORT_HCF32(port)          inl( (hcf_io)(port) )
450 #define OUT_PORT_HCF32(port, value)  outl((hcf_32)(value), (hcf_io)(port) )
451
452 #define IN_PORT_DWORD(port)          IN_PORT_HCF32(port)
453 #define OUT_PORT_DWORD(port, value)  OUT_PORT_HCF32(port, value)
454
455 #define  IN_PORT_STRING_8_16(port, addr, len)   IN_PORT_STRING_16(port, addr, len)
456 #define  OUT_PORT_STRING_8_16(port, addr, len)  OUT_PORT_STRING_16(port, addr, len)
457
458 #ifndef CFG_SCAN_CHANNELS_2GHZ
459 #define CFG_SCAN_CHANNELS_2GHZ 0xFCC2
460 #endif /* CFG_SCAN_CHANNELS_2GHZ */
461
462 #define HCF_MAX_MSG 1600 //get going ;?
463 #endif  // WVLAN_49
464
465 /************************************************************************************************************/
466 /***********************************                                   **************************************/
467 /************************************************************************************************************/
468 #if ! defined   HCF_ALIGN
469 #define                 HCF_ALIGN                       1               //default to no alignment
470 #endif //               HCF_ALIGN
471
472 #if ! defined   HCF_ASSERT
473 #define                 HCF_ASSERT                      0
474 #endif //               HCF_ASSERT
475
476 #if ! defined   HCF_BIG_ENDIAN
477 #define                 HCF_BIG_ENDIAN          0
478 #endif //               HCF_BIG_ENDIAN
479
480 #if ! defined   HCF_DMA
481 #define                 HCF_DMA                         0
482 #endif //               HCF_DMA
483
484 #if ! defined   HCF_ENCAP
485 #define                 HCF_ENCAP                       HCF_ENC
486 #endif //               HCF_ENCAP
487
488 #if ! defined   HCF_EXT
489 #define                 HCF_EXT                         0
490 #endif //               HCF_EXT
491
492 #if ! defined   HCF_INT_ON
493 #define                 HCF_INT_ON                      1
494 #endif //               HCF_INT_ON
495
496 #if ! defined   HCF_IO
497 #define                 HCF_IO                          0               //default 16 bits support only, port I/O
498 #endif //               HCF_IO
499
500 #if ! defined   HCF_LEGACY
501 #define                 HCF_LEGACY                      0
502 #endif //               HCF_LEGACY
503
504 #if ! defined   HCF_MAX_LTV
505 #define                 HCF_MAX_LTV                     1200    // sufficient for all known purposes
506 #endif //               HCF_MAX_LTV
507
508 #if ! defined   HCF_PROT_TIME
509 #define                 HCF_PROT_TIME           100             // number of 10K microsec protection timer against H/W malfunction
510 #endif //               HCF_PROT_TIME
511
512 #if ! defined   HCF_SLEEP
513 #define                 HCF_SLEEP                       0
514 #endif //               HCF_SLEEP
515
516 #if ! defined   HCF_TALLIES
517 #define                 HCF_TALLIES                     ( HCF_TALLIES_NIC | HCF_TALLIES_HCF )
518 #endif //               HCF_TALLIES
519
520 #if ! defined   HCF_TYPE
521 #define                 HCF_TYPE                        0
522 #endif //               HCF_TYPE
523
524 #if                             HCF_BIG_ENDIAN
525 #undef                  HCF_BIG_ENDIAN
526 #define                 HCF_BIG_ENDIAN          1               //just for convenience of generating cfg_hcf_opt
527 #endif //               HCF_BIG_ENDIAN
528
529 #if                             HCF_DMA
530 #undef                  HCF_DMA
531 #define                 HCF_DMA                         1               //just for convenience of generating cfg_hcf_opt
532 #endif //               HCF_DMA
533
534 #if                             HCF_INT_ON
535 #undef                  HCF_INT_ON
536 #define                 HCF_INT_ON                      1               //just for convenience of generating cfg_hcf_opt
537 #endif //               HCF_INT_ON
538
539
540 #if ! defined IN_PORT_STRING_8_16
541 #define  IN_PORT_STRING_8_16(port, addr, len)   IN_PORT_STRING_16(port, addr, len)
542 #define  OUT_PORT_STRING_8_16(port, addr, len)  OUT_PORT_STRING_16(port, addr, len)
543 #endif // IN_PORT_STRING_8_16
544
545 /************************************************************************************************/
546 /**********                                                                         *************/
547 /************************************************************************************************/
548
549 #if ! defined   FAR
550 #define                 FAR                                             // default to flat 32-bits code
551 #endif //               FAR
552
553 typedef hcf_8  FAR *wci_bufp;                   // segmented 16-bits or flat 32-bits pointer to 8 bits unit
554 typedef hcf_16 FAR *wci_recordp;                // segmented 16-bits or flat 32-bits pointer to 16 bits unit
555
556 /*      I/O Address size
557 *       Platforms which use port mapped I/O will (in general) have a 64k I/O space, conveniently expressed in a
558 *       16-bits quantity
559 *       Platforms which use memory mapped I/O will (in general) have an I/O space much larger than 64k, and need a
560 *       32-bits quantity to express the I/O base
561 */
562
563 #if HCF_IO & HCF_IO_MEM
564 typedef hcf_32 hcf_io;
565 #else
566 typedef hcf_16 hcf_io;
567 #endif //HCF_IO
568
569 #if     HCF_PROT_TIME > 128
570 #define HCF_PROT_TIME_SHFT      3
571 #define HCF_PROT_TIME_DIV       8
572 #elif   HCF_PROT_TIME > 64
573 #define HCF_PROT_TIME_SHFT      2
574 #define HCF_PROT_TIME_DIV       4
575 #elif   HCF_PROT_TIME > 32
576 #define HCF_PROT_TIME_SHFT      1
577 #define HCF_PROT_TIME_DIV       2
578 #else //HCF_PROT_TIME >= 19
579 #define HCF_PROT_TIME_SHFT      0
580 #define HCF_PROT_TIME_DIV       1
581 #endif
582
583 #define HCF_PROT_TIME_CNT (HCF_PROT_TIME / HCF_PROT_TIME_DIV)
584
585
586 /************************************************************************************************************/
587 /******************************************* . . . . . . . . .  *********************************************/
588 /************************************************************************************************************/
589
590 /* MSF_COMPONENT_ID is used to define the CFG_IDENTITY_STRCT in HCF.C
591 * CFG_IDENTITY_STRCT is defined in HCF.C purely based on convenience arguments.
592 * The HCF can not have the knowledge to determine the ComponentId field of the Identity record (aka as
593 * Version Record), therefore the MSF part of the Drivers must supply this value via the System Constant
594 * MSF_COMPONENT_ID.
595 * There is a set of values predefined in MDD.H (format COMP_ID_.....)
596 *
597 * Note that taking MSF_COMPONENT_ID as a default value for DUI_COMPAT_VAR is purely an implementation
598 * convenience, the numerical values of these two quantities have none functional relationship whatsoever.
599 */
600
601 #if defined     MSF_COMPONENT_ID
602
603 #if ! defined   DUI_COMPAT_VAR
604 #define                 DUI_COMPAT_VAR          MSF_COMPONENT_ID
605 #endif //               DUI_COMPAT_VAR
606
607 #if ! defined   DUI_COMPAT_BOT          //;?this way utilities can lower as well raise the bottom
608 #define                 DUI_COMPAT_BOT          8
609 #endif //               DUI_COMPAT_BOT
610
611 #if ! defined   DUI_COMPAT_TOP          //;?this way utilities can lower as well raise the top
612 #define                 DUI_COMPAT_TOP       8
613 #endif //               DUI_COMPAT_TOP
614
615 #endif // MSF_COMPONENT_ID
616
617 #if (HCF_TYPE) & HCF_TYPE_HII5
618
619 #if ! defined   HCF_HSI_VAR_5
620 #define                 HCF_HSI_VAR_5
621 #endif //               HCF_HSI_VAR_5
622
623 #if ! defined   HCF_APF_VAR_4
624 #define                 HCF_APF_VAR_4
625 #endif //               HCF_APF_VAR_4
626
627 #if (HCF_TYPE) & HCF_TYPE_WARP
628 #if ! defined   HCF_STA_VAR_4
629 #define                 HCF_STA_VAR_4
630 #endif //               HCF_STA_VAR_4
631 #else
632 #if ! defined   HCF_STA_VAR_2
633 #define                 HCF_STA_VAR_2
634 #endif //               HCF_STA_VAR_2
635 #endif
636
637 #if defined HCF_HSI_VAR_4
638 err: HSI variants 4 correspond with HII;
639 #endif // HCF_HSI_VAR_4
640
641 #else
642
643 #if ! defined   HCF_HSI_VAR_4
644 #define                 HCF_HSI_VAR_4           //Hermes-II all types (for the time being!)
645 #endif //               HCF_HSI_VAR_4
646
647 #if ! defined   HCF_APF_VAR_2
648 #define                 HCF_APF_VAR_2
649 #endif //               HCF_APF_VAR_2
650
651 #if ! defined   HCF_STA_VAR_2
652 #define                 HCF_STA_VAR_2
653 #endif //               HCF_STA_VAR_2
654
655 #endif // HCF_TYPE_HII5
656
657 #if ! defined   HCF_PRI_VAR_3
658 #define         HCF_PRI_VAR_3
659 #endif //               HCF_PRI_VAR_3
660
661 #if defined HCF_HSI_VAR_1 || defined HCF_HSI_VAR_2 || defined HCF_HSI_VAR_3
662 err: HSI variants 1, 2 and 3 correspond with H-I only;
663 #endif // HCF_HSI_VAR_1, HCF_HSI_VAR_2, HCF_HSI_VAR_3
664
665 #if defined HCF_PRI_VAR_1 || defined HCF_PRI_VAR_2
666 err: primary variants 1 and 2 correspond with H-I only;
667 #endif // HCF_PRI_VAR_1 / HCF_PRI_VAR_2
668
669
670 /************************************************************************************************************/
671 /******************************************* . . . . . . . . .  *********************************************/
672 /************************************************************************************************************/
673
674
675 /* The BASED customization macro is used to resolves the SS!=DS conflict for the Interrupt Service logic in
676  * DOS Drivers. Due to the cumbersomeness of mixing C and assembler local BASED variables still end up in the
677  * wrong segment. The workaround is that the HCF uses only global BASED variables or IFB-based variables.
678  * The "BASED" construction (supposedly) only amounts to something in the small memory model.
679  *
680  * Note that the whole BASED rigmarole is needlessly complicated because both the Microsoft Compiler and
681  * Linker are unnecessary restrictive in what far pointer manipulation they allow
682  */
683
684 #if ! defined   BASED
685 #define                 BASED
686 #endif //               BASED
687
688 #if ! defined   EXTERN_C
689 #ifdef __cplusplus
690 #define                 EXTERN_C extern "C"
691 #else
692 #define                 EXTERN_C
693 #endif // __cplusplus
694 #endif //               EXTERN_C
695
696 #if ! defined   NULL
697 #define                 NULL    ((void *) 0)
698 #endif //               NULL
699
700 #if ! defined   TEXT
701 #define                 TEXT(x) x
702 #endif //               TEXT
703
704 /************************************************************************************************************/
705 /*********************** C O N F L I C T   D E T E C T I O N  &  R E S O L U T I O N ************************/
706 /************************************************************************************************************/
707 #if HCF_ALIGN != 1 && HCF_ALIGN != 2 && HCF_ALIGN != 4 && HCF_ALIGN != 8
708 err: invalid value for HCF_ALIGN;
709 #endif // HCF_ALIGN
710
711 #if (HCF_ASSERT) & ~( HCF_ASSERT_PRINTF | HCF_ASSERT_SW_SUP | HCF_ASSERT_MB | HCF_ASSERT_RT_MSF_RTN | \
712                                           HCF_ASSERT_LNK_MSF_RTN )
713 err: invalid value for HCF_ASSERT;
714 #endif // HCF_ASSERT
715
716 #if (HCF_ASSERT) & HCF_ASSERT_MB && ! ( (HCF_EXT) & HCF_EXT_MB )                //detect potential conflict
717 err: these macros are not used consistently;
718 #endif // HCF_ASSERT_MB / HCF_EXT_MB
719
720 #if HCF_BIG_ENDIAN != 0 && HCF_BIG_ENDIAN != 1
721 err: invalid value for HCF_BIG_ENDIAN;
722 #endif // HCF_BIG_ENDIAN
723
724 #if HCF_DMA != 0 && HCF_DMA != 1
725 err: invalid value for HCF_DMA;
726 #endif // HCF_DMA
727
728 #if (HCF_ENCAP) & ~( HCF_ENC | HCF_ENC_SUP )
729 err: invalid value for HCF_ENCAP;
730 #endif // HCF_ENCAP
731
732 #if (HCF_EXT) & ~( HCF_EXT_INFO_LOG | HCF_EXT_INT_TX_EX | HCF_EXT_TALLIES_FW | HCF_EXT_TALLIES_HCF      | \
733                                    HCF_EXT_NIC_ACCESS | HCF_EXT_MB | HCF_EXT_INT_TICK | \
734                                    HCF_EXT_IFB_STRCT | HCF_EXT_DESC_STRCT | HCF_EXT_TX_CONT )
735 err: invalid value for HCF_EXT;
736 #endif // HCF_EXT
737
738 #if HCF_INT_ON != 0 && HCF_INT_ON != 1
739 err: invalid value for HCF_INT_ON;
740 #endif // HCF_INT_ON
741
742 #if (HCF_IO) & ~( HCF_IO_MEM | HCF_IO_32BITS )
743 err: invalid value for HCF_IO;
744 #endif // HCF_IO
745
746 #if HCF_LEGACY != 0 && HCF_LEGACY != 1
747 err: invalid value for HCF_LEGACY;
748 #endif // HCF_LEGACY
749
750 #if HCF_MAX_LTV < 16 || HCF_MAX_LTV > 2304
751 err: invalid value for HCF_MAX_LTV;
752 #endif // HCF_MAX_LTV
753
754 #if HCF_PROT_TIME != 0 && ( HCF_PROT_TIME < 19 || 256 < HCF_PROT_TIME )
755 err: below minimum .08 second required by Hermes or possibly above hcf_32 capacity;
756 #endif // HCF_PROT_TIME
757
758 #if (HCF_SLEEP) & ~( HCF_CDS | HCF_DDS )
759 err: invalid value for HCF_SLEEP;
760 #endif // HCF_SLEEP
761
762 #if (HCF_SLEEP) && ! (HCF_INT_ON)
763 err: these macros are not used consistently;
764 #endif // HCF_SLEEP / HCF_INT_ON
765
766 #if (HCF_SLEEP) && ! ( (HCF_EXT) & HCF_EXT_INT_TICK )
767 //;? err: these macros are not used consistently;
768 #endif // HCF_SLEEP / HCF_EXT_INT_TICK
769
770 #if (HCF_TALLIES) & ~( HCF_TALLIES_HCF | HCF_TALLIES_NIC | HCF_TALLIES_RESET ) || \
771         (HCF_TALLIES) == HCF_TALLIES_RESET
772 err: invalid value for HCF_TALLIES;
773 #endif // HCF_TALLIES
774
775 #if (HCF_TYPE) & ~(HCF_TYPE_WPA | HCF_TYPE_USB | HCF_TYPE_PRELOADED | HCF_TYPE_HII5 | HCF_TYPE_WARP | \
776                 HCF_TYPE_CCX /* | HCF_TYPE_TX_DELAY */ )
777 err: invalid value for HCF_TYPE;
778 #endif //HCF_TYPE
779
780 #if (HCF_TYPE) & HCF_TYPE_WARP && (HCF_TYPE) & HCF_TYPE_WPA
781 err: at most 1 of these macros should be defined;
782 #endif //HCF_TYPE_WARP / HCF_TYPE_WPA
783
784 #endif //HCFCFG_H
785