PageRenderTime 93ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/staging/wlags49_h2/hcfcfg.h

https://bitbucket.org/slukk/jb-tsm-kernel-4.2
C Header | 2344 lines | 1361 code | 501 blank | 482 comment | 121 complexity | a7297628c854171096a479aff05cf076 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1. // vim:tw=110:ts=4:
  2. #ifndef HCFCFG_H
  3. #define HCFCFG_H 1
  4. /*************************************************************************************************************
  5. *
  6. * FILE : hcfcfg.tpl // hcfcfg.h
  7. *
  8. * DATE : $Date: 2004/08/05 11:47:10 $ $Revision: 1.6 $
  9. * Original: 2004/04/08 15:18:16 Revision: 1.40 Tag: t20040408_01
  10. * Original: 2004/04/01 15:32:55 Revision: 1.38 Tag: t7_20040401_01
  11. * Original: 2004/03/10 15:39:28 Revision: 1.34 Tag: t20040310_01
  12. * Original: 2004/03/03 14:10:12 Revision: 1.32 Tag: t20040304_01
  13. * Original: 2004/03/02 09:27:12 Revision: 1.30 Tag: t20040302_03
  14. * Original: 2004/02/24 13:00:28 Revision: 1.25 Tag: t20040224_01
  15. * Original: 2004/02/18 17:13:57 Revision: 1.23 Tag: t20040219_01
  16. *
  17. * AUTHOR : Nico Valster
  18. *
  19. * DESC : HCF Customization Macros
  20. * hcfcfg.tpl list all #defines which must be specified to:
  21. * adjust the HCF functions defined in HCF.C to the characteristics of a specific environment
  22. * o maximum sizes for messages
  23. * o Endianess
  24. * Compiler specific macros
  25. * o port I/O macros
  26. * o type definitions
  27. *
  28. * By copying HCFCFG.TPL to HCFCFG.H and -if needed- modifying the #defines the WCI functionality can be
  29. * tailored
  30. *
  31. * Supported environments:
  32. * WVLAN_41 Miniport NDIS 3.1
  33. * WVLAN_42 Packet Microsoft Visual C 1.5
  34. * WVLAN_43 16 bits DOS ODI Microsoft Visual C 1.5
  35. * WVLAN_44 32 bits ODI (__NETWARE_386__) WATCOM
  36. * WVLAN_45 MAC_OS MPW?, Symantec?
  37. * WVLAN_46 Windows CE (_WIN32_WCE) Microsoft ?
  38. * WVLAN_47 LINUX (__LINUX__) GCC, discarded, based on GPL'ed HCF-light
  39. * WVLAN_48 Miniport NDIS 5
  40. * WVLAN_49 LINUX (__LINUX__) GCC, originally based on pre-compiled HCF_library
  41. * migrated to use the HCF sources when Lucent Technologies
  42. * brought the HCF module under GPL
  43. * WVLAN_51 Miniport USB NDIS 5
  44. * WVLAN_52 Miniport NDIS 4
  45. * WVLAN_53 VxWorks END Station driver
  46. * WVLAN_54 VxWorks END Access Point driver
  47. * WVLAN_81 WavePoint BORLAND C
  48. * WCITST Inhouse test tool Microsoft Visual C 1.5
  49. * WSU WaveLAN Station Update Microsoft Visual C ??
  50. * SCO UNIX not yet actually used ? ?
  51. * __ppc OEM supplied ?
  52. * _AM29K OEM supplied ?
  53. * ? OEM supplied Microtec Research 80X86 Compiler
  54. *
  55. **************************************************************************************************************
  56. *
  57. *
  58. * SOFTWARE LICENSE
  59. *
  60. * This software is provided subject to the following terms and conditions,
  61. * which you should read carefully before using the software. Using this
  62. * software indicates your acceptance of these terms and conditions. If you do
  63. * not agree with these terms and conditions, do not use the software.
  64. *
  65. * COPYRIGHT © 1994 - 1995 by AT&T. All Rights Reserved
  66. * COPYRIGHT © 1996 - 2000 by Lucent Technologies. All Rights Reserved
  67. * COPYRIGHT © 2001 - 2004 by Agere Systems Inc. All Rights Reserved
  68. * All rights reserved.
  69. *
  70. * Redistribution and use in source or binary forms, with or without
  71. * modifications, are permitted provided that the following conditions are met:
  72. *
  73. * . Redistributions of source code must retain the above copyright notice, this
  74. * list of conditions and the following Disclaimer as comments in the code as
  75. * well as in the documentation and/or other materials provided with the
  76. * distribution.
  77. *
  78. * . Redistributions in binary form must reproduce the above copyright notice,
  79. * this list of conditions and the following Disclaimer in the documentation
  80. * and/or other materials provided with the distribution.
  81. *
  82. * . Neither the name of Agere Systems Inc. nor the names of the contributors
  83. * may be used to endorse or promote products derived from this software
  84. * without specific prior written permission.
  85. *
  86. * Disclaimer
  87. *
  88. * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  89. * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
  90. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
  91. * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
  92. * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
  93. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  94. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  95. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  96. * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
  97. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  98. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  99. * DAMAGE.
  100. *
  101. *
  102. *************************************************************************************************************/
  103. /* Alignment
  104. * Some platforms can access words on odd boundaries (with possibly an performance impact), at other
  105. * platforms such an access may result in a memory access violation.
  106. * It is assumed that everywhere where the HCF casts a char pointer into a word pointer, the alignment
  107. * criteria are met. This put some restrictions on the MSF, which are assumed to be "automatically" fulfilled
  108. * at the applicable platforms
  109. * To assert this assumption, the macro HCF_ALIGN can be defined. The default value is 1, meaning byte
  110. * alignment (or no alignment), a value of 2 means word alignment, a value of 4 means double word alignment
  111. */
  112. /***************************** IN_PORT_STRING_8_16 S a m p l e s *****************************************
  113. // C implementation which let the processor handle the word-at-byte-boundary problem
  114. #define IN_PORT_STRING_8_16( port, addr, n) while ( n-- ) \
  115. { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_8 FAR*)addr)+=2; }
  116. // C implementation which handles the word-at-byte-boundary problem
  117. #define IN_PORT_STRING_8_16( port, addr, n) while ( n-- ) \
  118. { hcf_16 i = IN_PORT_WORD(port); *((hcf_8 FAR*)addr)++ = (hcf_8)i; *((hcf_8 FAR*)addr)++ = (hcf_8)(i>>8);}
  119. // Assembler implementation
  120. #define IN_PORT_STRING_8_16( port, addr, len) __asm \
  121. { \
  122. __asm push di \
  123. __asm push es \
  124. __asm mov cx,len \
  125. __asm les di,addr \
  126. __asm mov dx,port \
  127. __asm rep insw \
  128. __asm pop es \
  129. __asm pop di \
  130. }
  131. ***************************** OUT_PORT_STRING_8_16 S a m p l e s ******************************************
  132. // C implementation which let the processor handle the word-at-byte-boundary problem
  133. #define OUT_PORT_STRING_8_16( port, addr, n) while ( n-- ) \
  134. { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; ((hcf_8 FAR*)addr)+=2; }
  135. // C implementation which handles the word-at-byte-boundary problem
  136. #define OUT_PORT_STRING_8_16( port, addr, n) while ( n-- ) \
  137. { OUT_PORT_WORD( port, *((hcf_8 FAR*)addr) | *(((hcf_8 FAR*)addr)+1)<<8 ); (hcf_8 FAR*)addr+=2; }
  138. // Assembler implementation
  139. #define OUT_PORT_STRING_8_16( port, addr, len) __asm \
  140. { \
  141. __asm push si \
  142. __asm push ds \
  143. __asm mov cx,len \
  144. __asm lds si,addr \
  145. __asm mov dx,port \
  146. __asm rep outsw \
  147. __asm pop ds \
  148. __asm pop si \
  149. }
  150. *************************************************************************************************************/
  151. /************************************************************************************************/
  152. /****************** C O M P I L E R S P E C I F I C M A C R O S ***************************/
  153. /************************************************************************************************/
  154. /*************************************************************************************************
  155. *
  156. * !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
  157. * !!!! Do not call these macros with parameters which introduce side effects !!!!
  158. * !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
  159. *
  160. *
  161. * By selecting the appropriate Macro definitions by means of modifying the "#ifdef 0/1" lines, the HCF can be
  162. * adjusted for the I/O characteristics of a specific compiler
  163. *
  164. * If needed the macros can be modified or replaced with definitions appropriate for your personal platform.
  165. * If you need to make such changes it is appreciated if you inform Agere Systems
  166. * That way the changes can become part of the next release of the WCI
  167. *
  168. * For convenience of the MSF-programmer, all macros are allowed to modify their parameters (although some
  169. * might argue that this would constitute bad coding practice). This has its implications on the HCF, e.g. as a
  170. * consequence these macros should not be called with parameters which have side effects, e.g auto-increment.
  171. *
  172. * in the Microsoft implementation of inline assembly it is O.K. to corrupt all flags except the direction flag
  173. * and to corrupt all registers except the segment registers and EDI, ESI, ESP and EBP (or their 16 bits
  174. * equivalents). Other environments may have other constraints
  175. *
  176. * in the Intel environment it is O.K to have a word (as a 16 bits quantity) at a byte boundary, hence
  177. * IN_/OUT_PORT_STRING_8_16 can move words between PC-memory and NIC-memory with as only constraint that the
  178. * words are on a word boundary in NIC-memory. This does not hold true for all conceivable environments, e.g.
  179. * an Motorola 68xxx does not allow this. Probably/hopefully the boundary conditions imposed by these type of
  180. * platforms prevent this case from materializing. If this is not the case, OUT_PORT_STRING_8_16 must be coded
  181. * by combining two Host memory hcf_8 values at a time to a single hcf_16 value to be passed to the NIC and
  182. * IN_PORT_STRING_8_16 the single hcf_16 retrieved from the NIC must be split in two hcf_8 values to be stored
  183. * in Host memory (see the sample code above)
  184. *
  185. * The prototypes and functional description of the macros are:
  186. *
  187. * hcf_16 IN_PORT_WORD( hcf_16 port )
  188. * Reads a word (16 bits) from the specified port
  189. *
  190. * void OUT_PORT_WORD( hcf_16 port, hcf_16 value)
  191. * Writes a word (16 bits) to the specified port
  192. *
  193. * hcf_16 IN_PORT_DWORD( hcf_16 port )
  194. * Reads a dword (32 bits) from the specified port
  195. *
  196. * void OUT_PORT_DWORD( hcf_16 port, hcf_32 value)
  197. * Writes a dword (32 bits) to the specified port
  198. *
  199. * void IN_PORT_STRING_8_16( port, addr, len)
  200. * Reads len number of words (16 bits) from NIC memory via the specified port to the (FAR)
  201. * byte-pointer addr in PC-RAM
  202. * Note that len specifies the number of words, NOT the number of bytes
  203. * !!!NOTE, although len specifies the number of words, addr MUST be a char pointer NOTE!!!
  204. * See also the common notes for IN_PORT_STRING_8_16 and OUT_PORT_STRING_8_16
  205. *
  206. * void OUT_PORT_STRING_8_16( port, addr, len)
  207. * Writes len number of words (16 bits) from the (FAR) byte-pointer addr in PC-RAM via the specified
  208. * port to NIC memory
  209. * Note that len specifies the number of words, NOT the number of bytes.
  210. * !!!NOTE, although len specifies the number of words, addr MUST be a char pointer NOTE!!!
  211. *
  212. * The peculiar combination of word-length and char pointers for IN_PORT_STRING_8_16 as well as
  213. * OUT_PORT_STRING_8_16 is justified by the assumption that it offers a more optimal algorithm
  214. *
  215. * void IN_PORT_STRING_32( port, addr, len)
  216. * Reads len number of double-words (32 bits) from NIC memory via the specified port to the (FAR)
  217. * double-word address addr in PC-RAM
  218. *
  219. * void OUT_PORT_STRING_32( port, addr, len)
  220. * Writes len number of double-words (32 bits) from the (FAR) double-word address addr in PC-RAM via
  221. * the specified port to NIC memory
  222. *
  223. * !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
  224. * !!!! Do not call these macros with parameters which introduce side effects !!!!
  225. * !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
  226. *
  227. *************************************************************************************************/
  228. /**************************** define INT Types ******************************/
  229. typedef unsigned char hcf_8;
  230. typedef unsigned short hcf_16;
  231. typedef unsigned long hcf_32;
  232. /**************************** define I/O Types ******************************/
  233. #define HCF_IO_MEM 0x0001 // memory mapped I/O ( 0: Port I/O )
  234. #define HCF_IO_32BITS 0x0002 // 32Bits support ( 0: only 16 Bits I/O)
  235. /****************************** #define HCF_TYPE ********************************/
  236. #define HCF_TYPE_NONE 0x0000 // No type
  237. #define HCF_TYPE_WPA 0x0001 // WPA support
  238. #define HCF_TYPE_USB 0x0002 // reserved (USB Dongle driver support)
  239. //#define HCF_TYPE_HII 0x0004 // Hermes-II, to discriminate H-I and H-II CFG_HCF_OPT_STRCT
  240. #define HCF_TYPE_WARP 0x0008 // WARP F/W
  241. #define HCF_TYPE_PRELOADED 0x0040 // pre-loaded F/W
  242. #define HCF_TYPE_HII5 0x0080 // Hermes-2.5 H/W
  243. #define HCF_TYPE_CCX 0x0100 // CKIP
  244. #define HCF_TYPE_BEAGLE_HII5 0x0200 // Beagle Hermes-2.5 H/W
  245. #define HCF_TYPE_TX_DELAY 0x4000 // Delayed transmission ( non-DMA only)
  246. /****************************** #define HCF_ASSERT ******************************/
  247. #define HCF_ASSERT_NONE 0x0000 // No assert support
  248. #define HCF_ASSERT_PRINTF 0x0001 // Hermes generated debug info
  249. #define HCF_ASSERT_SW_SUP 0x0002 // logging via Hermes support register
  250. #define HCF_ASSERT_MB 0x0004 // logging via Mailbox
  251. #define HCF_ASSERT_RT_MSF_RTN 0x4000 // dynamically binding of msf_assert routine
  252. #define HCF_ASSERT_LNK_MSF_RTN 0x8000 // statically binding of msf_assert routine
  253. /****************************** #define HCF_ENCAP *******************************/
  254. #define HCF_ENC_NONE 0x0000 // No encapsulation support
  255. #define HCF_ENC 0x0001 // HCF handles En-/Decapsulation
  256. #define HCF_ENC_SUP 0x0002 // HCF supports MSF to handle En-/Decapsulation
  257. /****************************** #define HCF_EXT *********************************/
  258. #define HCF_EXT_NONE 0x0000 // No expanded features
  259. #define HCF_EXT_INFO_LOG 0x0001 // logging of Hermes Info frames
  260. //#define HCF_EXT_INT_TX_OK 0x0002 // RESERVED!!! monitoring successful Tx message
  261. #define HCF_EXT_INT_TX_EX 0x0004 // monitoring unsuccessful Tx message
  262. //#define HCF_EXT_MON_MODE 0x0008 // LEGACY
  263. #define HCF_EXT_TALLIES_FW 0x0010 // support for up to 32 Hermes Engineering tallies
  264. #define HCF_EXT_TALLIES_HCF 0x0020 // support for up to 8 HCF Engineering tallies
  265. #define HCF_EXT_NIC_ACCESS 0x0040 // direct access via Aux-ports and to Hermes registers and commands
  266. #define HCF_EXT_MB 0x0080 // MailBox code expanded
  267. #define HCF_EXT_IFB_STRCT 0x0100 // MSF custom pointer in IFB
  268. #define HCF_EXT_DESC_STRCT 0x0200 // MSF custom pointer in Descriptor
  269. #define HCF_EXT_TX_CONT 0x4000 // Continuous transmit test
  270. #define HCF_EXT_INT_TICK 0x8000 // enables TimerTick interrupt generation
  271. /****************************** #define HCF_SLEEP *******************************/
  272. #define HCF_DDS 0x0001 // Disconnected Deep Sleep
  273. #define HCF_CDS 0x0002 // Connected Deep Sleep
  274. /****************************** #define HCF_TALLIES ******************************/
  275. #define HCF_TALLIES_NONE 0x0000 // No tally support
  276. #define HCF_TALLIES_NIC 0x0001 // Hermes Tallies accumulated in IFB
  277. #define HCF_TALLIES_HCF 0x0002 // HCF Tallies accumulated in IFB
  278. #define HCF_TALLIES_RESET 0x8000 // Tallies in IFB are reset when reported via hcf_get_info
  279. /************************************************************************************************/
  280. /****************************** M I N I P O R T N D I S *************************************/
  281. /************************************************************************************************/
  282. #if defined WVLAN_41 || defined WVLAN_48 || defined WVLAN_52 || defined _WIN32_WCE
  283. #ifndef WVLAN_46
  284. #define HCF_EXT (HCF_EXT_INFO_LOG | HCF_EXT_MB | HCF_EXT_NIC_ACCESS )
  285. #else
  286. #define HCF_EXT ( HCF_EXT_TX_CONT | HCF_EXT_INFO_LOG | HCF_EXT_MB | HCF_EXT_NIC_ACCESS )
  287. #endif
  288. #define HCF_DLV 1 //H-I legacy, superfluous for H-II
  289. #ifdef _WIN32_WCE
  290. #define HCF_IO HCF_IO_MEM
  291. #define HCF_DMA 0 // To enable DMA
  292. #endif
  293. #if _VARIANT == 7
  294. #define HCF_SLEEP HCF_CDS
  295. #endif // _VARIANT == 7
  296. #if _VARIANT == 5 || _VARIANT == 6
  297. #define _WARP
  298. #define _AES
  299. #define HCF_SLEEP HCF_CDS
  300. #if _VARIANT == 6
  301. //! #define _RSN
  302. #endif // _VARIANT == 6
  303. #ifndef _WIN32_WCE
  304. #define HCF_IO HCF_IO_32BITS
  305. #define HCF_DMA 1 // To enable DMA
  306. #endif
  307. #endif // _VARIANT == 5 || _VARIANT == 6
  308. //HWi for migration purposes I defined a define which will be TRUE for ALL drivers
  309. //Meaning that _CCX defined code which we think will get a all driver OK flag can be defined from _CCX to _CCX_OK
  310. #if defined WVLAN_48 // && !defined _WIN32_WCE
  311. #if _VARIANT == 4 || _VARIANT == 6
  312. #define _CCX_OK 1
  313. #endif // _VARIANT == 4 || _VARIANT == 6
  314. #endif // WVLAN_48
  315. //#if !defined WVLAN_46
  316. #if defined WVLAN_48
  317. #if _VARIANT == 4 || _VARIANT == 6
  318. #define _CCX
  319. #define HCF_MAX_MSG_CKIP_PADDING 86 //, use 86 for rx fragmentation. 28 is enuf for MIC+PPK encapsulation
  320. #define HCF_MAX_MSG ( 1514 + HCF_MAX_MSG_CKIP_PADDING ) // need extra padding for CKIP (need to subtract 28 for NDIS)
  321. #endif // _VARIANT == 4 || _VARIANT == 6
  322. #endif // WVLAN_48
  323. //#endif // WVLAN_46
  324. #if !defined WVLAN_46
  325. #define _PEEK
  326. #endif
  327. #ifndef _WIN32_WCE
  328. // ASSERT already used by WinCE...
  329. #ifdef ASSERT
  330. #undef ASSERT
  331. #define ASSERT(x) ASSERTDEBUGMSG((x), (TEXT("SIMULATE ASSERT:")))
  332. #endif
  333. #endif
  334. #if defined WVLAN_41
  335. #define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_31
  336. #endif // WVLAN_41
  337. #if defined WVLAN_48 && !defined _WIN32_WCE
  338. #define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_50
  339. #endif // WVLAN_48 / _WIN32_WCE
  340. #if defined WVLAN_52 && !defined _WIN32_WCE
  341. #define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_40
  342. #endif // WVLAN_52 / _WIN32_WCE
  343. #if defined WVLAN_46
  344. #define MSF_COMPONENT_ID COMP_ID_WIN_CE
  345. #endif // _WIN32_WCE
  346. #define MSF_COMPONENT_VAR _VARIANT
  347. #define T1__HCF_TYPE (HCF_TYPE_NONE)
  348. #define T2__HCF_TYPE (T1__HCF_TYPE)
  349. #ifdef _WARP
  350. #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5 | HCF_TYPE_WARP )
  351. #else
  352. #if _VARIANT == 7
  353. #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5)
  354. #else // _VARIANT == 7
  355. #define T3__HCF_TYPE (T2__HCF_TYPE)
  356. #endif // _VARIANT == 7
  357. #endif // _WARP
  358. #ifdef _CCX_OK
  359. #define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX)
  360. #else
  361. #define T4__HCF_TYPE (T3__HCF_TYPE)
  362. #endif // _CCX_OK
  363. //not suitable for H-II #define HCF_CFG_STA_1_BOTTOM 16
  364. // Default WPA in ON for all drivers except for WARP driver
  365. #ifdef _WARP
  366. #define T5__HCF_TYPE (T4__HCF_TYPE)
  367. #else // _WARP
  368. #define T5__HCF_TYPE (T4__HCF_TYPE | HCF_TYPE_WPA)
  369. #endif // _WARP
  370. #define HCF_TYPE (T5__HCF_TYPE)
  371. // This is needed to get aux_ctrl() from the HCF for WlFreezeAndDump()
  372. #if (defined DBG && DBG != 0)
  373. #ifndef STATIC
  374. #define STATIC
  375. #endif
  376. #endif
  377. #if !defined SOFTRONICS_CODE && !defined _APIDLL && !defined _WIN32_WCE
  378. #include <ndis.h>
  379. #endif // SOFTRONICS_CODE / _APIDLL / _WIN32_WCE
  380. #if defined _WIN32_WCE
  381. #include <windows.h>
  382. #include <winnt.h>
  383. #endif // _WIN32_WCE
  384. #include "version.h"
  385. #define MSF_COMPONENT_MAJOR_VER TPI_MAJOR_VERSION
  386. #define MSF_COMPONENT_MINOR_VER TPI_MINOR_VERSION
  387. #if !defined _APIDLL && !defined _WIN32_WCE
  388. __inline UCHAR NDIS_IN_BYTE( ULONG port )
  389. {
  390. UCHAR value;
  391. NdisRawReadPortUchar(port , &value);
  392. return (value);
  393. }
  394. __inline ULONG NDIS_IN_LONG( ULONG port )
  395. {
  396. ULONG value;
  397. NdisRawReadPortUlong(port , &value);
  398. return (value);
  399. }
  400. __inline USHORT NDIS_IN_WORD( ULONG port )
  401. {
  402. USHORT value;
  403. NdisRawReadPortUshort(port , &value);
  404. return (value);
  405. }
  406. #define IN_PORT_DWORD(port) NDIS_IN_LONG( (ULONG) (port) )
  407. #define IN_PORT_WORD(port) NDIS_IN_WORD( (ULONG) (port) )
  408. #define OUT_PORT_DWORD(port, value) NdisRawWritePortUlong((ULONG) (port) , value)
  409. #define OUT_PORT_WORD(port, value) NdisRawWritePortUshort((ULONG) (port) , (USHORT) (value))
  410. #define IN_PORT_STRING_8_16(port, addr, len) IN_PORT_STRING_16(port, addr, len)
  411. #define OUT_PORT_STRING_8_16(port, addr, len) OUT_PORT_STRING_16(port, addr, len)
  412. #define IN_PORT_STRING_32(port, addr, len) { \
  413. NdisRawReadPortBufferUlong(port, addr, (len)); \
  414. }
  415. #define OUT_PORT_STRING_32(port, addr, len) { \
  416. NdisRawWritePortBufferUlong(port, addr, (len)); \
  417. }
  418. #define IN_PORT_STRING_16(port, addr, len) NdisRawReadPortBufferUshort(port, addr, (len));
  419. #define OUT_PORT_STRING_16(port, addr, len) NdisRawWritePortBufferUshort(port, addr, (len));
  420. #endif // _APIDLL / _WIN32_WCE
  421. #if defined _WIN32_WCE
  422. #define HCF_ALIGN 2
  423. #define HCF_MEM_IO 1 // overrule standard Port I/O with Memory mapped I/O
  424. #define HCF_PROT_TIME 49
  425. #define IN_PORT_BYTE CE_IN_PORT_BYTE
  426. #define OUT_PORT_BYTE CE_OUT_PORT_BYTE
  427. #define IN_PORT_WORD CE_IN_PORT_WORD
  428. #define OUT_PORT_WORD CE_OUT_PORT_WORD
  429. #define IN_PORT_STRING_16 CE_IN_PORT_STRING
  430. #define OUT_PORT_STRING_16 CE_OUT_PORT_STRING
  431. extern hcf_8 CE_IN_PORT_BYTE(hcf_32 port);
  432. extern void CE_OUT_PORT_BYTE(hcf_32 port, hcf_8 value);
  433. extern hcf_16 CE_IN_PORT_WORD(hcf_32 port);
  434. extern void CE_OUT_PORT_WORD(hcf_32 port, hcf_16 value);
  435. extern void CE_IN_PORT_STRING(hcf_32 port, void *addr, hcf_16 len);
  436. extern void CE_OUT_PORT_STRING(hcf_32 port, void *addr, hcf_16 len);
  437. #endif
  438. #if defined _DEBUG || (defined DBG && DBG != 0)
  439. #define HCF_ASSERT ( HCF_ASSERT_LNK_MSF_RTN | HCF_ASSERT_RT_MSF_RTN | HCF_ASSERT_PRINTF ) //0xC001
  440. //#define HCF_ASSERT ( HCF_ASSERT_LNK_MSF_RTN | HCF_ASSERT_RT_MSF_RTN | HCF_ASSERT_PRINTF | HCF_ASSERT_MB ) //just to test
  441. #endif // _DEBUG || DBG
  442. #if defined DEBUG || defined _DEBUG || (defined DBG && DBG != 0)
  443. #ifdef _WIN32_WCE
  444. #define DBGA2W(DBGSTR) CeConvertAnsiToUnicodeLen((char*)DBGSTR)
  445. #define OUTPUTDEBUGMSG(dprintf_exp) ((void)((! ZONE_DEBUG) ? 0:ce_debug_out dprintf_exp))
  446. #define ASSERTDEBUGMSG(cond, dprintf_exp) ((void)((cond) ? 0:ce_debug_out dprintf_exp))
  447. #define ZONE_ERROR DEBUGZONE(0)
  448. #define ZONE_WARN DEBUGZONE(1)
  449. #define ZONE_FUNCTION DEBUGZONE(2)
  450. #define ZONE_INIT DEBUGZONE(3)
  451. #define ZONE_INTR DEBUGZONE(4)
  452. #define ZONE_RCV DEBUGZONE(5)
  453. #define ZONE_XMIT DEBUGZONE(6)
  454. #define ZONE_ASSERT DEBUGZONE(7)
  455. #define ZONE_DEBUG DEBUGZONE(8)
  456. #define ZONE_OEM DEBUGZONE(9)
  457. #define ZONE_HCF DEBUGZONE(10)
  458. #define ZONE_PORTIO DEBUGZONE(11)
  459. #define ZONE_LOGTOFILE DEBUGZONE(15)
  460. #else // !(_WIN32_WCE)
  461. #define OUTPUTDEBUGMSG(dprintf_exp) ((void) (DbgPrint dprintf_exp))
  462. // the assertdebugmsg macro will print filename, line followed by a caller-defined text, when cond == 0
  463. #define ASSERTDEBUGMSG(cond, print) ((void)((cond) ? 0: (DbgPrint("%s %s:%d - ", print, __FILE__, __LINE__))))
  464. #define ZONE_ERROR 1
  465. #define ZONE_WARN 1
  466. #define ZONE_FUNCTION 1
  467. #define ZONE_INIT 1
  468. #define ZONE_INTR 1
  469. #define ZONE_RCV 1
  470. #define ZONE_XMIT 1
  471. #define ZONE_ASSERT 1
  472. #define ZONE_DEBUG 1
  473. #define ZONE_OEM 1
  474. #define ZONE_HCF 1
  475. #define ZONE_PORTIO 1
  476. #define ZONE_LOGTOFILE 1
  477. #endif // _WIN32_WCE
  478. #ifndef DBGA2W
  479. #define DBGA2W
  480. #endif // DBGA2W
  481. #else // !(defined DEBUG || defined _DEBUG || (defined DBG && DBG != 0) )
  482. #define OUTPUTDEBUGMSG(dprintf_exp)
  483. #define ASSERTDEBUGMSG(cond, dprintf_exp)
  484. #endif // DEBUG / DBG
  485. #if !defined HCF_MAX_MSG_CKIP_PADDING
  486. #define HCF_MAX_MSG_CKIP_PADDING 0
  487. #endif // HCF_MAX_MSG_CKIP_PADDING
  488. #if !defined HCF_MAX_MSG
  489. #define HCF_MAX_MSG 1514
  490. #endif // HCF_MAX_MSG
  491. #define HCF_LEGACY 1 //;?nv je moet wat
  492. #endif //WVLAN_41 / WVLAN_48 / WVLAN_52 / _WIN32_WCE
  493. /************************************************************************************************/
  494. /**************************** P A C K E T D R I V E R ***************************************/
  495. /********************************** D O S O D I *********************************************/
  496. /************************************************************************************************/
  497. #if defined WVLAN_42 || defined WVLAN_43
  498. #pragma warning ( disable: 4001 )
  499. #define FAR __far //segmented 16 bits mode
  500. #define BASED __based(__segname("_CODE")) //force all the "const" structures in the CODE segment
  501. //#define HCF_IO 0 //no DMA, no 32 bits
  502. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  503. #define HCF_EXT HCF_EXT_MB
  504. #define HCF_PROT_TIME 49 //49*10240 microseconds H/W failure protection timer
  505. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  506. /******************************** CONFIGURATION MANAGEMENT *****************************************/
  507. #ifdef WVLAN_42
  508. #define MSF_COMPONENT_ID COMP_ID_PACKET
  509. #define MSF_COMPONENT_VAR 1
  510. #define MSF_COMPONENT_MAJOR_VER 6
  511. #define MSF_COMPONENT_MINOR_VER 12
  512. #endif // WVLAN_42
  513. #ifdef WVLAN_43
  514. #define MSF_COMPONENT_ID COMP_ID_ODI_16
  515. #define MSF_COMPONENT_VAR 1
  516. #define MSF_COMPONENT_MAJOR_VER 6
  517. #define MSF_COMPONENT_MINOR_VER 10
  518. #endif // WVLAN_43
  519. /************************************** INPUT / OUTPUT **********************************************/
  520. #ifndef H_2_INC
  521. #include <stdio.h>
  522. #include <conio.h>
  523. #if 1 //temorary use functions defined in hcf.c
  524. #ifndef _DEBUG
  525. #pragma intrinsic( _inp, _inpw, _outp, _outpw )
  526. #endif // _DEBUG
  527. #define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) ))
  528. #define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value ))
  529. #if 1 // C implementation which let the processor handle the word-at-byte-boundary problem
  530. #define IN_PORT_STRING_8_16( port, addr, n) while (n--) \
  531. { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_8 FAR*)addr)+=2; }
  532. #define OUT_PORT_STRING_8_16( port, addr, n) while (n--) \
  533. { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; ((hcf_8 FAR*)addr)+=2; }
  534. #elif 0 // C implementation which handles the word-at-byte-boundary problem
  535. #define IN_PORT_STRING_8_16( port, addr, n) while ( n-- ) \
  536. { hcf_16 i = IN_PORT_WORD(port); *((hcf_8 FAR*)addr)++ = (hcf_8)i; *((hcf_8 FAR*)addr)++ = (hcf_8)(i>>8);}
  537. #define OUT_PORT_STRING_8_16( port, addr, n) while ( n-- ) \
  538. { OUT_PORT_WORD( port, *((hcf_8 FAR*)addr) | *(((hcf_8 FAR*)addr)+1)<<8 ); (hcf_8 FAR*)addr+=2; }
  539. #else // Assembler implementation
  540. #define IN_PORT_STRING_8_16( port, addr, n) __asm \
  541. { \
  542. __asm push di \
  543. __asm push es \
  544. __asm mov cx,n \
  545. __asm les di,addr \
  546. __asm mov dx,port \
  547. __asm rep insw \
  548. __asm pop es \
  549. __asm pop di \
  550. }
  551. #define OUT_PORT_STRING_8_16( port, addr, n) __asm \
  552. { \
  553. __asm push si \
  554. __asm push ds \
  555. __asm mov cx,n \
  556. __asm lds si,addr \
  557. __asm mov dx,port \
  558. __asm rep outsw \
  559. __asm pop ds \
  560. __asm pop si \
  561. }
  562. #endif // Asm or C implementation
  563. #define IN_PORT_STRING_32( port, addr, n) { int n2 = 2*n; IN_PORT_STRING_8_16(port, addr, n2) }
  564. #define OUT_PORT_STRING_32( port, addr, n) { int n2 = 2*n; OUT_PORT_STRING_8_16(port, addr, n2) }
  565. #endif // 0 //temorary use functions defined in hcf.c
  566. #endif // H_2_INC
  567. #endif // WVLAN_42 / WVLAN_43
  568. /************************************************************************************************/
  569. /**************************** D O S H - I / II L O A D E R **********************************/
  570. /************************************************************************************************/
  571. #if defined H0_LDR || defined H1_LDR || defined H2_LDR || defined H5_LDR
  572. #if defined H0_LDR //implies H-I
  573. #define HCF_DLV 0 //H-I legacy, meaningless under H-II
  574. #define HCF_DLNV 1 //H-I legacy, meaningless under H-II
  575. #endif // H0_LDR
  576. #if defined H1_LDR //implies H-I
  577. #define HCF_DLV 1 //H-I legacy, meaningless under H-II
  578. #define HCF_DLNV 0 //H-I legacy, meaningless under H-II
  579. #endif // H1_LDR / H2_LDR
  580. //#if defined H2_LDR : not needed, H-II defaults are O.K for H2_LDR
  581. #ifdef H5_LDR
  582. #define HCF_TYPE (HCF_TYPE_HII5 | HCF_TYPE_WARP )
  583. //;? why does only this subset of the H_LDRs need HCF_TYPE to be defined here
  584. #endif
  585. #define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN //support dynamic linking of msf_assert routine
  586. #define HCF_ENCAP 0
  587. #define HCF_INT_ON 0
  588. #define HCF_TALLIES 0
  589. #define MSF_COMPONENT_ID COMP_ID_ODI_16 //;?By lack of any better
  590. #define MSF_COMPONENT_VAR 1
  591. #define MSF_COMPONENT_MAJOR_VER 0
  592. #define MSF_COMPONENT_MINOR_VER 0
  593. #include <stdio.h>
  594. #include <conio.h>
  595. #if defined NDEBUG
  596. #pragma intrinsic( _inp, _inpw, _outp, _outpw )
  597. #endif // NDEBUG
  598. #if 0 //use 0 to replace I/O Macros with logging facility
  599. #define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) ))
  600. #define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value ))
  601. #define IN_PORT_STRING_16( port, addr, n) \
  602. while ( n-- ) { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
  603. #define OUT_PORT_STRING_16( port, addr, n) \
  604. while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; (cast)addr += 2; }
  605. #endif //use 0 to replace I/O Macros with logging facility
  606. #endif // H0_LDR / H1_LDR / H2_LDR
  607. /************************************************************************************************/
  608. /**************************** H C F D E M O P R O G R A M ***********************************/
  609. /************************************************************************************************/
  610. #if defined HCF_DEMO
  611. #define HCF_DLV 1 //;?should become the default !defaults to 1 anyway for H-II
  612. //#define HCF_DLNV 0 //defaults to 0 anyway for H-II
  613. #define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN //support dynamic linking of msf_assert routine
  614. #define HCF_ENCAP 0
  615. #define HCF_INT_ON 0
  616. #define HCF_TALLIES ( HCF_TALLIES_NIC | HCF_TALLIES_HCF )
  617. //#define MSF_COMPONENT_ID NO configuration management
  618. #include <stdio.h>
  619. #include <conio.h>
  620. #if defined NDEBUG
  621. #pragma intrinsic( _inp, _inpw, _outp, _outpw )
  622. #endif // NDEBUG
  623. #if 0 //use 0 to replace I/O Macros with logging facility
  624. #define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) ))
  625. #define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value ))
  626. #define IN_PORT_STRING_16( port, addr, n) \
  627. while ( n-- ) { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
  628. #define OUT_PORT_STRING_16( port, addr, n) \
  629. while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; (cast)addr += 2; }
  630. #endif //use 0 to replace I/O Macros with logging facility
  631. #endif // HCF_DEMO
  632. /************************************************************************************************/
  633. /*********************************** M A C O S **********************************************/
  634. /************************************************************************************************/
  635. #if defined WVLAN_45
  636. #include "Version.h"
  637. #define MSF_COMPONENT_ID COMP_ID_MAC_OS
  638. #define MSF_COMPONENT_VAR VARIANT
  639. #define MSF_COMPONENT_MAJOR_VER VERSION_MAJOR
  640. #define MSF_COMPONENT_MINOR_VER VERSION_MINOR
  641. #define MAC_OS 1
  642. #define HCF_BIG_ENDIAN 1 // selects Big Endian (a.k.a. Motorola), most significant byte first
  643. #if defined DEBUG
  644. #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox
  645. #endif // DEBUG
  646. #ifdef __cplusplus
  647. extern "C" {
  648. #endif // __cplusplus
  649. extern volatile unsigned char *MacIOaddr;
  650. extern hcf_16 IN_PORT_WORD(hcf_16 port);
  651. extern void OUT_PORT_WORD(hcf_16 port, hcf_16 value);
  652. extern void IN_PORT_STRING_16(hcf_16 port, void *addr, hcf_16 len);
  653. extern void OUT_PORT_STRING_16(hcf_16 port, void *addr, hcf_16 len);
  654. #define SwapBytes(t) (((t) >> 8) + (((t) & 0xff) << 8))
  655. #ifdef __cplusplus
  656. }
  657. #endif // __cplusplus
  658. #endif // WVLAN_45
  659. /************************************************************************************************/
  660. /****************************************** L I N U X *****************************************/
  661. /************************************************************************************************/
  662. #ifdef WVLAN_49
  663. #include <asm/io.h>
  664. //#include <linux/module.h>
  665. #include <wl_version.h>
  666. /* The following macro ensures that no symbols are exported, minimizing the chance of a symbol
  667. collision in the kernel */
  668. //EXPORT_NO_SYMBOLS; //;?this place seems not appropriately to me
  669. //#define HCF_SLEEP (HCF_CDS | HCF_DDS )
  670. #define HCF_SLEEP (HCF_CDS)
  671. //#define HCF_TYPE (HCF_TYPE_HII5|HCF_TYPE_STA|HCF_TYPE_AP)
  672. #ifdef HERMES25
  673. #ifdef WARP
  674. #define HCF_TYPE ( HCF_TYPE_WARP | HCF_TYPE_HII5 )
  675. #else
  676. #define HCF_TYPE HCF_TYPE_HII5
  677. #endif // WARP
  678. #else
  679. #define HCF_TYPE HCF_TYPE_NONE
  680. #endif // HERMES25
  681. #ifdef ENABLE_DMA
  682. #define HCF_DMA 1
  683. #endif // ENABLE_DMA
  684. /* We now need a switch to include support for the Mailbox and other necessary extensions */
  685. #define HCF_EXT ( HCF_EXT_MB | HCF_EXT_INFO_LOG | HCF_EXT_INT_TICK )//get deepsleep exercise going
  686. /* ;? The Linux MSF still uses these definitions; define it here until it's removed */
  687. #ifndef HCF_TYPE_HII
  688. #define HCF_TYPE_HII 0x0004
  689. #endif
  690. #ifndef HCF_TYPE_AP
  691. #define HCF_TYPE_AP 0x0010
  692. #endif
  693. #ifndef HCF_TYPE_STA
  694. #define HCF_TYPE_STA 0x0020
  695. #endif // HCF_TYPE_STA
  696. /* Guarantees word alignment */
  697. #define HCF_ALIGN 2
  698. /* Endian macros CNV_INT_TO_LITTLE() and CNV_LITTLE_TO_INT() were renamed to
  699. CNV_SHORT_TO_LITTLE() and CNV_LITTLE_TO_SHORT() */
  700. #ifndef CNV_INT_TO_LITTLE
  701. #define CNV_INT_TO_LITTLE CNV_SHORT_TO_LITTLE
  702. #endif
  703. #ifndef CNV_LITTLE_TO_INT
  704. #define CNV_LITTLE_TO_INT CNV_LITTLE_TO_SHORT
  705. #endif
  706. #define HCF_ERR_BUSY 0x06
  707. /* UIL defines were removed from the HCF */
  708. #define UIL_SUCCESS HCF_SUCCESS
  709. #define UIL_ERR_TIME_OUT HCF_ERR_TIME_OUT
  710. #define UIL_ERR_NO_NIC HCF_ERR_NO_NIC
  711. #define UIL_ERR_LEN HCF_ERR_LEN
  712. #define UIL_ERR_MIN HCF_ERR_MAX /*end of HCF errors which are passed through to UIL
  713. *** ** *** ****** ***** *** ****** ******* ** *** */
  714. #define UIL_ERR_IN_USE 0x44
  715. #define UIL_ERR_WRONG_IFB 0x46
  716. #define UIL_ERR_MAX 0x7F /*upper boundary of UIL errors without HCF-pendant
  717. ***** ******** ** *** ****** ******* *** ******* */
  718. #define UIL_ERR_BUSY HCF_ERR_BUSY
  719. #define UIL_ERR_DIAG_1 HCF_ERR_DIAG_1
  720. #define UIL_FAILURE 0xFF /* 20010705 nv this relick should be eridicated */
  721. #define UIL_ERR_PIF_CONFLICT 0x40 //obsolete
  722. #define UIL_ERR_INCOMP_DRV 0x41 //obsolete
  723. #define UIL_ERR_DOS_CALL 0x43 //obsolete
  724. #define UIL_ERR_NO_DRV 0x42 //obsolete
  725. #define UIL_ERR_NSTL 0x45 //obsolete
  726. #if 0 //;? #ifdef get this going LATER HERMES25
  727. #define HCF_IO HCF_IO_32BITS
  728. #define HCF_DMA 1
  729. #define HCF_DESC_STRCT_EXT 4
  730. /* Switch for BusMaster DMA support. Note that the above define includes the DMA-specific HCF
  731. code in the build. This define sets the MSF to use DMA; if ENABLE_DMA is not defined, then
  732. port I/O will be used in the build */
  733. #ifndef BUS_PCMCIA
  734. #define ENABLE_DMA
  735. #endif // USE_PCMCIA
  736. #endif // HERMES25
  737. /* Overrule standard WaveLAN Packet Size when in DMA mode */
  738. #ifdef ENABLE_DMA
  739. #define HCF_MAX_PACKET_SIZE 2304
  740. #else
  741. #define HCF_MAX_PACKET_SIZE 1514
  742. #endif // ENABLE_DMA
  743. /* The following sets the component ID, as well as the versioning. See also wl_version.h */
  744. #define MSF_COMPONENT_ID COMP_ID_LINUX
  745. #define MSF_COMPONENT_VAR DRV_VARIANT
  746. #define MSF_COMPONENT_MAJOR_VER DRV_MAJOR_VERSION
  747. #define MSF_COMPONENT_MINOR_VER DRV_MINOR_VERSION
  748. /* Define the following to turn on assertions in the HCF */
  749. //#define HCF_ASSERT 0x8000
  750. #define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN // statically binding of msf_assert routine
  751. #ifdef USE_BIG_ENDIAN
  752. #define HCF_BIG_ENDIAN 1
  753. #else
  754. #define HCF_BIG_ENDIAN 0
  755. #endif /* USE_BIG_ENDIAN */
  756. /* Define the following if your system uses memory-mapped IO */
  757. //#define HCF_MEM_IO
  758. /* The following defines the standard macros required by the HCF to move data to/from the card */
  759. #define IN_PORT_BYTE(port) ((hcf_8)inb( (hcf_io)(port) ))
  760. #define IN_PORT_WORD(port) ((hcf_16)inw( (hcf_io)(port) ))
  761. #define OUT_PORT_BYTE(port, value) (outb( (hcf_8) (value), (hcf_io)(port) ))
  762. #define OUT_PORT_WORD(port, value) (outw((hcf_16) (value), (hcf_io)(port) ))
  763. #define IN_PORT_STRING_16(port, dst, n) insw((hcf_io)(port), dst, n)
  764. #define OUT_PORT_STRING_16(port, src, n) outsw((hcf_io)(port), src, n)
  765. //#define IN_PORT_STRINGL(port, dst, n) insl((port), (dst), (n))
  766. //#define OUT_PORT_STRINGL(port, src, n) outsl((port), (src), (n))
  767. #define IN_PORT_STRING_32(port, dst, n) insl((port), (dst), (n))
  768. #define OUT_PORT_STRING_32(port, src, n) outsl((port), (src), (n))
  769. #define IN_PORT_HCF32(port) inl( (hcf_io)(port) )
  770. #define OUT_PORT_HCF32(port, value) outl((hcf_32)(value), (hcf_io)(port) )
  771. #define IN_PORT_DWORD(port) IN_PORT_HCF32(port)
  772. #define OUT_PORT_DWORD(port, value) OUT_PORT_HCF32(port, value)
  773. #define IN_PORT_STRING_8_16(port, addr, len) IN_PORT_STRING_16(port, addr, len)
  774. #define OUT_PORT_STRING_8_16(port, addr, len) OUT_PORT_STRING_16(port, addr, len)
  775. #ifndef OUTPUTDEBUGMSG
  776. #define OUTPUTDEBUGMSG(dprintf_exp)
  777. #endif
  778. #ifndef ASSERTDEBUGMSG
  779. #define ASSERTDEBUGMSG(cond, dprintf_exp)
  780. #endif
  781. #ifndef CFG_SCAN_CHANNELS_2GHZ
  782. #define CFG_SCAN_CHANNELS_2GHZ 0xFCC2
  783. #endif /* CFG_SCAN_CHANNELS_2GHZ */
  784. #define HCF_MAX_MSG 1600 //get going ;?
  785. #endif // WVLAN_49
  786. /************************************************************************************************/
  787. /********************************************* Q N X ******************************************/
  788. /************************************************************************************************/
  789. #if defined __QNX__ || defined WVLAN_50
  790. #define MSF_COMPONENT_ID 0 //Although there is no DUI support, we need this to get ...
  791. #define MSF_COMPONENT_VAR 0 //...compatibilty check to function
  792. #define MSF_COMPONENT_MAJOR_VER 0 //...;?this is worth looking into to make this a more
  793. #define MSF_COMPONENT_MINOR_VER 0 //..."defined" I/F so OEMers can figure out what to do
  794. #include <conio.h>
  795. #define IN_PORT_WORD(port) ((hcf_16)inpw( (hcf_io)(port) ))
  796. #define OUT_PORT_WORD(port, value) (outpw( (hcf_io)(port), (hcf_16) (value) ))
  797. /*
  798. #define IN_PORT_STRING_16( port, addr, n) \
  799. while ( n-- ) { *(hcf_16*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
  800. #define OUT_PORT_STRING_16( port, addr, n) \
  801. while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16*)addr ) ; (cast)addr += 2; }
  802. */
  803. #endif // QNX / WVLAN_50
  804. /************************************************************************************************/
  805. /********************************************* B E O S ****************************************/
  806. /************************************************************************************************/
  807. #if defined __BEOS__
  808. #define MSF_COMPONENT_ID 0 //Although there is no DUI support, we need this to get ...
  809. #define MSF_COMPONENT_VAR 0 //...compatibilty check to function
  810. #define MSF_COMPONENT_MAJOR_VER 0 //...;?this is worth looking into to make this a more
  811. #define MSF_COMPONENT_MINOR_VER 0 //..."defined" I/F so OEMers can figure out what to do
  812. #include <drivers/Drivers.h>
  813. #include <drivers/KernelExport.h>
  814. uint8 read_io_8 (int);
  815. void write_io_8 (int, uint8);
  816. uint16 read_io_16 (int);
  817. void write_io_16 (int, uint16);
  818. #define IN_PORT_WORD(port) ((hcf_16)read_io_16( (hcf_io)(port) ))
  819. #define OUT_PORT_WORD(port, value) (write_io_16( (hcf_io)(port), (hcf_16) (value) ))
  820. /*
  821. #define IN_PORT_STRING_16( port, addr, n) \
  822. while ( n-- ) { *(hcf_16*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
  823. #define OUT_PORT_STRING_16( port, addr, n) \
  824. while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16*)addr ) ; (cast)addr += 2; }
  825. */
  826. #endif // __BEOS__
  827. /************************************************************************************************/
  828. /******************************** U S B D O N G L E *****************************************/
  829. /************************************************************************************************/
  830. #if defined USB
  831. #include "gpif.h"
  832. #define MSF_COMPONENT_MAJOR_VER 0
  833. #define MSF_COMPONENT_MINOR_VER 1
  834. #define IN_PORT_WORD(port) (Hermes_IO_Read( (hcf_8)(port)))
  835. #define OUT_PORT_WORD(port, value) (Hermes_IO_Write( (hcf_8)port, /*(hcf_16)*/(value) ) )
  836. /* !!!! NOTE USB supports only 16-bits I/O and no 8-bits I/O
  837. * as a consequence the IN_/OUT_PORT_STRING_16 macros use hcf_16* rather than hcf_8 pointers
  838. * to get more optimal code
  839. * therefore the pointers are incremented by 1 (which means two "bytes") rather than by 2
  840. */
  841. //#define IN_PORT_STRING_16( port, addr, n) while ( n-- ) { *((hcf_16*)addr)++ = IN_PORT_WORD( port ); }
  842. //#define OUT_PORT_STRING_16( port, addr, n) while ( n-- ) { OUT_PORT_WORD( port, *((hcf_16*)addr)++ ); }
  843. #define IN_PORT_STRING_16( port, dst, n) while ( n-- ) { *dst++ = IN_PORT_WORD( port ); }
  844. #define OUT_PORT_STRING_16( port, src, n) while ( n-- ) { OUT_PORT_WORD( port, *src++ ); }
  845. //#define HCF_TYPE ( HCF_TYPE_AP | HCF_TYPE_WPA )
  846. #define HCF_TYPE HCF_TYPE_WPA
  847. #endif // USB
  848. /************************************************************************************************/
  849. /****************************************** FreeBSD *******************************************/
  850. /************************************************************************************************/
  851. #if defined __FREE_BSD__
  852. #define MSF_COMPONENT_ID COMP_ID_FreeBSD
  853. #define MSF_COMPONENT_VAR 1
  854. #define MSF_COMPONENT_MAJOR_VER 1
  855. #define MSF_COMPONENT_MINOR_VER 0
  856. #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
  857. #include <machine/cpufunc.h>
  858. #define IN_PORT_WORD(port) ((hcf_16)inw( (hcf_io)(port) ))
  859. #define OUT_PORT_WORD(port, value) (outw((hcf_io)(port), (hcf_16)(value)))
  860. /*
  861. #define IN_PORT_STRING_16( port, addr, n) \
  862. while ( n-- ) { *(hcf_16*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
  863. #define OUT_PORT_STRING_16( port, addr, n) \
  864. while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16*)addr ) ; (cast)addr += 2; }
  865. */
  866. #endif // __FREE_BSD__
  867. /************************************************************************************************/
  868. /********************************* W A V E P O I N T ******************************************/
  869. /************************************************************************************************/
  870. #if defined WVLAN_81 /* BORLANDC */
  871. #define EXTERN_C extern // needed because DHF uses this instead of 'extern'
  872. #define MSF_COMPONENT_ID COMP_ID_AP1
  873. #define MSF_COMPONENT_VAR 1
  874. #define MSF_COMPONENT_MAJOR_VER 4
  875. #define MSF_COMPONENT_MINOR_VER 0
  876. #define HCF_PROT_TIME 49 //49*10240 microseconds H/W failure protection timer
  877. //#define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox /* debug build only */
  878. #if !defined FAR
  879. #define FAR far // segmented 16 bits mode
  880. #endif // FAR
  881. #define IN_PORT_WORD(port) (inport( (hcf_io)(port) ))
  882. #define OUT_PORT_WORD(port, value) (outport( (hcf_io)(port), value ))
  883. #define IN_PORT_STRING_16(port, addr, len) \
  884. asm { push di; push es; mov cx,len; les di,addr; mov dx,port; rep insw; pop es; pop di }
  885. #define OUT_PORT_STRING_16(port, addr, len) \
  886. asm { push si; push ds; mov cx,len; lds si,addr; mov dx,port; rep outsw; pop ds; pop si }
  887. #endif // WVLAN_81
  888. /************************************************************************************************/
  889. /******************************** W A V E L A U N C H *****************************************/
  890. /************************************************************************************************/
  891. #if defined WVLAUNCH
  892. #include "DriverX.h"
  893. extern HWDEVICE* g_pDevice;
  894. //#define MSF_COMPONENT_ID 0 //;? to get around browser problem
  895. #define IN_PORT_WORD(port) HwInpw( g_pDevice, port )
  896. #define OUT_PORT_WORD(port, value) HwOutpw( g_pDevice, port, value )
  897. // C implementation which let the processor handle the word-at-byte-boundary problem
  898. /*
  899. #define IN_PORT_STRING_16( port, addr, n) \
  900. while ( n-- ) { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
  901. #define OUT_PORT_STRING_16( port, addr, n) \
  902. while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; (cast)addr += 2; }
  903. */
  904. #endif // WVLAUNCH
  905. /************************************************************************************************/
  906. /************************************* W C I T S T *********************************************/
  907. /************************************************************************************************/
  908. #if defined WCITST
  909. #define MSF_COMPONENT_ID 0 //Although there is no DUI support, we need this to get ...
  910. #define MSF_COMPONENT_VAR 0 //...compatibilty check to function
  911. #define MSF_COMPONENT_MAJOR_VER 0 //...;?this is worth looking into to make this a more
  912. #define MSF_COMPONENT_MINOR_VER 0 //..."defined" I/F so OEMers can figure out what to do
  913. //#define HCF_ENCAP HCF_ENC_NONE //to get going
  914. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  915. #define HCF_TYPE (HCF_TYPE_WPA | HCF_TYPE_PRELOADED) // Hermes-I for HCF6, II for HCF7
  916. #define HCF_DMA 1
  917. //#define LLB //!!!!MIC Debug Only
  918. #if defined LLB && !((HCF_TYPE) & HCF_TYPE_WPA)
  919. err: no LLB unless SSN;
  920. #endif // LLB / HCF_TYPE_WPA
  921. //#define HCF_ALIGN 2
  922. #define HCF_DLV 1 //just to change memory layout ????;?
  923. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  924. #define HCF_ASSERT HCF_ASSERT_SW_SUP // logging via Hermes support registerr
  925. //#define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox
  926. #if defined __GNUC__
  927. #include "stdio.h"
  928. //#include "unistd.h" //ioperm libc5
  929. #include "sys/io.h" //ioperm glibc
  930. #define extern //see IO Port Programming mini-HOWTO
  931. //#include "asm/io.h" //
  932. #define IN_PORT_WORD(port) inw( (hcf_io)(port) )
  933. #define IN_PORT_DWORD(port) inl( (hcf_io)(port) )
  934. #define OUT_PORT_WORD(port, value) outw( (hcf_io)(port), (hcf_16)(value) )
  935. #define OUT_PORT_DWORD(port, value) outl( (hcf_io)(port), (hcf_16)(value) )
  936. #else
  937. #pragma warning ( disable: 4001 )
  938. #define FAR __far // segmented 16 bits mode
  939. #include <stdio.h>
  940. #include <conio.h>
  941. #ifndef _DEBUG
  942. #pragma intrinsic( _inp, _inpw, _outp, _outpw )
  943. #endif // _DEBUG
  944. #ifdef LOG
  945. extern FILE* utm_logfile;
  946. hcf_16 ipw( hcf_16 port );
  947. hcf_8 ipb( hcf_16 port );
  948. void opw( hcf_16 port, hcf_16 value );
  949. void opb( hcf_16 port, hcf_8 value );
  950. #define IN_PORT_WORD(port) ipw( (hcf_io)(port) )
  951. #define OUT_PORT_WORD(port, value) opw( (hcf_io)(port), (hcf_16)(value) )
  952. #else // LOG
  953. #define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) ))
  954. #define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value ))
  955. #endif // LOG
  956. #if 1 //ASM example
  957. #define IN_PORT_STRING_16( port, addr, len) __asm \
  958. { \
  959. __asm push di \
  960. __asm push es \
  961. __asm mov cx,len \
  962. __asm les di,addr \
  963. __asm mov dx,port \
  964. __asm rep insw \
  965. __asm pop es \
  966. __asm pop di \
  967. }
  968. #define OUT_PORT_STRING_16( port, addr, len) __asm \
  969. { \
  970. __asm push si \
  971. __asm push ds \
  972. __asm mov cx,len \
  973. __asm lds si,addr \
  974. __asm mov dx,port \
  975. __asm rep outsw \
  976. __asm pop ds \
  977. __asm pop si \
  978. }
  979. #endif // asm example
  980. #endif // __GCC__
  981. #if ! defined IN_PORT_STRING_16
  982. #define IN_PORT_STRING_16( port, addr, n) while (n--) \
  983. { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_16 FAR*)addr)++; }
  984. #define OUT_PORT_STRING_16( port, addr, n) while (n--) \
  985. { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ); ((hcf_16 FAR*)addr)++; }
  986. #endif // IN_PORT_STRING_16
  987. #endif // WCITST
  988. /************************************************************************************************/
  989. /******************************* Motorola Power PC 800 family *********************************/
  990. /************************************************************************************************/
  991. /* known users: LH@I
  992. */
  993. #if defined I_MPC8XX
  994. #define MSF_COMPONENT_VAR 0
  995. #define MSF_COMPONENT_ID 0
  996. #define MSF_COMPONENT_MAJOR_VER 1
  997. #define MSF_COMPONENT_MINOR_VER 0
  998. #define HCF_HSI_VAR 1
  999. #define HCF_BIG_ENDIAN 1
  1000. #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
  1001. #include "o_portbl.h"
  1002. #include "ipcmcia.h"
  1003. typedef o_uint8_t hcf_8;
  1004. typedef o_uint16_t hcf_16;
  1005. typedef o_uint32_t hcf_32;
  1006. /***************************************************************************/
  1007. #ifdef _lint
  1008. #else
  1009. asm hcf_16 IN_PORT_WORD(int port)
  1010. {
  1011. % reg port
  1012. lhbrx r3,r0,port
  1013. eieio
  1014. }
  1015. #endif // _lint
  1016. #ifdef _lint
  1017. #else
  1018. asm void OUT_PORT_WORD(int port, hcf_16 value)
  1019. {
  1020. % reg port, value
  1021. sthbrx value,r0,port
  1022. eieio
  1023. }
  1024. #endif // _lint
  1025. /***************************************************************************/
  1026. #define IN_PORT_STRING_16(port, addr, len) \
  1027. { \
  1028. unsigned l = (len); \
  1029. hcf_16 *d = (volatile hcf_16 *)(addr); \
  1030. while (l--) \
  1031. { \
  1032. *d++ = *(volatile hcf_16 *)(port); \
  1033. EIEIO(); \
  1034. } \
  1035. }
  1036. #define OUT_PORT_STRING_16(port, addr, len) \
  1037. { \
  1038. unsigned l = (len); \
  1039. hcf_16 *s = (volatile hcf_16 *)(addr); \
  1040. while (l--) \
  1041. { \
  1042. *(volatile hcf_16 *)(port) = *s++; \
  1043. EIEIO(); \
  1044. } \
  1045. }
  1046. #endif // I_MPC8XX
  1047. /************************************************************************************************/
  1048. /********************************** Diab or High C 29K **************************************/
  1049. /************************************************************************************************/
  1050. /* known users: GK@C
  1051. */
  1052. #if defined _AM29K
  1053. #define MSF_COMPONENT_VAR 0
  1054. #define MSF_COMPONENT_ID COMP_ID_AP1
  1055. #define MSF_COMPONENT_MAJOR_VER 1
  1056. #define MSF_COMPONENT_MINOR_VER 0
  1057. #define HCF_BIG_ENDIAN 1
  1058. #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
  1059. #define SwapBytes(t) /*lint -e572*/(((t) >> 8) + (((t) & 0xff) << 8))/*lint +e572*/
  1060. #if defined __ppc
  1061. #ifndef __GNUC__
  1062. #define __asm__ asm
  1063. #endif
  1064. #if ! defined _lint
  1065. #define EIEIO() __asm__(" eieio")
  1066. #else
  1067. #define EIEIO()
  1068. #endif
  1069. static hcf_16 IN_PORT_WORD(int port) {
  1070. hcf_16 value = *(volatile hcf_16 *)(port); EIEIO();
  1071. value = SwapBytes(value);
  1072. return value;
  1073. }
  1074. #define OUT_PORT_WORD(port, value) \
  1075. { *(volatile hcf_16 *)(port) = SwapBytes(value); EIEIO(); }
  1076. #else
  1077. #define IN_PORT_WORD(port) (*(volatile hcf_16 *)(port))
  1078. #define OUT_PORT_WORD(port, value) (*(volatile hcf_16 *)(port) = (value))
  1079. #endif // __ppc
  1080. /***************************************************************************/
  1081. #define IN_PORT_STRING_16( port, addr, len) { \
  1082. unsigned l = (len); \
  1083. hcf_16 t, *d = (volatile hcf_16 *)(addr); \
  1084. while (l--) { \
  1085. t = IN_PORT_WORD(port); \
  1086. *d++ = SwapBytes(t); \
  1087. } \
  1088. }
  1089. #define OUT_PORT_STRING_16( port, addr, len) { \
  1090. unsigned l = (len); \
  1091. hcf_16 t, *s = (volatile hcf_16 *)(addr); \
  1092. while (l--) { \
  1093. t = *s++; \
  1094. OUT_PORT_WORD(port, SwapBytes(t)); \
  1095. } \
  1096. }
  1097. #if PRODUCT == 9150
  1098. #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox
  1099. #undef MSF_COMPONENT_ID
  1100. #endif // 9150
  1101. #endif // _AM29K
  1102. /************************************************************************************************/
  1103. /***************************************** MPC860 **********************************************/
  1104. /************************************************************************************************/
  1105. /* known users: RR
  1106. */
  1107. #if defined CPU
  1108. #if CPU == PPC860
  1109. #define MSF_COMPONENT_VAR 0
  1110. #define MSF_COMPONENT_ID 0
  1111. #define MSF_COMPONENT_MAJOR_VER 1
  1112. #define MSF_COMPONENT_MINOR_VER 0
  1113. #define HCF_BIG_ENDIAN 1
  1114. #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
  1115. #define SwapBytes(t) /*lint -e572*/(((t) >> 8) + (((t) & 0xff) << 8))/*lint +e572*/
  1116. #ifndef __GNUC__
  1117. #define __asm__ asm
  1118. #endif
  1119. #if ! defined _lint
  1120. #define EIEIO() __asm__(" eieio")
  1121. #else
  1122. #define EIEIO()
  1123. #endif
  1124. static hcf_16 IN_PORT_WORD(int port) {
  1125. hcf_16 value = *(volatile hcf_16 *)(port); EIEIO();
  1126. value = SwapBytes(value);
  1127. return value;
  1128. #ifdef __GNUC__
  1129. /* the following serves to avoid the compiler warnings that
  1130. * IN_PORT_WORD() is not used in some files */
  1131. (void)IN_PORT_WORD;
  1132. #endif
  1133. }
  1134. #define OUT_PORT_WORD(port, value) \
  1135. { *(volatile hcf_16 *)(port) = SwapBytes(value); EIEIO(); }
  1136. /***************************************************************************/
  1137. #define IN_PORT_STRING_16( port, addr, len) { \
  1138. unsigned l = (len); \
  1139. hcf_16 t; \
  1140. volatile hcf_16 *d = (volatile hcf_16 *)(addr); \
  1141. while (l--) { \
  1142. t = IN_PORT_WORD(port); \
  1143. *d++ = SwapBytes(t); \
  1144. } \
  1145. }
  1146. #define OUT_PORT_STRING_16( port, addr, len) { \
  1147. unsigned l = (len); \
  1148. hcf_16 t; \
  1149. volatile hcf_16 *s = (volatile hcf_16 *)(addr); \
  1150. while (l--) { \
  1151. t = *s++; \
  1152. OUT_PORT_WORD(port, SwapBytes(t)); \
  1153. } \
  1154. }
  1155. #if PRODUCT == 9150
  1156. #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox
  1157. #undef MSF_COMPONENT_ID
  1158. #endif
  1159. #endif /* PPC860 */
  1160. #endif /* CPU */
  1161. /************************************************************************************************/
  1162. /**************************** Microtec Research 80X86 Compiler *********************************/
  1163. /************************************************************************************************/
  1164. #if 0
  1165. //#undef HCF_TYPE // Hermes-I Station F/W without SSN support
  1166. #define MSF_COMPONENT_VAR 0
  1167. #define MSF_COMPONENT_ID 0
  1168. #define MSF_COMPONENT_MAJOR_VER 1
  1169. #define MSF_COMPONENT_MINOR_VER 0
  1170. extern int far inp( int );
  1171. extern void far outp( int, int );
  1172. extern int far inpw( int );
  1173. extern void far outpw( int, int );
  1174. #define IN_PORT_WORD(port) ((hcf_16)inpw( (hcf_io)(port) ))
  1175. #define OUT_PORT_WORD(port, value) ((void)outpw( (hcf_io)(port), value ))
  1176. #define IN_PORT_STRING_16( port, addr, len) { \
  1177. unsigned l = (len); \
  1178. hcf_16 *d = (hcf_16 *)(addr); \
  1179. while (l--) *d++ = IN_PORT_WORD(port); \
  1180. }
  1181. #define OUT_PORT_STRING_16( port, addr, len) { \
  1182. unsigned l = (len); \
  1183. hcf_16 *s = (hcf_16 *)(addr); \
  1184. while (l--) OUT_PORT_WORD(port, *s++); \
  1185. }
  1186. #endif /* Microtec 80X86 C Compiler */
  1187. /************************************************************************************************/
  1188. /****************************** W A V E L A N E C ********************************************/
  1189. /************************************************************************************************/
  1190. /* known users: KM
  1191. */
  1192. #ifdef mc68302
  1193. #define MSF_COMPONENT_ID COMP_ID_EC
  1194. #include <version.h>
  1195. #define MSF_COMPONENT_VAR 1
  1196. #define MSF_COMPONENT_MAJOR_VER MAJOR_VERSION
  1197. #define MSF_COMPONENT_MINOR_VER MINOR_VERSION
  1198. #define HCF_BIG_ENDIAN 1
  1199. #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
  1200. #define SwapBytes(t) /*lint -e572*/(((t) >> 8) + (((t) & 0xff) << 8))/*lint +e572*/
  1201. #define PCMCIA_ADDRESS 0xc80000UL
  1202. #define IN_PORT_2BYTES(port) (*(hcf_16 *)(port))
  1203. #if 0
  1204. static hcf_16 IN_PORT_WORD(hcf_32 port) // should be hcf_io, not hcf_32
  1205. {
  1206. hcf_16 word = IN_PORT_2BYTES(port);
  1207. return SwapBytes(word);
  1208. }
  1209. #else
  1210. static hcf_16 swap_var;
  1211. #define IN_PORT_WORD(port) \
  1212. (((swap_var = IN_PORT_2BYTES(port)) >> 8) + (((swap_var) & 0xff) << 8))
  1213. #endif
  1214. #define OUT_PORT_2BYTES(port, value) (*(hcf_16 *)(port) = (hcf_16)(value))
  1215. #define OUT_PORT_WORD(port, value) OUT_PORT_2BYTES(port, SwapBytes(value))
  1216. /*
  1217. #define IN_PORT_STRING_16(port, addr, len) \
  1218. while ((len)--) {*(hcf_16 *)(addr) = IN_PORT_2BYTES(port); ((cast)addr) += 2; }
  1219. #define OUT_PORT_STRING_16(port, addr, len) \
  1220. while ((len)--) {OUT_PORT_2BYTES((port), *(hcf_16 *)(addr)) ; ((cast)addr) += 2; }
  1221. */
  1222. #endif /* mc68302 */
  1223. /************************************************************************************************/
  1224. /********************************* NGAP ***************************************/
  1225. /************************************************************************************************/
  1226. #if defined __VX_WORKS__ /* VxWorks */
  1227. #if defined WLC_STATION
  1228. //#undef HCF_TYPE /* Hermes-I Station F/W without SSN support */
  1229. #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA
  1230. #else
  1231. #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP
  1232. #endif // WLC_STATION
  1233. #define HCF_YIELD (taskDelay(0) == 0)
  1234. #define MSF_COMPONENT_VAR 1
  1235. #define MSF_COMPONENT_MAJOR_VER 1
  1236. #define MSF_COMPONENT_MINOR_VER 0
  1237. // #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox
  1238. #if defined PC486BSP
  1239. #define IN_PORT_WORD(port) (sysInWord ((hcf_io)(port)))
  1240. #define OUT_PORT_WORD(port, value) (sysOutWord ((hcf_io)(port), (hcf_16) (value)))
  1241. #define IN_PORT_STRING_16(port, addr, n) (sysInWordString ((hcf_io)(port), addr, n))
  1242. #define OUT_PORT_STRING_16(port, addr, n) (sysOutWordString ((hcf_io)(port), addr, n))
  1243. #elif defined AS2000BSP
  1244. #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
  1245. /* Define PCI stuff here. */
  1246. unsigned short sysRead16( unsigned short *port );
  1247. void sysWrite16( unsigned short *port, unsigned short value );
  1248. #define PCI_IN_BYTE( port ) \
  1249. *(unsigned char *)( port )
  1250. #define PCI_IN_WORD( port ) \
  1251. sysRead16( (unsigned short *)( port ) )
  1252. #define PCI_OUT_BYTE( port, value ) \
  1253. *(unsigned char *)( port ) = (unsigned char)( value )
  1254. #define PCI_OUT_WORD( port, value ) \
  1255. sysWrite16( (unsigned short *)( port ), (unsigned short)( value ) )
  1256. #define IN_PORT_WORD( port ) \
  1257. PCI_IN_WORD( port )
  1258. #define OUT_PORT_WORD( port, value ) \
  1259. PCI_OUT_WORD( port, value )
  1260. #define IN_PORT_STRING_16( port, buf, len ) \
  1261. do { \
  1262. hcf_16 *p; \
  1263. \
  1264. for ( p = (hcf_16 *)(buf); p < &( (hcf_16 *)(buf) )[ (int)len ]; p++ ) { \
  1265. *p = PCI_IN_WORD( port ); \
  1266. } \
  1267. } while ( 0 )
  1268. #define OUT_PORT_STRING_16( port, buf, len ) \
  1269. do { \
  1270. const hcf_16 *p; \
  1271. \
  1272. for ( p = (const hcf_16 *)( buf ); p < &( (const hcf_16 *)(buf) )[ (int)len ]; p++ ) { \
  1273. PCI_OUT_WORD( port, *p ); \
  1274. } \
  1275. } while ( 0 )
  1276. #elif defined FADS860BSP /* elif defined AS2000BSP */
  1277. #define HCF_BIG_ENDIAN 1
  1278. #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
  1279. #ifndef __GNUC__
  1280. #define __asm__ asm
  1281. #endif
  1282. #if ! defined _lint
  1283. #define EIEIO() __asm__(" eieio")
  1284. #else
  1285. #define EIEIO()
  1286. #endif
  1287. static hcf_16 IN_PORT_WORD(int port) {
  1288. hcf_16 value = *(volatile hcf_16 *)(port); EIEIO();
  1289. value = ((value & 0xff00) >> 8) + ((value & 0x00ff) << 8);
  1290. /* value = CNV_LITTLE_TO_SHORT(value); */
  1291. return value;
  1292. #ifdef __GNUC__
  1293. /* the following serves to avoid the compiler warnings that
  1294. * IN_PORT_WORD() is not used in some files */
  1295. (void)IN_PORT_WORD;
  1296. #endif
  1297. }
  1298. #define OUT_PORT_WORD(port, value) \
  1299. { *(volatile hcf_16 *)(port) = CNV_SHORT_TO_LITTLE(value); EIEIO(); }
  1300. /***********************************************************************/
  1301. #define IN_PORT_STRING_16( port, addr, len) { \
  1302. unsigned l = (len); \
  1303. volatile hcf_16 *d = (volatile hcf_16 *)(addr); \
  1304. while (l--) { \
  1305. *d++ = *(volatile hcf_16 *)(port); \
  1306. EIEIO(); \
  1307. } \
  1308. }
  1309. #define OUT_PORT_STRING_16( port, addr, len) { \
  1310. unsigned l = (len); \
  1311. volatile hcf_16 *s = (volatile hcf_16 *)(addr); \
  1312. while (l--) { \
  1313. *(volatile hcf_16 *)(port) = *s++; \
  1314. EIEIO(); \
  1315. } \
  1316. }
  1317. #elif defined DAYTONABSP
  1318. #define HCF_BIG_ENDIAN 1
  1319. #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
  1320. #ifndef __GNUC__
  1321. #define __asm__ asm
  1322. #endif
  1323. #define IN_PORT_WORD(port) (sysOrinocoInWord((unsigned long)(port)))
  1324. #define OUT_PORT_WORD(port,value) (sysOrinocoOutWord((unsigned long)(port), (unsigned short)(value)))
  1325. #define IN_PORT_STRING_16(port,addr,len) (sysOrinocoInString((port), (addr), (len)))
  1326. #define OUT_PORT_STRING_16(port,addr,len) (sysOrinocoOutString((port), (addr), (len)))
  1327. extern unsigned char sysOrinocoInByte (unsigned long port);
  1328. extern unsigned short sysOrinocoInWord (unsigned long port);
  1329. extern void sysOrinocoInString (unsigned long port, void *addr, unsigned short len);
  1330. extern void sysOrinocoOutByte (unsigned long port, unsigned char value);
  1331. extern void sysOrinocoOutWord (unsigned long port, unsigned short value);
  1332. extern void sysOrinocoOutString (unsigned long port, void *addr, unsigned short len);
  1333. #elif defined ALPHA_BSP
  1334. #define HCF_BIG_ENDIAN 1
  1335. #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
  1336. #ifndef __GNUC__
  1337. #define __asm__ asm
  1338. #endif
  1339. #define IN_PORT_WORD(port) (sysOrinocoInWord((unsigned long)(port)))
  1340. #define OUT_PORT_WORD(port,value) (sysOrinocoOutWord((unsigned long)(port), (unsigned short)(value)))
  1341. #define IN_PORT_STRING_16(port,addr,len) (sysOrinocoInString((port), (addr), (len)))
  1342. #define OUT_PORT_STRING_16(port,addr,len) (sysOrinocoOutString((port), (addr), (len)))
  1343. extern unsigned char sysOrinocoInByte (unsigned long port);
  1344. extern unsigned short sysOrinocoInWord (unsigned long port);
  1345. extern void sysOrinocoInString (unsigned long port, void *addr, unsigned short len);
  1346. extern void sysOrinocoOutByte (unsigned long port, unsigned char value);
  1347. extern void sysOrinocoOutWord (unsigned long port, unsigned short value);
  1348. extern void sysOrinocoOutString (unsigned long port, void *addr, unsigned short len);
  1349. #else
  1350. err: /* commented here */ /* "BSP is not defined..." */
  1351. #endif /* else PC486BSP */
  1352. #endif // __VX_WORKS__
  1353. /************************************************************************************************/
  1354. /****************************** VXWORKS. Motorola Sandpoint PowerPC 824X ***********************/
  1355. /************************************************************************************************/
  1356. #ifdef __VX_WORKS_SANDPOINT_824X__
  1357. #include <vxWorks.h>
  1358. #include <sysLib.h>
  1359. #include <taskLib.h>
  1360. #ifdef WVLAN_53
  1361. #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA
  1362. #endif /* WVLAN_53 */
  1363. #ifdef WVLAN_54
  1364. #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP
  1365. #endif /* WVLAN_54 */
  1366. #ifdef WVLAN_56
  1367. #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_END
  1368. #endif /* WVLAN_56 */
  1369. #if !defined MSF_COMPONENT_ID
  1370. #error "you must define an MSF component ID: WVLAN_53, WVLAN_54, WVLAN_56"
  1371. #endif
  1372. #define MSF_COMPONENT_VAR 1
  1373. #define HCF_EXT HCF_EXT_INFO_LOG
  1374. #define HCF_SLEEP ( HCF_CDS | HCF_DDS )
  1375. //#define HCF_SLEEP ( HCF_DDS )
  1376. #ifndef HCF_ACT_WAKEUP
  1377. #define HCF_ACT_WAKEUP 0x1D
  1378. #endif // HCF_ACT_WAKEUP
  1379. #if defined FATNIC | defined BEAGLE_H253
  1380. #define T1__HCF_TYPE HCF_TYPE_STA
  1381. #else
  1382. #define T1__HCF_TYPE HCF_TYPE_AP | HCF_TYPE_STA
  1383. #endif
  1384. #ifdef HERMES_USB
  1385. #define T2__HCF_TYPE (T1__HCF_TYPE | HCF_TYPE_USB)
  1386. #else // HERMES_USB
  1387. #define T2__HCF_TYPE (T1__HCF_TYPE)
  1388. #endif // HERMES_USB
  1389. #ifdef _WARP
  1390. #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5)
  1391. #else // _WARP
  1392. #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_WPA | HCF_TYPE_HII)
  1393. #endif // WARP
  1394. #ifdef _CCX
  1395. #define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX)
  1396. #else // _WARP
  1397. #define T4__HCF_TYPE (T3__HCF_TYPE)
  1398. #endif // _CCX
  1399. #define T5__HCF_TYPE (T4__HCF_TYPE)
  1400. // Default to TYPE_AP + SSN!
  1401. #define HCF_TYPE (T5__HCF_TYPE )
  1402. #define MSF_COMPONENT_MAJOR_VER 2
  1403. #define MSF_COMPONENT_MINOR_VER 0
  1404. #define HCF_IO HCF_IO_MEM
  1405. #define HCF_DMA 0
  1406. #define HCF_MEM_IO 1
  1407. #define HCF_BIG_ENDIAN 1
  1408. //#define support_32bits 1
  1409. #define IN_PORT_WORD(port) (sysInWord( (hcf_io)(port) ))
  1410. #define OUT_PORT_WORD(port, value) (sysOutWord( (hcf_io)(port), (hcf_16)(value) ))
  1411. #define IN_PORT_DWORD(port) (sysInLong( (hcf_io)(port) ))
  1412. #define OUT_PORT_DWORD(port, value) (sysOutLong( (hcf_io)(port), (hcf_16)(value) ))
  1413. #define IN_PORT_STRING_16(port, dst, n) (sysInWordString((hcf_io)(port), (hcf_16 *)dst, n))
  1414. #define OUT_PORT_STRING_16(port, src, n) (sysOutWordString((hcf_io)(port), (hcf_16 *)src, n))
  1415. #ifdef WVLAN_DEBUG
  1416. #define DBG 1
  1417. #define _DEBUG 1
  1418. #endif
  1419. /* we'll need to add these prints someday */
  1420. #define OUTPUTDEBUGMSG(dprintf_exp)
  1421. #define ASSERTDEBUGMSG(cond, dprintf_exp)
  1422. #define HCF_INTERFACE_CONNECT(ifbp)
  1423. #define HCF_INTERFACE_DISCONNECT(ifbp)
  1424. #define HCF_ENTER_INTERFACE_FUNCT(ibfb)
  1425. #define HCF_LEAVE_INTERFACE_FUNCT(ifbp)
  1426. #define CNV_END_INT(w) ( ((hcf_16)(w) & 0x00FF) << 8 | ((hcf_16)(w) & 0xFF00) >> 8 )
  1427. #define CNV_LITTLE_TO_INT(w) CNV_END_INT(w)
  1428. #define CNV_INT_TO_LITTLE(w) CNV_LITTLE_TO_INT(w)
  1429. #endif /* __VX_WORKS_SANDPOINT_824X__ */
  1430. /************************************************************************************************/
  1431. /************************************* VXWORKS. ARM T8300 IPPhone *****************************/
  1432. /************************************************************************************************/
  1433. #if defined( IPT_T8300 ) || defined( IPT_T8307 )
  1434. #include <vxWorks.h>
  1435. #include <sysLib.h>
  1436. #include <taskLib.h>
  1437. #define HCF_ALIGN 4 /* default to 4 byte alignment */
  1438. #define BEAGLE_H253 /* Hermes 2.5.3 build, better to be in the project file */
  1439. #define OOR_DDS /* Hermes 2.5.3 build, better to be in the project file */
  1440. #define FATNIC
  1441. #ifdef WVLAN_53
  1442. #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA
  1443. #endif /* WVLAN_53 */
  1444. #ifdef WVLAN_54
  1445. #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP
  1446. #endif /* WVLAN_54 */
  1447. #ifdef WVLAN_56
  1448. #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_END
  1449. #endif /* WVLAN_56 */
  1450. #if !defined MSF_COMPONENT_ID
  1451. #error "you must define an MSF component ID: WVLAN_53, WVLAN_54, WVLAN_56"
  1452. #endif
  1453. #define MSF_COMPONENT_VAR 1
  1454. #define HCF_EXT HCF_EXT_INFO_LOG
  1455. //#define HCF_EXT HCF_EXT_INFO_LOG | HCF_EXT_MB
  1456. #define HCF_SLEEP ( HCF_CDS | HCF_DDS )
  1457. //#define HCF_SLEEP ( HCF_DDS )
  1458. #ifndef HCF_ACT_WAKEUP
  1459. #define HCF_ACT_WAKEUP 0x1D
  1460. #endif // HCF_ACT_WAKEUP
  1461. #if defined FATNIC || defined BEAGLE_H253
  1462. #define T1__HCF_TYPE HCF_TYPE_STA
  1463. #else
  1464. //#define T1__HCF_TYPE HCF_TYPE_AP | HCF_TYPE_STA
  1465. #define T1__HCF_TYPE HCF_TYPE_STA /* dz, Station code only */
  1466. #endif
  1467. #ifdef HERMES_USB
  1468. #define T2__HCF_TYPE (T1__HCF_TYPE | HCF_TYPE_USB)
  1469. #else // HERMES_USB
  1470. #define T2__HCF_TYPE (T1__HCF_TYPE)
  1471. #endif // HERMES_USB
  1472. #ifdef _WARP
  1473. #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5)
  1474. #else // _WARP
  1475. #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_WPA | HCF_TYPE_HII)
  1476. //#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII) /* dz. no WPA support at this time, test code */
  1477. #endif // WARP
  1478. #ifdef _CCX
  1479. #define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX)
  1480. #else // _WARP
  1481. #define T4__HCF_TYPE (T3__HCF_TYPE)
  1482. #endif // _CCX
  1483. #define T5__HCF_TYPE (T4__HCF_TYPE)
  1484. // Default to TYPE_AP + SSN!
  1485. #define HCF_TYPE (T5__HCF_TYPE )
  1486. #define MSF_COMPONENT_MAJOR_VER 2
  1487. #define MSF_COMPONENT_MINOR_VER 0
  1488. #define HCF_IO HCF_IO_MEM
  1489. #define HCF_DMA 0
  1490. #define HCF_MEM_IO 1
  1491. /* Endian is determined by vxWorks project compile option */
  1492. #if (_BYTE_ORDER == _BIG_ENDIAN)
  1493. #undef HCF_LITTLE_ENDIAN
  1494. #define HCF_BIG_ENDIAN 1
  1495. #endif
  1496. #define CNV_END(w) ( ((hcf_16)(w) & 0x00FF) << 8 | ((hcf_16)(w) & 0xFF00) >> 8 )
  1497. #if defined HCF_BIG_ENDIAN
  1498. //******************************************** B I G E N D I A N *******************************************
  1499. #define CNV_LITTLE_TO_INT(w) CNV_END(w) // endianess conversion needed
  1500. #define CNV_BIG_TO_INT(w) (w) // no endianess conversion needed
  1501. #else
  1502. //****************************************** L I T T L E E N D I A N ****************************************
  1503. #define CNV_LITTLE_TO_INT(w) (w) // no endianess conversion needed
  1504. #define CNV_BIG_TO_INT(w) CNV_END(w) // endianess conversion needed
  1505. #endif // HCF_BIG_ENDIAN
  1506. // conversion macros which can be expressed in other macros
  1507. #define CNV_INT_TO_LITTLE(w) CNV_LITTLE_TO_INT(w)
  1508. #define CNV_INT_TO_BIG(w) CNV_BIG_TO_INT(w)
  1509. #define IN_PORT_WORD( port ) *((volatile hcf_16 *)( port ))
  1510. #define OUT_PORT_WORD( port, value ) *((volatile hcf_16 *)( port )) = ((hcf_16)( value ))
  1511. //#define IN_PORT_BYTE( port ) *((volatile hcf_8 *)( port ))
  1512. #define IN_PORT_STRING( port, addr, len) { \
  1513. unsigned l = len; \
  1514. hcf_16 *d = (hcf_16 *)(addr); \
  1515. hcf_16 t; \
  1516. while (l--) { \
  1517. t = IN_PORT_WORD(port); \
  1518. *d++ = CNV_LITTLE_TO_INT(t); \
  1519. } \
  1520. } // IN_PORT_STRING
  1521. #define OUT_PORT_STRING( port, addr, len) { \
  1522. unsigned l = (len); \
  1523. hcf_16 *s = (hcf_16 *)(addr); \
  1524. hcf_16 t; \
  1525. while (l--) { \
  1526. t = *s++; \
  1527. t = CNV_LITTLE_TO_INT(t); \
  1528. OUT_PORT_WORD(port, t); \
  1529. } \
  1530. } // OUT_PORT_STRING
  1531. #define IN_PORT_STRING_16(port, dst, n) { \
  1532. unsigned l = (n); \
  1533. hcf_16 *d = (hcf_16 *)(dst); \
  1534. while (l--) { \
  1535. *d++ = IN_PORT_WORD(port); \
  1536. } \
  1537. } // IN_PORT_STRING_16
  1538. #define OUT_PORT_STRING_16(port, src, n) { \
  1539. hcf_16 t; \
  1540. int l = (n); \
  1541. hcf_16 *s = (hcf_16 *)(src); \
  1542. while (l--) { \
  1543. t = *s++; \
  1544. OUT_PORT_WORD(port, t); \
  1545. } \
  1546. } // OUT_PORT_STRING_16
  1547. /* #define HCF_YIELD (taskDelay(0) == 0) */
  1548. #ifdef WVLAN_DEBUG
  1549. #define DBG 1
  1550. #define _DEBUG 1
  1551. #endif
  1552. /* we'll need to add these prints someday */
  1553. #define OUTPUTDEBUGMSG(dprintf_exp)
  1554. #define ASSERTDEBUGMSG(cond, dprintf_exp)
  1555. #define HCF_INTERFACE_CONNECT(ifbp)
  1556. #define HCF_INTERFACE_DISCONNECT(ifbp)
  1557. #define HCF_ENTER_INTERFACE_FUNCT(ibfb)
  1558. #define HCF_LEAVE_INTERFACE_FUNCT(ifbp)
  1559. #define sysInWord(offsetAddr) IN_PORT_WORD(offsetAddr)
  1560. #define sysInByte(offsetAddr) IN_PORT_BYTE(offsetAddr)
  1561. #define sysOutWord(addr, value) OUT_PORT_WORD(addr, value)
  1562. #endif /*IPT_T8300 */
  1563. /************************************************************************************************************/
  1564. /*********************************** **************************************/
  1565. /************************************************************************************************************/
  1566. #if ! defined HCF_ALIGN
  1567. #define HCF_ALIGN 1 //default to no alignment
  1568. #endif // HCF_ALIGN
  1569. #if ! defined HCF_ASSERT
  1570. #define HCF_ASSERT 0
  1571. #endif // HCF_ASSERT
  1572. #if ! defined HCF_BIG_ENDIAN
  1573. #define HCF_BIG_ENDIAN 0
  1574. #endif // HCF_BIG_ENDIAN
  1575. #if ! defined HCF_DL_ONLY
  1576. #define HCF_DL_ONLY 0
  1577. #endif // HCF_DL_ONLY
  1578. #if ! defined HCF_DMA
  1579. #define HCF_DMA 0
  1580. #endif // HCF_DMA
  1581. #if ! defined HCF_ENCAP
  1582. #define HCF_ENCAP HCF_ENC
  1583. #endif // HCF_ENCAP
  1584. #if ! defined HCF_ENTRY
  1585. #define HCF_ENTRY( ifbp )
  1586. #endif // HCF_ENTRY
  1587. #if ! defined HCF_EXIT
  1588. #define HCF_EXIT( ifbp )
  1589. #endif // HCF_EXIT
  1590. #if ! defined HCF_EXT
  1591. #define HCF_EXT 0
  1592. #endif // HCF_EXT
  1593. #if ! defined HCF_INT_ON
  1594. #define HCF_INT_ON 1
  1595. #endif // HCF_INT_ON
  1596. #if ! defined HCF_IO
  1597. #define HCF_IO 0 //default 16 bits support only, port I/O
  1598. #endif // HCF_IO
  1599. #if ! defined HCF_LEGACY
  1600. #define HCF_LEGACY 0
  1601. #endif // HCF_LEGACY
  1602. #if ! defined HCF_MAX_LTV
  1603. #define HCF_MAX_LTV 1200 // sufficient for all known purposes
  1604. #endif // HCF_MAX_LTV
  1605. #if ! defined HCF_PROT_TIME
  1606. #define HCF_PROT_TIME 100 // number of 10K microsec protection timer against H/W malfunction
  1607. #endif // HCF_PROT_TIME
  1608. #if ! defined HCF_SLEEP
  1609. #define HCF_SLEEP 0
  1610. #endif // HCF_SLEEP
  1611. #if ! defined HCF_TALLIES
  1612. #define HCF_TALLIES ( HCF_TALLIES_NIC | HCF_TALLIES_HCF )
  1613. #endif // HCF_TALLIES
  1614. #if ! defined HCF_TYPE
  1615. #define HCF_TYPE 0
  1616. #endif // HCF_TYPE
  1617. #if HCF_BIG_ENDIAN
  1618. #undef HCF_BIG_ENDIAN
  1619. #define HCF_BIG_ENDIAN 1 //just for convenience of generating cfg_hcf_opt
  1620. #endif // HCF_BIG_ENDIAN
  1621. #if HCF_DL_ONLY
  1622. #undef HCF_DL_ONLY
  1623. #define HCF_DL_ONLY 1 //just for convenience of generating cfg_hcf_opt
  1624. #endif // HCF_DL_ONLY
  1625. #if HCF_DMA
  1626. #undef HCF_DMA
  1627. #define HCF_DMA 1 //just for convenience of generating cfg_hcf_opt
  1628. #endif // HCF_DMA
  1629. #if HCF_INT_ON
  1630. #undef HCF_INT_ON
  1631. #define HCF_INT_ON 1 //just for convenience of generating cfg_hcf_opt
  1632. #endif // HCF_INT_ON
  1633. #if ! defined IN_PORT_STRING_8_16
  1634. #define IN_PORT_STRING_8_16(port, addr, len) IN_PORT_STRING_16(port, addr, len)
  1635. #define OUT_PORT_STRING_8_16(port, addr, len) OUT_PORT_STRING_16(port, addr, len)
  1636. #endif // IN_PORT_STRING_8_16
  1637. /************************************************************************************************/
  1638. /********** *************/
  1639. /************************************************************************************************/
  1640. #if ! defined FAR
  1641. #define FAR // default to flat 32-bits code
  1642. #endif // FAR
  1643. typedef hcf_8 FAR *wci_bufp; // segmented 16-bits or flat 32-bits pointer to 8 bits unit
  1644. typedef hcf_16 FAR *wci_recordp; // segmented 16-bits or flat 32-bits pointer to 16 bits unit
  1645. /* I/O Address size
  1646. * Platforms which use port mapped I/O will (in general) have a 64k I/O space, conveniently expressed in a
  1647. * 16-bits quantity
  1648. * Platforms which use memory mapped I/O will (in general) have an I/O space much larger than 64k, and need a
  1649. * 32-bits quantity to express the I/O base
  1650. */
  1651. #if HCF_IO & HCF_IO_MEM
  1652. typedef hcf_32 hcf_io;
  1653. #else
  1654. typedef hcf_16 hcf_io;
  1655. #endif //HCF_IO
  1656. #if HCF_PROT_TIME > 128
  1657. #define HCF_PROT_TIME_SHFT 3
  1658. #define HCF_PROT_TIME_DIV 8
  1659. #elif HCF_PROT_TIME > 64
  1660. #define HCF_PROT_TIME_SHFT 2
  1661. #define HCF_PROT_TIME_DIV 4
  1662. #elif HCF_PROT_TIME > 32
  1663. #define HCF_PROT_TIME_SHFT 1
  1664. #define HCF_PROT_TIME_DIV 2
  1665. #else //HCF_PROT_TIME >= 19
  1666. #define HCF_PROT_TIME_SHFT 0
  1667. #define HCF_PROT_TIME_DIV 1
  1668. #endif
  1669. #define HCF_PROT_TIME_CNT (HCF_PROT_TIME / HCF_PROT_TIME_DIV)
  1670. /************************************************************************************************************/
  1671. /******************************************* . . . . . . . . . *********************************************/
  1672. /************************************************************************************************************/
  1673. /* MSF_COMPONENT_ID is used to define the CFG_IDENTITY_STRCT in HCF.C
  1674. * CFG_IDENTITY_STRCT is defined in HCF.C purely based on convenience arguments.
  1675. * The HCF can not have the knowledge to determine the ComponentId field of the Identity record (aka as
  1676. * Version Record), therefore the MSF part of the Drivers must supply this value via the System Constant
  1677. * MSF_COMPONENT_ID.
  1678. * There is a set of values predefined in MDD.H (format COMP_ID_.....)
  1679. *
  1680. * Note that taking MSF_COMPONENT_ID as a default value for DUI_COMPAT_VAR is purely an implementation
  1681. * convenience, the numerical values of these two quantities have none functional relationship whatsoever.
  1682. */
  1683. #if defined MSF_COMPONENT_ID
  1684. #if ! defined DUI_COMPAT_VAR
  1685. #define DUI_COMPAT_VAR MSF_COMPONENT_ID
  1686. #endif // DUI_COMPAT_VAR
  1687. #if ! defined DUI_COMPAT_BOT //;?this way utilities can lower as well raise the bottom
  1688. #define DUI_COMPAT_BOT 8
  1689. #endif // DUI_COMPAT_BOT
  1690. #if ! defined DUI_COMPAT_TOP //;?this way utilities can lower as well raise the top
  1691. #define DUI_COMPAT_TOP 8
  1692. #endif // DUI_COMPAT_TOP
  1693. #endif // MSF_COMPONENT_ID
  1694. #if (HCF_TYPE) & HCF_TYPE_HII5
  1695. #if ! defined HCF_HSI_VAR_5
  1696. #define HCF_HSI_VAR_5
  1697. #endif // HCF_HSI_VAR_5
  1698. #if ! defined HCF_APF_VAR_4
  1699. #define HCF_APF_VAR_4
  1700. #endif // HCF_APF_VAR_4
  1701. #if (HCF_TYPE) & HCF_TYPE_WARP
  1702. #if ! defined HCF_STA_VAR_4
  1703. #define HCF_STA_VAR_4
  1704. #endif // HCF_STA_VAR_4
  1705. #else
  1706. #if ! defined HCF_STA_VAR_2
  1707. #define HCF_STA_VAR_2
  1708. #endif // HCF_STA_VAR_2
  1709. #endif
  1710. #if defined HCF_HSI_VAR_4
  1711. err: HSI variants 4 correspond with HII;
  1712. #endif // HCF_HSI_VAR_4
  1713. #else
  1714. #if ! defined HCF_HSI_VAR_4
  1715. #define HCF_HSI_VAR_4 //Hermes-II all types (for the time being!)
  1716. #endif // HCF_HSI_VAR_4
  1717. #if ! defined HCF_APF_VAR_2
  1718. #define HCF_APF_VAR_2
  1719. #endif // HCF_APF_VAR_2
  1720. #if ! defined HCF_STA_VAR_2
  1721. #define HCF_STA_VAR_2
  1722. #endif // HCF_STA_VAR_2
  1723. #endif // HCF_TYPE_HII5
  1724. #if ! defined HCF_PRI_VAR_3
  1725. #define HCF_PRI_VAR_3
  1726. #endif // HCF_PRI_VAR_3
  1727. #if defined HCF_HSI_VAR_1 || defined HCF_HSI_VAR_2 || defined HCF_HSI_VAR_3
  1728. err: HSI variants 1, 2 and 3 correspond with H-I only;
  1729. #endif // HCF_HSI_VAR_1, HCF_HSI_VAR_2, HCF_HSI_VAR_3
  1730. #if defined HCF_PRI_VAR_1 || defined HCF_PRI_VAR_2
  1731. err: primary variants 1 and 2 correspond with H-I only;
  1732. #endif // HCF_PRI_VAR_1 / HCF_PRI_VAR_2
  1733. /************************************************************************************************************/
  1734. /******************************************* . . . . . . . . . *********************************************/
  1735. /************************************************************************************************************/
  1736. /* The BASED customization macro is used to resolves the SS!=DS conflict for the Interrupt Service logic in
  1737. * DOS Drivers. Due to the cumbersomeness of mixing C and assembler local BASED variables still end up in the
  1738. * wrong segment. The workaround is that the HCF uses only global BASED variables or IFB-based variables.
  1739. * The "BASED" construction (supposedly) only amounts to something in the small memory model.
  1740. *
  1741. * Note that the whole BASED rigmarole is needlessly complicated because both the Microsoft Compiler and
  1742. * Linker are unnecessary restrictive in what far pointer manipulation they allow
  1743. */
  1744. #if ! defined BASED
  1745. #define BASED
  1746. #endif // BASED
  1747. #if ! defined EXTERN_C
  1748. #ifdef __cplusplus
  1749. #define EXTERN_C extern "C"
  1750. #else
  1751. #define EXTERN_C
  1752. #endif // __cplusplus
  1753. #endif // EXTERN_C
  1754. #if ! defined NULL
  1755. #define NULL ((void *) 0)
  1756. #endif // NULL
  1757. #if ! defined TEXT
  1758. #define TEXT(x) x
  1759. #endif // TEXT
  1760. #if !defined _TCHAR_DEFINED
  1761. #define TCHAR char
  1762. #endif // _TCHAR_DEFINED
  1763. /************************************************************************************************************/
  1764. /*********************** 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 ************************/
  1765. /************************************************************************************************************/
  1766. #if defined HCF_LITTLE_ENDIAN
  1767. err: HCF_LITTLE_ENDIAN is obsolete;
  1768. #endif // HCF_LITTLE_ENDIAN
  1769. #if defined HCF_INT_OFF
  1770. err: HCF_INT_OFF is obsolete;
  1771. #endif //HCF_INT_OFF
  1772. #if HCF_ALIGN != 1 && HCF_ALIGN != 2 && HCF_ALIGN != 4 && HCF_ALIGN != 8
  1773. err: invalid value for HCF_ALIGN;
  1774. #endif // HCF_ALIGN
  1775. #if (HCF_ASSERT) & ~( HCF_ASSERT_PRINTF | HCF_ASSERT_SW_SUP | HCF_ASSERT_MB | HCF_ASSERT_RT_MSF_RTN | \
  1776. HCF_ASSERT_LNK_MSF_RTN )
  1777. err: invalid value for HCF_ASSERT;
  1778. #endif // HCF_ASSERT
  1779. #if (HCF_ASSERT) & HCF_ASSERT_MB && ! ( (HCF_EXT) & HCF_EXT_MB ) //detect potential conflict
  1780. err: these macros are not used consistently;
  1781. #endif // HCF_ASSERT_MB / HCF_EXT_MB
  1782. #if HCF_BIG_ENDIAN != 0 && HCF_BIG_ENDIAN != 1
  1783. err: invalid value for HCF_BIG_ENDIAN;
  1784. #endif // HCF_BIG_ENDIAN
  1785. #if HCF_DL_ONLY != 0 && HCF_DL_ONLY != 1
  1786. err: invalid value for HCF_DL_ONLY;
  1787. #endif // HCF_DL_ONLY
  1788. #if HCF_DMA != 0 && HCF_DMA != 1
  1789. err: invalid value for HCF_DMA;
  1790. #endif // HCF_DMA
  1791. #if (HCF_ENCAP) & ~( HCF_ENC | HCF_ENC_SUP )
  1792. err: invalid value for HCF_ENCAP;
  1793. #endif // HCF_ENCAP
  1794. #if (HCF_EXT) & ~( HCF_EXT_INFO_LOG | HCF_EXT_INT_TX_EX | HCF_EXT_TALLIES_FW | HCF_EXT_TALLIES_HCF | \
  1795. HCF_EXT_NIC_ACCESS | HCF_EXT_MB | HCF_EXT_INT_TICK | \
  1796. HCF_EXT_IFB_STRCT | HCF_EXT_DESC_STRCT | HCF_EXT_TX_CONT )
  1797. err: invalid value for HCF_EXT;
  1798. #endif // HCF_EXT
  1799. #if HCF_INT_ON != 0 && HCF_INT_ON != 1
  1800. err: invalid value for HCF_INT_ON;
  1801. #endif // HCF_INT_ON
  1802. #if (HCF_IO) & ~( HCF_IO_MEM | HCF_IO_32BITS )
  1803. err: invalid value for HCF_IO;
  1804. #endif // HCF_IO
  1805. #if HCF_LEGACY != 0 && HCF_LEGACY != 1
  1806. err: invalid value for HCF_LEGACY;
  1807. #endif // HCF_LEGACY
  1808. #if HCF_MAX_LTV < 16 || HCF_MAX_LTV > 2304
  1809. err: invalid value for HCF_MAX_LTV;
  1810. #endif // HCF_MAX_LTV
  1811. #if HCF_PROT_TIME != 0 && ( HCF_PROT_TIME < 19 || 256 < HCF_PROT_TIME )
  1812. err: below minimum .08 second required by Hermes or possibly above hcf_32 capacity;
  1813. #endif // HCF_PROT_TIME
  1814. #if (HCF_SLEEP) & ~( HCF_CDS | HCF_DDS )
  1815. err: invalid value for HCF_SLEEP;
  1816. #endif // HCF_SLEEP
  1817. #if (HCF_SLEEP) && ! (HCF_INT_ON)
  1818. err: these macros are not used consistently;
  1819. #endif // HCF_SLEEP / HCF_INT_ON
  1820. #if (HCF_SLEEP) && ! ( (HCF_EXT) & HCF_EXT_INT_TICK )
  1821. //;? err: these macros are not used consistently;
  1822. #endif // HCF_SLEEP / HCF_EXT_INT_TICK
  1823. #if (HCF_TALLIES) & ~( HCF_TALLIES_HCF | HCF_TALLIES_NIC | HCF_TALLIES_RESET ) || \
  1824. (HCF_TALLIES) == HCF_TALLIES_RESET
  1825. err: invalid value for HCF_TALLIES;
  1826. #endif // HCF_TALLIES
  1827. #if (HCF_TYPE) & ~(HCF_TYPE_WPA | HCF_TYPE_USB | HCF_TYPE_PRELOADED | HCF_TYPE_HII5 | HCF_TYPE_WARP | \
  1828. HCF_TYPE_CCX /* | HCF_TYPE_TX_DELAY */ )
  1829. err: invalid value for HCF_TYPE;
  1830. #endif //HCF_TYPE
  1831. #if (HCF_TYPE) & HCF_TYPE_WARP && (HCF_TYPE) & HCF_TYPE_WPA
  1832. err: at most 1 of these macros should be defined;
  1833. #endif //HCF_TYPE_WARP / HCF_TYPE_WPA
  1834. #endif //HCFCFG_H