1
2
3#ifndef HCFCFG_H
4#define HCFCFG_H 1
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245typedef unsigned char hcf_8;
246typedef unsigned short hcf_16;
247typedef unsigned long hcf_32;
248
249
250#define HCF_IO_MEM 0x0001
251#define HCF_IO_32BITS 0x0002
252
253
254#define HCF_TYPE_NONE 0x0000
255#define HCF_TYPE_WPA 0x0001
256#define HCF_TYPE_USB 0x0002
257
258#define HCF_TYPE_WARP 0x0008
259#define HCF_TYPE_PRELOADED 0x0040
260#define HCF_TYPE_HII5 0x0080
261#define HCF_TYPE_CCX 0x0100
262#define HCF_TYPE_BEAGLE_HII5 0x0200
263#define HCF_TYPE_TX_DELAY 0x4000
264
265
266#define HCF_ASSERT_NONE 0x0000
267#define HCF_ASSERT_PRINTF 0x0001
268#define HCF_ASSERT_SW_SUP 0x0002
269#define HCF_ASSERT_MB 0x0004
270#define HCF_ASSERT_RT_MSF_RTN 0x4000
271#define HCF_ASSERT_LNK_MSF_RTN 0x8000
272
273
274#define HCF_ENC_NONE 0x0000
275#define HCF_ENC 0x0001
276#define HCF_ENC_SUP 0x0002
277
278
279#define HCF_EXT_NONE 0x0000
280#define HCF_EXT_INFO_LOG 0x0001
281
282#define HCF_EXT_INT_TX_EX 0x0004
283
284#define HCF_EXT_TALLIES_FW 0x0010
285#define HCF_EXT_TALLIES_HCF 0x0020
286#define HCF_EXT_NIC_ACCESS 0x0040
287#define HCF_EXT_MB 0x0080
288#define HCF_EXT_IFB_STRCT 0x0100
289#define HCF_EXT_DESC_STRCT 0x0200
290#define HCF_EXT_TX_CONT 0x4000
291#define HCF_EXT_INT_TICK 0x8000
292
293
294#define HCF_DDS 0x0001
295#define HCF_CDS 0x0002
296
297
298#define HCF_TALLIES_NONE 0x0000
299#define HCF_TALLIES_NIC 0x0001
300#define HCF_TALLIES_HCF 0x0002
301#define HCF_TALLIES_RESET 0x8000
302
303
304
305
306
307
308#if defined WVLAN_41 || defined WVLAN_48 || defined WVLAN_52 || defined _WIN32_WCE
309
310#ifndef WVLAN_46
311#define HCF_EXT (HCF_EXT_INFO_LOG | HCF_EXT_MB | HCF_EXT_NIC_ACCESS )
312#else
313#define HCF_EXT ( HCF_EXT_TX_CONT | HCF_EXT_INFO_LOG | HCF_EXT_MB | HCF_EXT_NIC_ACCESS )
314#endif
315#define HCF_DLV 1
316
317#ifdef _WIN32_WCE
318#define HCF_IO HCF_IO_MEM
319#define HCF_DMA 0
320#endif
321
322#if _VARIANT == 7
323#define HCF_SLEEP HCF_CDS
324#endif
325
326#if _VARIANT == 5 || _VARIANT == 6
327#define _WARP
328#define _AES
329#define HCF_SLEEP HCF_CDS
330#if _VARIANT == 6
331
332#endif
333#ifndef _WIN32_WCE
334#define HCF_IO HCF_IO_32BITS
335#define HCF_DMA 1
336#endif
337#endif
338
339
340
341
342#if defined WVLAN_48
343#if _VARIANT == 4 || _VARIANT == 6
344#define _CCX_OK 1
345#endif
346#endif
347
348
349#if defined WVLAN_48
350#if _VARIANT == 4 || _VARIANT == 6
351#define _CCX
352#define HCF_MAX_MSG_CKIP_PADDING 86
353#define HCF_MAX_MSG ( 1514 + HCF_MAX_MSG_CKIP_PADDING )
354#endif
355#endif
356
357
358#if !defined WVLAN_46
359#define _PEEK
360#endif
361
362#ifndef _WIN32_WCE
363
364#ifdef ASSERT
365#undef ASSERT
366#define ASSERT(x) ASSERTDEBUGMSG((x), (TEXT("SIMULATE ASSERT:")))
367#endif
368#endif
369
370
371#if defined WVLAN_41
372#define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_31
373#endif
374#if defined WVLAN_48 && !defined _WIN32_WCE
375#define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_50
376#endif
377#if defined WVLAN_52 && !defined _WIN32_WCE
378#define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_40
379#endif
380#if defined WVLAN_46
381#define MSF_COMPONENT_ID COMP_ID_WIN_CE
382#endif
383
384#define MSF_COMPONENT_VAR _VARIANT
385
386#define T1__HCF_TYPE (HCF_TYPE_NONE)
387
388#define T2__HCF_TYPE (T1__HCF_TYPE)
389
390#ifdef _WARP
391#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5 | HCF_TYPE_WARP )
392#else
393#if _VARIANT == 7
394#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5)
395#else
396#define T3__HCF_TYPE (T2__HCF_TYPE)
397#endif
398#endif
399
400#ifdef _CCX_OK
401#define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX)
402#else
403#define T4__HCF_TYPE (T3__HCF_TYPE)
404#endif
405
406
407
408
409#ifdef _WARP
410#define T5__HCF_TYPE (T4__HCF_TYPE)
411#else
412#define T5__HCF_TYPE (T4__HCF_TYPE | HCF_TYPE_WPA)
413#endif
414
415#define HCF_TYPE (T5__HCF_TYPE)
416
417
418#if (defined DBG && DBG != 0)
419#ifndef STATIC
420#define STATIC
421#endif
422#endif
423
424#if !defined SOFTRONICS_CODE && !defined _APIDLL && !defined _WIN32_WCE
425#include <ndis.h>
426#endif
427#if defined _WIN32_WCE
428#include <windows.h>
429#include <winnt.h>
430#endif
431#include "version.h"
432
433#define MSF_COMPONENT_MAJOR_VER TPI_MAJOR_VERSION
434#define MSF_COMPONENT_MINOR_VER TPI_MINOR_VERSION
435
436#if !defined _APIDLL && !defined _WIN32_WCE
437
438__inline UCHAR NDIS_IN_BYTE( ULONG port )
439{
440 UCHAR value;
441 NdisRawReadPortUchar(port , &value);
442 return (value);
443}
444
445__inline ULONG NDIS_IN_LONG( ULONG port )
446{
447 ULONG value;
448 NdisRawReadPortUlong(port , &value);
449 return (value);
450}
451__inline USHORT NDIS_IN_WORD( ULONG port )
452{
453 USHORT value;
454 NdisRawReadPortUshort(port , &value);
455 return (value);
456}
457
458#define IN_PORT_DWORD(port) NDIS_IN_LONG( (ULONG) (port) )
459#define IN_PORT_WORD(port) NDIS_IN_WORD( (ULONG) (port) )
460#define OUT_PORT_DWORD(port, value) NdisRawWritePortUlong((ULONG) (port) , value)
461#define OUT_PORT_WORD(port, value) NdisRawWritePortUshort((ULONG) (port) , (USHORT) (value))
462
463#define IN_PORT_STRING_8_16(port, addr, len) IN_PORT_STRING_16(port, addr, len)
464#define OUT_PORT_STRING_8_16(port, addr, len) OUT_PORT_STRING_16(port, addr, len)
465
466#define IN_PORT_STRING_32(port, addr, len) { \
467 NdisRawReadPortBufferUlong(port, addr, (len)); \
468}
469
470#define OUT_PORT_STRING_32(port, addr, len) { \
471 NdisRawWritePortBufferUlong(port, addr, (len)); \
472}
473
474#define IN_PORT_STRING_16(port, addr, len) NdisRawReadPortBufferUshort(port, addr, (len));
475#define OUT_PORT_STRING_16(port, addr, len) NdisRawWritePortBufferUshort(port, addr, (len));
476
477#endif
478
479#if defined _WIN32_WCE
480
481#define HCF_ALIGN 2
482#define HCF_MEM_IO 1
483#define HCF_PROT_TIME 49
484
485#define IN_PORT_BYTE CE_IN_PORT_BYTE
486#define OUT_PORT_BYTE CE_OUT_PORT_BYTE
487#define IN_PORT_WORD CE_IN_PORT_WORD
488#define OUT_PORT_WORD CE_OUT_PORT_WORD
489#define IN_PORT_STRING_16 CE_IN_PORT_STRING
490#define OUT_PORT_STRING_16 CE_OUT_PORT_STRING
491
492extern hcf_8 CE_IN_PORT_BYTE(hcf_32 port);
493extern void CE_OUT_PORT_BYTE(hcf_32 port, hcf_8 value);
494extern hcf_16 CE_IN_PORT_WORD(hcf_32 port);
495extern void CE_OUT_PORT_WORD(hcf_32 port, hcf_16 value);
496extern void CE_IN_PORT_STRING(hcf_32 port, void *addr, hcf_16 len);
497extern void CE_OUT_PORT_STRING(hcf_32 port, void *addr, hcf_16 len);
498
499
500#endif
501
502#if defined _DEBUG || (defined DBG && DBG != 0)
503#define HCF_ASSERT ( HCF_ASSERT_LNK_MSF_RTN | HCF_ASSERT_RT_MSF_RTN | HCF_ASSERT_PRINTF )
504
505#endif
506
507#if defined DEBUG || defined _DEBUG || (defined DBG && DBG != 0)
508#ifdef _WIN32_WCE
509#define DBGA2W(DBGSTR) CeConvertAnsiToUnicodeLen((char*)DBGSTR)
510#define OUTPUTDEBUGMSG(dprintf_exp) ((void)((! ZONE_DEBUG) ? 0:ce_debug_out dprintf_exp))
511#define ASSERTDEBUGMSG(cond, dprintf_exp) ((void)((cond) ? 0:ce_debug_out dprintf_exp))
512
513#define ZONE_ERROR DEBUGZONE(0)
514#define ZONE_WARN DEBUGZONE(1)
515#define ZONE_FUNCTION DEBUGZONE(2)
516#define ZONE_INIT DEBUGZONE(3)
517#define ZONE_INTR DEBUGZONE(4)
518#define ZONE_RCV DEBUGZONE(5)
519#define ZONE_XMIT DEBUGZONE(6)
520#define ZONE_ASSERT DEBUGZONE(7)
521#define ZONE_DEBUG DEBUGZONE(8)
522#define ZONE_OEM DEBUGZONE(9)
523#define ZONE_HCF DEBUGZONE(10)
524#define ZONE_PORTIO DEBUGZONE(11)
525#define ZONE_LOGTOFILE DEBUGZONE(15)
526
527#else
528
529#define OUTPUTDEBUGMSG(dprintf_exp) ((void) (DbgPrint dprintf_exp))
530
531#define ASSERTDEBUGMSG(cond, print) ((void)((cond) ? 0: (DbgPrint("%s %s:%d - ", print, __FILE__, __LINE__))))
532
533#define ZONE_ERROR 1
534#define ZONE_WARN 1
535#define ZONE_FUNCTION 1
536#define ZONE_INIT 1
537#define ZONE_INTR 1
538#define ZONE_RCV 1
539#define ZONE_XMIT 1
540#define ZONE_ASSERT 1
541#define ZONE_DEBUG 1
542#define ZONE_OEM 1
543#define ZONE_HCF 1
544#define ZONE_PORTIO 1
545#define ZONE_LOGTOFILE 1
546
547#endif
548#ifndef DBGA2W
549#define DBGA2W
550#endif
551
552#else
553#define OUTPUTDEBUGMSG(dprintf_exp)
554#define ASSERTDEBUGMSG(cond, dprintf_exp)
555#endif
556
557#if !defined HCF_MAX_MSG_CKIP_PADDING
558#define HCF_MAX_MSG_CKIP_PADDING 0
559#endif
560
561#if !defined HCF_MAX_MSG
562#define HCF_MAX_MSG 1514
563#endif
564
565#define HCF_LEGACY 1
566
567#endif
568
569
570
571
572
573
574
575#if defined WVLAN_42 || defined WVLAN_43
576
577#pragma warning ( disable: 4001 )
578#define FAR __far
579#define BASED __based(__segname("_CODE"))
580
581
582
583
584
585#define HCF_EXT HCF_EXT_MB
586#define HCF_PROT_TIME 49
587
588
589
590
591#ifdef WVLAN_42
592#define MSF_COMPONENT_ID COMP_ID_PACKET
593#define MSF_COMPONENT_VAR 1
594#define MSF_COMPONENT_MAJOR_VER 6
595#define MSF_COMPONENT_MINOR_VER 12
596#endif
597
598#ifdef WVLAN_43
599#define MSF_COMPONENT_ID COMP_ID_ODI_16
600#define MSF_COMPONENT_VAR 1
601#define MSF_COMPONENT_MAJOR_VER 6
602#define MSF_COMPONENT_MINOR_VER 10
603#endif
604
605
606#ifndef H_2_INC
607#include <stdio.h>
608#include <conio.h>
609#if 1
610#ifndef _DEBUG
611#pragma intrinsic( _inp, _inpw, _outp, _outpw )
612#endif
613
614#define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) ))
615#define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value ))
616
617#if 1
618#define IN_PORT_STRING_8_16( port, addr, n) while (n--) \
619 { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_8 FAR*)addr)+=2; }
620#define OUT_PORT_STRING_8_16( port, addr, n) while (n--) \
621 { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; ((hcf_8 FAR*)addr)+=2; }
622#elif 0
623#define IN_PORT_STRING_8_16( port, addr, n) while ( n-- ) \
624 { hcf_16 i = IN_PORT_WORD(port); *((hcf_8 FAR*)addr)++ = (hcf_8)i; *((hcf_8 FAR*)addr)++ = (hcf_8)(i>>8);}
625#define OUT_PORT_STRING_8_16( port, addr, n) while ( n-- ) \
626 { OUT_PORT_WORD( port, *((hcf_8 FAR*)addr) | *(((hcf_8 FAR*)addr)+1)<<8 ); (hcf_8 FAR*)addr+=2; }
627#else
628#define IN_PORT_STRING_8_16( port, addr, n) __asm \
629{ \
630 __asm push di \
631 __asm push es \
632 __asm mov cx,n \
633 __asm les di,addr \
634 __asm mov dx,port \
635 __asm rep insw \
636 __asm pop es \
637 __asm pop di \
638}
639
640#define OUT_PORT_STRING_8_16( port, addr, n) __asm \
641{ \
642 __asm push si \
643 __asm push ds \
644 __asm mov cx,n \
645 __asm lds si,addr \
646 __asm mov dx,port \
647 __asm rep outsw \
648 __asm pop ds \
649 __asm pop si \
650}
651
652#endif
653#define IN_PORT_STRING_32( port, addr, n) { int n2 = 2*n; IN_PORT_STRING_8_16(port, addr, n2) }
654#define OUT_PORT_STRING_32( port, addr, n) { int n2 = 2*n; OUT_PORT_STRING_8_16(port, addr, n2) }
655#endif
656#endif
657
658#endif
659
660
661
662
663
664
665
666#if defined H0_LDR || defined H1_LDR || defined H2_LDR || defined H5_LDR
667
668#if defined H0_LDR
669#define HCF_DLV 0
670#define HCF_DLNV 1
671#endif
672
673#if defined H1_LDR
674#define HCF_DLV 1
675#define HCF_DLNV 0
676#endif
677
678
679
680#ifdef H5_LDR
681#define HCF_TYPE (HCF_TYPE_HII5 | HCF_TYPE_WARP )
682
683#endif
684
685#define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN
686#define HCF_ENCAP 0
687#define HCF_INT_ON 0
688#define HCF_TALLIES 0
689
690#define MSF_COMPONENT_ID COMP_ID_ODI_16
691#define MSF_COMPONENT_VAR 1
692#define MSF_COMPONENT_MAJOR_VER 0
693#define MSF_COMPONENT_MINOR_VER 0
694
695#include <stdio.h>
696#include <conio.h>
697#if defined NDEBUG
698#pragma intrinsic( _inp, _inpw, _outp, _outpw )
699#endif
700
701#if 0
702#define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) ))
703#define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value ))
704#define IN_PORT_STRING_16( port, addr, n) \
705 while ( n-- ) { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
706#define OUT_PORT_STRING_16( port, addr, n) \
707 while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; (cast)addr += 2; }
708#endif
709
710#endif
711
712
713
714
715
716
717
718#if defined HCF_DEMO
719
720#define HCF_DLV 1
721
722
723#define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN
724
725#define HCF_ENCAP 0
726#define HCF_INT_ON 0
727#define HCF_TALLIES ( HCF_TALLIES_NIC | HCF_TALLIES_HCF )
728
729
730
731#include <stdio.h>
732#include <conio.h>
733#if defined NDEBUG
734#pragma intrinsic( _inp, _inpw, _outp, _outpw )
735#endif
736
737#if 0
738#define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) ))
739#define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value ))
740#define IN_PORT_STRING_16( port, addr, n) \
741 while ( n-- ) { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
742#define OUT_PORT_STRING_16( port, addr, n) \
743 while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; (cast)addr += 2; }
744#endif
745
746#endif
747
748
749
750
751
752
753
754#if defined WVLAN_45
755
756#include "Version.h"
757
758#define MSF_COMPONENT_ID COMP_ID_MAC_OS
759#define MSF_COMPONENT_VAR VARIANT
760#define MSF_COMPONENT_MAJOR_VER VERSION_MAJOR
761#define MSF_COMPONENT_MINOR_VER VERSION_MINOR
762
763#define MAC_OS 1
764
765#define HCF_BIG_ENDIAN 1
766
767#if defined DEBUG
768#define HCF_ASSERT HCF_ASSERT_MB
769#endif
770
771#ifdef __cplusplus
772extern "C" {
773#endif
774extern volatile unsigned char *MacIOaddr;
775extern hcf_16 IN_PORT_WORD(hcf_16 port);
776extern void OUT_PORT_WORD(hcf_16 port, hcf_16 value);
777extern void IN_PORT_STRING_16(hcf_16 port, void *addr, hcf_16 len);
778extern void OUT_PORT_STRING_16(hcf_16 port, void *addr, hcf_16 len);
779
780#define SwapBytes(t) (((t) >> 8) + (((t) & 0xff) << 8))
781
782#ifdef __cplusplus
783}
784#endif
785
786#endif
787
788
789
790
791
792
793
794#ifdef WVLAN_49
795#include <asm/io.h>
796
797#include <wl_version.h>
798
799
800
801
802
803
804#define HCF_SLEEP (HCF_CDS)
805
806
807#ifdef HERMES25
808#ifdef WARP
809#define HCF_TYPE ( HCF_TYPE_WARP | HCF_TYPE_HII5 )
810#else
811#define HCF_TYPE HCF_TYPE_HII5
812#endif
813#else
814#define HCF_TYPE HCF_TYPE_NONE
815#endif
816
817#ifdef ENABLE_DMA
818#define HCF_DMA 1
819#endif
820
821
822#define HCF_EXT ( HCF_EXT_MB | HCF_EXT_INFO_LOG | HCF_EXT_INT_TICK )
823
824
825#ifndef HCF_TYPE_HII
826#define HCF_TYPE_HII 0x0004
827#endif
828
829#ifndef HCF_TYPE_AP
830#define HCF_TYPE_AP 0x0010
831#endif
832
833#ifndef HCF_TYPE_STA
834#define HCF_TYPE_STA 0x0020
835#endif
836
837
838#define HCF_ALIGN 2
839
840
841
842#ifndef CNV_INT_TO_LITTLE
843#define CNV_INT_TO_LITTLE CNV_SHORT_TO_LITTLE
844#endif
845
846#ifndef CNV_LITTLE_TO_INT
847#define CNV_LITTLE_TO_INT CNV_LITTLE_TO_SHORT
848#endif
849
850#define HCF_ERR_BUSY 0x06
851
852
853#define UIL_SUCCESS HCF_SUCCESS
854#define UIL_ERR_TIME_OUT HCF_ERR_TIME_OUT
855#define UIL_ERR_NO_NIC HCF_ERR_NO_NIC
856#define UIL_ERR_LEN HCF_ERR_LEN
857#define UIL_ERR_MIN HCF_ERR_MAX
858
859#define UIL_ERR_IN_USE 0x44
860#define UIL_ERR_WRONG_IFB 0x46
861#define UIL_ERR_MAX 0x7F
862
863#define UIL_ERR_BUSY HCF_ERR_BUSY
864#define UIL_ERR_DIAG_1 HCF_ERR_DIAG_1
865#define UIL_FAILURE 0xFF
866#define UIL_ERR_PIF_CONFLICT 0x40
867#define UIL_ERR_INCOMP_DRV 0x41
868#define UIL_ERR_DOS_CALL 0x43
869#define UIL_ERR_NO_DRV 0x42
870#define UIL_ERR_NSTL 0x45
871
872
873
874#if 0
875#define HCF_IO HCF_IO_32BITS
876#define HCF_DMA 1
877#define HCF_DESC_STRCT_EXT 4
878
879
880
881
882#ifndef BUS_PCMCIA
883#define ENABLE_DMA
884#endif
885
886#endif
887
888
889
890#ifdef ENABLE_DMA
891#define HCF_MAX_PACKET_SIZE 2304
892#else
893#define HCF_MAX_PACKET_SIZE 1514
894#endif
895
896
897#define MSF_COMPONENT_ID COMP_ID_LINUX
898
899#define MSF_COMPONENT_VAR DRV_VARIANT
900#define MSF_COMPONENT_MAJOR_VER DRV_MAJOR_VERSION
901#define MSF_COMPONENT_MINOR_VER DRV_MINOR_VERSION
902
903
904
905#define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN
906
907#ifdef USE_BIG_ENDIAN
908#define HCF_BIG_ENDIAN 1
909#else
910#define HCF_BIG_ENDIAN 0
911#endif
912
913
914
915
916
917#define IN_PORT_BYTE(port) ((hcf_8)inb( (hcf_io)(port) ))
918#define IN_PORT_WORD(port) ((hcf_16)inw( (hcf_io)(port) ))
919#define OUT_PORT_BYTE(port, value) (outb( (hcf_8) (value), (hcf_io)(port) ))
920#define OUT_PORT_WORD(port, value) (outw((hcf_16) (value), (hcf_io)(port) ))
921
922#define IN_PORT_STRING_16(port, dst, n) insw((hcf_io)(port), dst, n)
923#define OUT_PORT_STRING_16(port, src, n) outsw((hcf_io)(port), src, n)
924
925
926#define IN_PORT_STRING_32(port, dst, n) insl((port), (dst), (n))
927#define OUT_PORT_STRING_32(port, src, n) outsl((port), (src), (n))
928#define IN_PORT_HCF32(port) inl( (hcf_io)(port) )
929#define OUT_PORT_HCF32(port, value) outl((hcf_32)(value), (hcf_io)(port) )
930
931#define IN_PORT_DWORD(port) IN_PORT_HCF32(port)
932#define OUT_PORT_DWORD(port, value) OUT_PORT_HCF32(port, value)
933
934#define IN_PORT_STRING_8_16(port, addr, len) IN_PORT_STRING_16(port, addr, len)
935#define OUT_PORT_STRING_8_16(port, addr, len) OUT_PORT_STRING_16(port, addr, len)
936
937
938#ifndef OUTPUTDEBUGMSG
939#define OUTPUTDEBUGMSG(dprintf_exp)
940#endif
941
942
943#ifndef ASSERTDEBUGMSG
944#define ASSERTDEBUGMSG(cond, dprintf_exp)
945#endif
946
947#ifndef CFG_SCAN_CHANNELS_2GHZ
948#define CFG_SCAN_CHANNELS_2GHZ 0xFCC2
949#endif
950
951#define HCF_MAX_MSG 1600
952#endif
953
954
955
956
957
958
959
960#if defined __QNX__ || defined WVLAN_50
961
962#define MSF_COMPONENT_ID 0
963#define MSF_COMPONENT_VAR 0
964#define MSF_COMPONENT_MAJOR_VER 0
965#define MSF_COMPONENT_MINOR_VER 0
966
967#include <conio.h>
968
969#define IN_PORT_WORD(port) ((hcf_16)inpw( (hcf_io)(port) ))
970#define OUT_PORT_WORD(port, value) (outpw( (hcf_io)(port), (hcf_16) (value) ))
971
972
973
974
975
976
977
978#endif
979
980
981
982
983
984
985
986#if defined __BEOS__
987
988#define MSF_COMPONENT_ID 0
989#define MSF_COMPONENT_VAR 0
990#define MSF_COMPONENT_MAJOR_VER 0
991#define MSF_COMPONENT_MINOR_VER 0
992
993#include <drivers/Drivers.h>
994#include <drivers/KernelExport.h>
995
996uint8 read_io_8 (int);
997void write_io_8 (int, uint8);
998uint16 read_io_16 (int);
999void write_io_16 (int, uint16);
1000
1001#define IN_PORT_WORD(port) ((hcf_16)read_io_16( (hcf_io)(port) ))
1002#define OUT_PORT_WORD(port, value) (write_io_16( (hcf_io)(port), (hcf_16) (value) ))
1003
1004
1005
1006
1007
1008
1009#endif
1010
1011
1012
1013
1014
1015
1016
1017#if defined USB
1018#include "gpif.h"
1019
1020#define MSF_COMPONENT_MAJOR_VER 0
1021#define MSF_COMPONENT_MINOR_VER 1
1022
1023#define IN_PORT_WORD(port) (Hermes_IO_Read( (hcf_8)(port)))
1024#define OUT_PORT_WORD(port, value) (Hermes_IO_Write( (hcf_8)port, (value) ) )
1025
1026
1027
1028
1029
1030
1031
1032#define IN_PORT_STRING_16( port, dst, n) while ( n-- ) { *dst++ = IN_PORT_WORD( port ); }
1033#define OUT_PORT_STRING_16( port, src, n) while ( n-- ) { OUT_PORT_WORD( port, *src++ ); }
1034
1035
1036#define HCF_TYPE HCF_TYPE_WPA
1037
1038#endif
1039
1040
1041
1042
1043
1044
1045#if defined __FREE_BSD__
1046
1047#define MSF_COMPONENT_ID COMP_ID_FreeBSD
1048#define MSF_COMPONENT_VAR 1
1049#define MSF_COMPONENT_MAJOR_VER 1
1050#define MSF_COMPONENT_MINOR_VER 0
1051
1052#define HCF_IO HCF_IO_MEM
1053
1054#include <machine/cpufunc.h>
1055
1056#define IN_PORT_WORD(port) ((hcf_16)inw( (hcf_io)(port) ))
1057#define OUT_PORT_WORD(port, value) (outw((hcf_io)(port), (hcf_16)(value)))
1058
1059
1060
1061
1062
1063
1064
1065#endif
1066
1067
1068
1069
1070
1071
1072
1073#if defined WVLAN_81
1074
1075#define EXTERN_C extern
1076
1077#define MSF_COMPONENT_ID COMP_ID_AP1
1078#define MSF_COMPONENT_VAR 1
1079#define MSF_COMPONENT_MAJOR_VER 4
1080#define MSF_COMPONENT_MINOR_VER 0
1081
1082#define HCF_PROT_TIME 49
1083
1084
1085
1086#if !defined FAR
1087#define FAR far
1088#endif
1089
1090#define IN_PORT_WORD(port) (inport( (hcf_io)(port) ))
1091#define OUT_PORT_WORD(port, value) (outport( (hcf_io)(port), value ))
1092
1093#define IN_PORT_STRING_16(port, addr, len) \
1094 asm { push di; push es; mov cx,len; les di,addr; mov dx,port; rep insw; pop es; pop di }
1095
1096#define OUT_PORT_STRING_16(port, addr, len) \
1097 asm { push si; push ds; mov cx,len; lds si,addr; mov dx,port; rep outsw; pop ds; pop si }
1098
1099#endif
1100
1101
1102
1103
1104
1105
1106#if defined WVLAUNCH
1107
1108#include "DriverX.h"
1109extern HWDEVICE* g_pDevice;
1110
1111
1112
1113#define IN_PORT_WORD(port) HwInpw( g_pDevice, port )
1114#define OUT_PORT_WORD(port, value) HwOutpw( g_pDevice, port, value )
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124#endif
1125
1126
1127
1128
1129
1130
1131
1132#if defined WCITST
1133#define MSF_COMPONENT_ID 0
1134#define MSF_COMPONENT_VAR 0
1135#define MSF_COMPONENT_MAJOR_VER 0
1136#define MSF_COMPONENT_MINOR_VER 0
1137
1138
1139
1140#define HCF_TYPE (HCF_TYPE_WPA | HCF_TYPE_PRELOADED)
1141#define HCF_DMA 1
1142
1143#if defined LLB && !((HCF_TYPE) & HCF_TYPE_WPA)
1144err: no LLB unless SSN;
1145#endif
1146
1147#define HCF_DLV 1
1148
1149
1150#define HCF_ASSERT HCF_ASSERT_SW_SUP
1151
1152
1153#if defined __GNUC__
1154#include "stdio.h"
1155
1156#include "sys/io.h"
1157#define extern
1158
1159#define IN_PORT_WORD(port) inw( (hcf_io)(port) )
1160#define IN_PORT_DWORD(port) inl( (hcf_io)(port) )
1161#define OUT_PORT_WORD(port, value) outw( (hcf_io)(port), (hcf_16)(value) )
1162#define OUT_PORT_DWORD(port, value) outl( (hcf_io)(port), (hcf_16)(value) )
1163#else
1164#pragma warning ( disable: 4001 )
1165#define FAR __far
1166
1167#include <stdio.h>
1168#include <conio.h>
1169#ifndef _DEBUG
1170#pragma intrinsic( _inp, _inpw, _outp, _outpw )
1171#endif
1172
1173#ifdef LOG
1174extern FILE* utm_logfile;
1175hcf_16 ipw( hcf_16 port );
1176hcf_8 ipb( hcf_16 port );
1177void opw( hcf_16 port, hcf_16 value );
1178void opb( hcf_16 port, hcf_8 value );
1179
1180#define IN_PORT_WORD(port) ipw( (hcf_io)(port) )
1181#define OUT_PORT_WORD(port, value) opw( (hcf_io)(port), (hcf_16)(value) )
1182#else
1183#define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) ))
1184#define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value ))
1185#endif
1186
1187#if 1
1188#define IN_PORT_STRING_16( port, addr, len) __asm \
1189{ \
1190 __asm push di \
1191 __asm push es \
1192 __asm mov cx,len \
1193 __asm les di,addr \
1194 __asm mov dx,port \
1195 __asm rep insw \
1196 __asm pop es \
1197 __asm pop di \
1198}
1199
1200#define OUT_PORT_STRING_16( port, addr, len) __asm \
1201{ \
1202 __asm push si \
1203 __asm push ds \
1204 __asm mov cx,len \
1205 __asm lds si,addr \
1206 __asm mov dx,port \
1207 __asm rep outsw \
1208 __asm pop ds \
1209 __asm pop si \
1210}
1211
1212#endif
1213
1214#endif
1215
1216#if ! defined IN_PORT_STRING_16
1217#define IN_PORT_STRING_16( port, addr, n) while (n--) \
1218 { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_16 FAR*)addr)++; }
1219#define OUT_PORT_STRING_16( port, addr, n) while (n--) \
1220 { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ); ((hcf_16 FAR*)addr)++; }
1221#endif
1222
1223#endif
1224
1225
1226
1227
1228
1229
1230
1231
1232#if defined I_MPC8XX
1233
1234#define MSF_COMPONENT_VAR 0
1235#define MSF_COMPONENT_ID 0
1236#define MSF_COMPONENT_MAJOR_VER 1
1237#define MSF_COMPONENT_MINOR_VER 0
1238
1239#define HCF_HSI_VAR 1
1240
1241#define HCF_BIG_ENDIAN 1
1242#define HCF_IO HCF_IO_MEM
1243
1244#include "o_portbl.h"
1245#include "ipcmcia.h"
1246typedef o_uint8_t hcf_8;
1247typedef o_uint16_t hcf_16;
1248typedef o_uint32_t hcf_32;
1249
1250
1251
1252
1253#ifdef _lint
1254#else
1255asm hcf_16 IN_PORT_WORD(int port)
1256{
1257% reg port
1258 lhbrx r3,r0,port
1259 eieio
1260}
1261#endif
1262
1263
1264#ifdef _lint
1265#else
1266asm void OUT_PORT_WORD(int port, hcf_16 value)
1267{
1268% reg port, value
1269 sthbrx value,r0,port
1270 eieio
1271}
1272#endif
1273
1274
1275
1276#define IN_PORT_STRING_16(port, addr, len) \
1277 { \
1278 unsigned l = (len); \
1279 hcf_16 *d = (volatile hcf_16 *)(addr); \
1280 while (l--) \
1281 { \
1282 *d++ = *(volatile hcf_16 *)(port); \
1283 EIEIO(); \
1284 } \
1285 }
1286
1287#define OUT_PORT_STRING_16(port, addr, len) \
1288 { \
1289 unsigned l = (len); \
1290 hcf_16 *s = (volatile hcf_16 *)(addr); \
1291 while (l--) \
1292 { \
1293 *(volatile hcf_16 *)(port) = *s++; \
1294 EIEIO(); \
1295 } \
1296 }
1297
1298#endif
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308#if defined _AM29K
1309
1310#define MSF_COMPONENT_VAR 0
1311#define MSF_COMPONENT_ID COMP_ID_AP1
1312#define MSF_COMPONENT_MAJOR_VER 1
1313#define MSF_COMPONENT_MINOR_VER 0
1314
1315#define HCF_BIG_ENDIAN 1
1316#define HCF_IO HCF_IO_MEM
1317
1318#define SwapBytes(t) (((t) >> 8) + (((t) & 0xff) << 8))
1319
1320#if defined __ppc
1321 #ifndef __GNUC__
1322 #define __asm__ asm
1323 #endif
1324
1325 #if ! defined _lint
1326 #define EIEIO() __asm__(" eieio")
1327 #else
1328 #define EIEIO()
1329 #endif
1330
1331 static hcf_16 IN_PORT_WORD(int port) {
1332 hcf_16 value = *(volatile hcf_16 *)(port); EIEIO();
1333 value = SwapBytes(value);
1334 return value;
1335 }
1336
1337 #define OUT_PORT_WORD(port, value) \
1338 { *(volatile hcf_16 *)(port) = SwapBytes(value); EIEIO(); }
1339#else
1340 #define IN_PORT_WORD(port) (*(volatile hcf_16 *)(port))
1341 #define OUT_PORT_WORD(port, value) (*(volatile hcf_16 *)(port) = (value))
1342#endif
1343
1344
1345
1346#define IN_PORT_STRING_16( port, addr, len) { \
1347 unsigned l = (len); \
1348 hcf_16 t, *d = (volatile hcf_16 *)(addr); \
1349 while (l--) { \
1350 t = IN_PORT_WORD(port); \
1351 *d++ = SwapBytes(t); \
1352 } \
1353 }
1354
1355#define OUT_PORT_STRING_16( port, addr, len) { \
1356 unsigned l = (len); \
1357 hcf_16 t, *s = (volatile hcf_16 *)(addr); \
1358 while (l--) { \
1359 t = *s++; \
1360 OUT_PORT_WORD(port, SwapBytes(t)); \
1361 } \
1362 }
1363
1364#if PRODUCT == 9150
1365 #define HCF_ASSERT HCF_ASSERT_MB
1366 #undef MSF_COMPONENT_ID
1367#endif
1368
1369#endif
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379#if defined CPU
1380#if CPU == PPC860
1381
1382#define MSF_COMPONENT_VAR 0
1383#define MSF_COMPONENT_ID 0
1384#define MSF_COMPONENT_MAJOR_VER 1
1385#define MSF_COMPONENT_MINOR_VER 0
1386
1387#define HCF_BIG_ENDIAN 1
1388#define HCF_IO HCF_IO_MEM
1389
1390#define SwapBytes(t) (((t) >> 8) + (((t) & 0xff) << 8))
1391
1392#ifndef __GNUC__
1393 #define __asm__ asm
1394#endif
1395
1396#if ! defined _lint
1397 #define EIEIO() __asm__(" eieio")
1398#else
1399 #define EIEIO()
1400#endif
1401
1402static hcf_16 IN_PORT_WORD(int port) {
1403 hcf_16 value = *(volatile hcf_16 *)(port); EIEIO();
1404 value = SwapBytes(value);
1405 return value;
1406 #ifdef __GNUC__
1407
1408
1409 (void)IN_PORT_WORD;
1410 #endif
1411}
1412
1413#define OUT_PORT_WORD(port, value) \
1414 { *(volatile hcf_16 *)(port) = SwapBytes(value); EIEIO(); }
1415
1416
1417
1418#define IN_PORT_STRING_16( port, addr, len) { \
1419 unsigned l = (len); \
1420 hcf_16 t; \
1421 volatile hcf_16 *d = (volatile hcf_16 *)(addr); \
1422 while (l--) { \
1423 t = IN_PORT_WORD(port); \
1424 *d++ = SwapBytes(t); \
1425 } \
1426 }
1427
1428#define OUT_PORT_STRING_16( port, addr, len) { \
1429 unsigned l = (len); \
1430 hcf_16 t; \
1431 volatile hcf_16 *s = (volatile hcf_16 *)(addr); \
1432 while (l--) { \
1433 t = *s++; \
1434 OUT_PORT_WORD(port, SwapBytes(t)); \
1435 } \
1436 }
1437
1438#if PRODUCT == 9150
1439 #define HCF_ASSERT HCF_ASSERT_MB
1440 #undef MSF_COMPONENT_ID
1441#endif
1442
1443#endif
1444#endif
1445
1446
1447
1448
1449
1450
1451
1452#if 0
1453
1454
1455
1456#define MSF_COMPONENT_VAR 0
1457#define MSF_COMPONENT_ID 0
1458#define MSF_COMPONENT_MAJOR_VER 1
1459#define MSF_COMPONENT_MINOR_VER 0
1460
1461extern int far inp( int );
1462extern void far outp( int, int );
1463extern int far inpw( int );
1464extern void far outpw( int, int );
1465
1466#define IN_PORT_WORD(port) ((hcf_16)inpw( (hcf_io)(port) ))
1467#define OUT_PORT_WORD(port, value) ((void)outpw( (hcf_io)(port), value ))
1468
1469#define IN_PORT_STRING_16( port, addr, len) { \
1470 unsigned l = (len); \
1471 hcf_16 *d = (hcf_16 *)(addr); \
1472 while (l--) *d++ = IN_PORT_WORD(port); \
1473 }
1474
1475#define OUT_PORT_STRING_16( port, addr, len) { \
1476 unsigned l = (len); \
1477 hcf_16 *s = (hcf_16 *)(addr); \
1478 while (l--) OUT_PORT_WORD(port, *s++); \
1479 }
1480#endif
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490#ifdef mc68302
1491
1492#define MSF_COMPONENT_ID COMP_ID_EC
1493
1494#include <version.h>
1495
1496#define MSF_COMPONENT_VAR 1
1497#define MSF_COMPONENT_MAJOR_VER MAJOR_VERSION
1498#define MSF_COMPONENT_MINOR_VER MINOR_VERSION
1499
1500#define HCF_BIG_ENDIAN 1
1501#define HCF_IO HCF_IO_MEM
1502
1503#define SwapBytes(t) (((t) >> 8) + (((t) & 0xff) << 8))
1504
1505#define PCMCIA_ADDRESS 0xc80000UL
1506
1507#define IN_PORT_2BYTES(port) (*(hcf_16 *)(port))
1508#if 0
1509static hcf_16 IN_PORT_WORD(hcf_32 port)
1510{
1511 hcf_16 word = IN_PORT_2BYTES(port);
1512 return SwapBytes(word);
1513}
1514#else
1515static hcf_16 swap_var;
1516#define IN_PORT_WORD(port) \
1517 (((swap_var = IN_PORT_2BYTES(port)) >> 8) + (((swap_var) & 0xff) << 8))
1518#endif
1519#define OUT_PORT_2BYTES(port, value) (*(hcf_16 *)(port) = (hcf_16)(value))
1520#define OUT_PORT_WORD(port, value) OUT_PORT_2BYTES(port, SwapBytes(value))
1521
1522
1523
1524
1525
1526
1527
1528
1529#endif
1530
1531
1532
1533
1534
1535
1536
1537#if defined __VX_WORKS__
1538
1539#if defined WLC_STATION
1540
1541#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA
1542#else
1543#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP
1544#endif
1545
1546#define HCF_YIELD (taskDelay(0) == 0)
1547
1548#define MSF_COMPONENT_VAR 1
1549#define MSF_COMPONENT_MAJOR_VER 1
1550#define MSF_COMPONENT_MINOR_VER 0
1551
1552
1553
1554#if defined PC486BSP
1555
1556#define IN_PORT_WORD(port) (sysInWord ((hcf_io)(port)))
1557#define OUT_PORT_WORD(port, value) (sysOutWord ((hcf_io)(port), (hcf_16) (value)))
1558#define IN_PORT_STRING_16(port, addr, n) (sysInWordString ((hcf_io)(port), addr, n))
1559#define OUT_PORT_STRING_16(port, addr, n) (sysOutWordString ((hcf_io)(port), addr, n))
1560
1561#elif defined AS2000BSP
1562
1563#define HCF_IO HCF_IO_MEM
1564
1565
1566unsigned short sysRead16( unsigned short *port );
1567void sysWrite16( unsigned short *port, unsigned short value );
1568
1569#define PCI_IN_BYTE( port ) \
1570 *(unsigned char *)( port )
1571
1572#define PCI_IN_WORD( port ) \
1573 sysRead16( (unsigned short *)( port ) )
1574
1575#define PCI_OUT_BYTE( port, value ) \
1576 *(unsigned char *)( port ) = (unsigned char)( value )
1577
1578#define PCI_OUT_WORD( port, value ) \
1579 sysWrite16( (unsigned short *)( port ), (unsigned short)( value ) )
1580
1581#define IN_PORT_WORD( port ) \
1582 PCI_IN_WORD( port )
1583
1584#define OUT_PORT_WORD( port, value ) \
1585 PCI_OUT_WORD( port, value )
1586
1587#define IN_PORT_STRING_16( port, buf, len ) \
1588 do { \
1589 hcf_16 *p; \
1590 \
1591 for ( p = (hcf_16 *)(buf); p < &( (hcf_16 *)(buf) )[ (int)len ]; p++ ) { \
1592 *p = PCI_IN_WORD( port ); \
1593 } \
1594 } while ( 0 )
1595
1596#define OUT_PORT_STRING_16( port, buf, len ) \
1597 do { \
1598 const hcf_16 *p; \
1599 \
1600 for ( p = (const hcf_16 *)( buf ); p < &( (const hcf_16 *)(buf) )[ (int)len ]; p++ ) { \
1601 PCI_OUT_WORD( port, *p ); \
1602 } \
1603 } while ( 0 )
1604
1605#elif defined FADS860BSP
1606
1607#define HCF_BIG_ENDIAN 1
1608
1609#define HCF_IO HCF_IO_MEM
1610
1611#ifndef __GNUC__
1612 #define __asm__ asm
1613#endif
1614
1615#if ! defined _lint
1616 #define EIEIO() __asm__(" eieio")
1617#else
1618 #define EIEIO()
1619#endif
1620
1621static hcf_16 IN_PORT_WORD(int port) {
1622 hcf_16 value = *(volatile hcf_16 *)(port); EIEIO();
1623 value = ((value & 0xff00) >> 8) + ((value & 0x00ff) << 8);
1624
1625 return value;
1626 #ifdef __GNUC__
1627
1628
1629 (void)IN_PORT_WORD;
1630 #endif
1631}
1632
1633#define OUT_PORT_WORD(port, value) \
1634 { *(volatile hcf_16 *)(port) = CNV_SHORT_TO_LITTLE(value); EIEIO(); }
1635
1636
1637
1638#define IN_PORT_STRING_16( port, addr, len) { \
1639 unsigned l = (len); \
1640 volatile hcf_16 *d = (volatile hcf_16 *)(addr); \
1641 while (l--) { \
1642 *d++ = *(volatile hcf_16 *)(port); \
1643 EIEIO(); \
1644 } \
1645 }
1646
1647#define OUT_PORT_STRING_16( port, addr, len) { \
1648 unsigned l = (len); \
1649 volatile hcf_16 *s = (volatile hcf_16 *)(addr); \
1650 while (l--) { \
1651 *(volatile hcf_16 *)(port) = *s++; \
1652 EIEIO(); \
1653 } \
1654 }
1655
1656#elif defined DAYTONABSP
1657
1658#define HCF_BIG_ENDIAN 1
1659
1660#define HCF_IO HCF_IO_MEM
1661
1662#ifndef __GNUC__
1663 #define __asm__ asm
1664#endif
1665
1666#define IN_PORT_WORD(port) (sysOrinocoInWord((unsigned long)(port)))
1667#define OUT_PORT_WORD(port,value) (sysOrinocoOutWord((unsigned long)(port), (unsigned short)(value)))
1668
1669#define IN_PORT_STRING_16(port,addr,len) (sysOrinocoInString((port), (addr), (len)))
1670#define OUT_PORT_STRING_16(port,addr,len) (sysOrinocoOutString((port), (addr), (len)))
1671
1672extern unsigned char sysOrinocoInByte (unsigned long port);
1673extern unsigned short sysOrinocoInWord (unsigned long port);
1674extern void sysOrinocoInString (unsigned long port, void *addr, unsigned short len);
1675
1676extern void sysOrinocoOutByte (unsigned long port, unsigned char value);
1677extern void sysOrinocoOutWord (unsigned long port, unsigned short value);
1678extern void sysOrinocoOutString (unsigned long port, void *addr, unsigned short len);
1679
1680#elif defined ALPHA_BSP
1681
1682#define HCF_BIG_ENDIAN 1
1683
1684#define HCF_IO HCF_IO_MEM
1685
1686#ifndef __GNUC__
1687 #define __asm__ asm
1688#endif
1689
1690#define IN_PORT_WORD(port) (sysOrinocoInWord((unsigned long)(port)))
1691#define OUT_PORT_WORD(port,value) (sysOrinocoOutWord((unsigned long)(port), (unsigned short)(value)))
1692
1693#define IN_PORT_STRING_16(port,addr,len) (sysOrinocoInString((port), (addr), (len)))
1694#define OUT_PORT_STRING_16(port,addr,len) (sysOrinocoOutString((port), (addr), (len)))
1695
1696extern unsigned char sysOrinocoInByte (unsigned long port);
1697extern unsigned short sysOrinocoInWord (unsigned long port);
1698extern void sysOrinocoInString (unsigned long port, void *addr, unsigned short len);
1699
1700extern void sysOrinocoOutByte (unsigned long port, unsigned char value);
1701extern void sysOrinocoOutWord (unsigned long port, unsigned short value);
1702extern void sysOrinocoOutString (unsigned long port, void *addr, unsigned short len);
1703
1704#else
1705
1706err:
1707
1708#endif
1709
1710#endif
1711
1712
1713
1714
1715
1716
1717#ifdef __VX_WORKS_SANDPOINT_824X__
1718
1719#include <vxWorks.h>
1720#include <sysLib.h>
1721#include <taskLib.h>
1722
1723#ifdef WVLAN_53
1724#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA
1725#endif
1726
1727#ifdef WVLAN_54
1728#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP
1729#endif
1730
1731#ifdef WVLAN_56
1732#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_END
1733#endif
1734
1735#if !defined MSF_COMPONENT_ID
1736#error "you must define an MSF component ID: WVLAN_53, WVLAN_54, WVLAN_56"
1737#endif
1738
1739#define MSF_COMPONENT_VAR 1
1740
1741#define HCF_EXT HCF_EXT_INFO_LOG
1742#define HCF_SLEEP ( HCF_CDS | HCF_DDS )
1743
1744
1745#ifndef HCF_ACT_WAKEUP
1746#define HCF_ACT_WAKEUP 0x1D
1747#endif
1748
1749#if defined FATNIC | defined BEAGLE_H253
1750#define T1__HCF_TYPE HCF_TYPE_STA
1751#else
1752#define T1__HCF_TYPE HCF_TYPE_AP | HCF_TYPE_STA
1753#endif
1754
1755#ifdef HERMES_USB
1756#define T2__HCF_TYPE (T1__HCF_TYPE | HCF_TYPE_USB)
1757#else
1758#define T2__HCF_TYPE (T1__HCF_TYPE)
1759#endif
1760
1761#ifdef _WARP
1762#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5)
1763#else
1764#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_WPA | HCF_TYPE_HII)
1765#endif
1766
1767#ifdef _CCX
1768#define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX)
1769#else
1770#define T4__HCF_TYPE (T3__HCF_TYPE)
1771#endif
1772
1773#define T5__HCF_TYPE (T4__HCF_TYPE)
1774
1775
1776#define HCF_TYPE (T5__HCF_TYPE )
1777
1778
1779
1780#define MSF_COMPONENT_MAJOR_VER 2
1781#define MSF_COMPONENT_MINOR_VER 0
1782
1783#define HCF_IO HCF_IO_MEM
1784#define HCF_DMA 0
1785#define HCF_MEM_IO 1
1786#define HCF_BIG_ENDIAN 1
1787
1788
1789
1790#define IN_PORT_WORD(port) (sysInWord( (hcf_io)(port) ))
1791#define OUT_PORT_WORD(port, value) (sysOutWord( (hcf_io)(port), (hcf_16)(value) ))
1792#define IN_PORT_DWORD(port) (sysInLong( (hcf_io)(port) ))
1793#define OUT_PORT_DWORD(port, value) (sysOutLong( (hcf_io)(port), (hcf_16)(value) ))
1794#define IN_PORT_STRING_16(port, dst, n) (sysInWordString((hcf_io)(port), (hcf_16 *)dst, n))
1795#define OUT_PORT_STRING_16(port, src, n) (sysOutWordString((hcf_io)(port), (hcf_16 *)src, n))
1796
1797#ifdef WVLAN_DEBUG
1798#define DBG 1
1799#define _DEBUG 1
1800#endif
1801
1802
1803#define OUTPUTDEBUGMSG(dprintf_exp)
1804#define ASSERTDEBUGMSG(cond, dprintf_exp)
1805
1806#define HCF_INTERFACE_CONNECT(ifbp)
1807#define HCF_INTERFACE_DISCONNECT(ifbp)
1808#define HCF_ENTER_INTERFACE_FUNCT(ibfb)
1809#define HCF_LEAVE_INTERFACE_FUNCT(ifbp)
1810
1811#define CNV_END_INT(w) ( ((hcf_16)(w) & 0x00FF) << 8 | ((hcf_16)(w) & 0xFF00) >> 8 )
1812#define CNV_LITTLE_TO_INT(w) CNV_END_INT(w)
1813#define CNV_INT_TO_LITTLE(w) CNV_LITTLE_TO_INT(w)
1814
1815#endif
1816
1817
1818
1819
1820#if defined( IPT_T8300 ) || defined( IPT_T8307 )
1821
1822#include <vxWorks.h>
1823#include <sysLib.h>
1824#include <taskLib.h>
1825
1826#define HCF_ALIGN 4
1827
1828#define BEAGLE_H253
1829#define OOR_DDS
1830#define FATNIC
1831
1832
1833#ifdef WVLAN_53
1834#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA
1835#endif
1836
1837#ifdef WVLAN_54
1838#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP
1839#endif
1840
1841#ifdef WVLAN_56
1842#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_END
1843#endif
1844
1845#if !defined MSF_COMPONENT_ID
1846#error "you must define an MSF component ID: WVLAN_53, WVLAN_54, WVLAN_56"
1847#endif
1848
1849#define MSF_COMPONENT_VAR 1
1850
1851#define HCF_EXT HCF_EXT_INFO_LOG
1852
1853#define HCF_SLEEP ( HCF_CDS | HCF_DDS )
1854
1855
1856#ifndef HCF_ACT_WAKEUP
1857#define HCF_ACT_WAKEUP 0x1D
1858#endif
1859
1860#if defined FATNIC || defined BEAGLE_H253
1861#define T1__HCF_TYPE HCF_TYPE_STA
1862#else
1863
1864#define T1__HCF_TYPE HCF_TYPE_STA
1865#endif
1866
1867#ifdef HERMES_USB
1868#define T2__HCF_TYPE (T1__HCF_TYPE | HCF_TYPE_USB)
1869#else
1870#define T2__HCF_TYPE (T1__HCF_TYPE)
1871#endif
1872
1873#ifdef _WARP
1874#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5)
1875#else
1876#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_WPA | HCF_TYPE_HII)
1877
1878#endif
1879
1880#ifdef _CCX
1881#define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX)
1882#else
1883#define T4__HCF_TYPE (T3__HCF_TYPE)
1884#endif
1885
1886#define T5__HCF_TYPE (T4__HCF_TYPE)
1887
1888
1889#define HCF_TYPE (T5__HCF_TYPE )
1890
1891
1892#define MSF_COMPONENT_MAJOR_VER 2
1893#define MSF_COMPONENT_MINOR_VER 0
1894
1895#define HCF_IO HCF_IO_MEM
1896#define HCF_DMA 0
1897#define HCF_MEM_IO 1
1898
1899
1900
1901#if (_BYTE_ORDER == _BIG_ENDIAN)
1902#undef HCF_LITTLE_ENDIAN
1903#define HCF_BIG_ENDIAN 1
1904#endif
1905
1906
1907#define CNV_END(w) ( ((hcf_16)(w) & 0x00FF) << 8 | ((hcf_16)(w) & 0xFF00) >> 8 )
1908#if defined HCF_BIG_ENDIAN
1909
1910#define CNV_LITTLE_TO_INT(w) CNV_END(w)
1911#define CNV_BIG_TO_INT(w) (w)
1912#else
1913
1914#define CNV_LITTLE_TO_INT(w) (w)
1915#define CNV_BIG_TO_INT(w) CNV_END(w)
1916#endif
1917
1918
1919#define CNV_INT_TO_LITTLE(w) CNV_LITTLE_TO_INT(w)
1920#define CNV_INT_TO_BIG(w) CNV_BIG_TO_INT(w)
1921
1922
1923
1924#define IN_PORT_WORD( port ) *((volatile hcf_16 *)( port ))
1925#define OUT_PORT_WORD( port, value ) *((volatile hcf_16 *)( port )) = ((hcf_16)( value ))
1926
1927
1928#define IN_PORT_STRING( port, addr, len) { \
1929 unsigned l = len; \
1930 hcf_16 *d = (hcf_16 *)(addr); \
1931 hcf_16 t; \
1932 while (l--) { \
1933 t = IN_PORT_WORD(port); \
1934 *d++ = CNV_LITTLE_TO_INT(t); \
1935 } \
1936}
1937
1938#define OUT_PORT_STRING( port, addr, len) { \
1939 unsigned l = (len); \
1940 hcf_16 *s = (hcf_16 *)(addr); \
1941 hcf_16 t; \
1942 while (l--) { \
1943 t = *s++; \
1944 t = CNV_LITTLE_TO_INT(t); \
1945 OUT_PORT_WORD(port, t); \
1946 } \
1947}
1948
1949#define IN_PORT_STRING_16(port, dst, n) { \
1950 unsigned l = (n); \
1951 hcf_16 *d = (hcf_16 *)(dst); \
1952 while (l--) { \
1953 *d++ = IN_PORT_WORD(port); \
1954 } \
1955}
1956
1957#define OUT_PORT_STRING_16(port, src, n) { \
1958 hcf_16 t; \
1959 int l = (n); \
1960 hcf_16 *s = (hcf_16 *)(src); \
1961 while (l--) { \
1962 t = *s++; \
1963 OUT_PORT_WORD(port, t); \
1964 } \
1965}
1966
1967
1968
1969
1970
1971#ifdef WVLAN_DEBUG
1972#define DBG 1
1973#define _DEBUG 1
1974#endif
1975
1976
1977#define OUTPUTDEBUGMSG(dprintf_exp)
1978#define ASSERTDEBUGMSG(cond, dprintf_exp)
1979
1980#define HCF_INTERFACE_CONNECT(ifbp)
1981#define HCF_INTERFACE_DISCONNECT(ifbp)
1982#define HCF_ENTER_INTERFACE_FUNCT(ibfb)
1983#define HCF_LEAVE_INTERFACE_FUNCT(ifbp)
1984
1985#define sysInWord(offsetAddr) IN_PORT_WORD(offsetAddr)
1986#define sysInByte(offsetAddr) IN_PORT_BYTE(offsetAddr)
1987#define sysOutWord(addr, value) OUT_PORT_WORD(addr, value)
1988
1989#endif
1990
1991
1992
1993
1994#if ! defined HCF_ALIGN
1995#define HCF_ALIGN 1
1996#endif
1997
1998#if ! defined HCF_ASSERT
1999#define HCF_ASSERT 0
2000#endif
2001
2002#if ! defined HCF_BIG_ENDIAN
2003#define HCF_BIG_ENDIAN 0
2004#endif
2005
2006#if ! defined HCF_DL_ONLY
2007#define HCF_DL_ONLY 0
2008#endif
2009
2010#if ! defined HCF_DMA
2011#define HCF_DMA 0
2012#endif
2013
2014#if ! defined HCF_ENCAP
2015#define HCF_ENCAP HCF_ENC
2016#endif
2017
2018#if ! defined HCF_ENTRY
2019#define HCF_ENTRY( ifbp )
2020#endif
2021
2022#if ! defined HCF_EXIT
2023#define HCF_EXIT( ifbp )
2024#endif
2025
2026#if ! defined HCF_EXT
2027#define HCF_EXT 0
2028#endif
2029
2030#if ! defined HCF_INT_ON
2031#define HCF_INT_ON 1
2032#endif
2033
2034#if ! defined HCF_IO
2035#define HCF_IO 0
2036#endif
2037
2038#if ! defined HCF_LEGACY
2039#define HCF_LEGACY 0
2040#endif
2041
2042#if ! defined HCF_MAX_LTV
2043#define HCF_MAX_LTV 1200
2044#endif
2045
2046#if ! defined HCF_PROT_TIME
2047#define HCF_PROT_TIME 100
2048#endif
2049
2050#if ! defined HCF_SLEEP
2051#define HCF_SLEEP 0
2052#endif
2053
2054#if ! defined HCF_TALLIES
2055#define HCF_TALLIES ( HCF_TALLIES_NIC | HCF_TALLIES_HCF )
2056#endif
2057
2058#if ! defined HCF_TYPE
2059#define HCF_TYPE 0
2060#endif
2061
2062#if HCF_BIG_ENDIAN
2063#undef HCF_BIG_ENDIAN
2064#define HCF_BIG_ENDIAN 1
2065#endif
2066
2067#if HCF_DL_ONLY
2068#undef HCF_DL_ONLY
2069#define HCF_DL_ONLY 1
2070#endif
2071
2072#if HCF_DMA
2073#undef HCF_DMA
2074#define HCF_DMA 1
2075#endif
2076
2077#if HCF_INT_ON
2078#undef HCF_INT_ON
2079#define HCF_INT_ON 1
2080#endif
2081
2082
2083#if ! defined IN_PORT_STRING_8_16
2084#define IN_PORT_STRING_8_16(port, addr, len) IN_PORT_STRING_16(port, addr, len)
2085#define OUT_PORT_STRING_8_16(port, addr, len) OUT_PORT_STRING_16(port, addr, len)
2086#endif
2087
2088
2089
2090
2091
2092#if ! defined FAR
2093#define FAR
2094#endif
2095
2096typedef hcf_8 FAR *wci_bufp;
2097typedef hcf_16 FAR *wci_recordp;
2098
2099
2100
2101
2102
2103
2104
2105
2106#if HCF_IO & HCF_IO_MEM
2107typedef hcf_32 hcf_io;
2108#else
2109typedef hcf_16 hcf_io;
2110#endif
2111
2112#if HCF_PROT_TIME > 128
2113#define HCF_PROT_TIME_SHFT 3
2114#define HCF_PROT_TIME_DIV 8
2115#elif HCF_PROT_TIME > 64
2116#define HCF_PROT_TIME_SHFT 2
2117#define HCF_PROT_TIME_DIV 4
2118#elif HCF_PROT_TIME > 32
2119#define HCF_PROT_TIME_SHFT 1
2120#define HCF_PROT_TIME_DIV 2
2121#else
2122#define HCF_PROT_TIME_SHFT 0
2123#define HCF_PROT_TIME_DIV 1
2124#endif
2125
2126#define HCF_PROT_TIME_CNT (HCF_PROT_TIME / HCF_PROT_TIME_DIV)
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144#if defined MSF_COMPONENT_ID
2145
2146#if ! defined DUI_COMPAT_VAR
2147#define DUI_COMPAT_VAR MSF_COMPONENT_ID
2148#endif
2149
2150#if ! defined DUI_COMPAT_BOT
2151#define DUI_COMPAT_BOT 8
2152#endif
2153
2154#if ! defined DUI_COMPAT_TOP
2155#define DUI_COMPAT_TOP 8
2156#endif
2157
2158#endif
2159
2160#if (HCF_TYPE) & HCF_TYPE_HII5
2161
2162#if ! defined HCF_HSI_VAR_5
2163#define HCF_HSI_VAR_5
2164#endif
2165
2166#if ! defined HCF_APF_VAR_4
2167#define HCF_APF_VAR_4
2168#endif
2169
2170#if (HCF_TYPE) & HCF_TYPE_WARP
2171#if ! defined HCF_STA_VAR_4
2172#define HCF_STA_VAR_4
2173#endif
2174#else
2175#if ! defined HCF_STA_VAR_2
2176#define HCF_STA_VAR_2
2177#endif
2178#endif
2179
2180#if defined HCF_HSI_VAR_4
2181err: HSI variants 4 correspond with HII;
2182#endif
2183
2184#else
2185
2186#if ! defined HCF_HSI_VAR_4
2187#define HCF_HSI_VAR_4
2188#endif
2189
2190#if ! defined HCF_APF_VAR_2
2191#define HCF_APF_VAR_2
2192#endif
2193
2194#if ! defined HCF_STA_VAR_2
2195#define HCF_STA_VAR_2
2196#endif
2197
2198#endif
2199
2200#if ! defined HCF_PRI_VAR_3
2201#define HCF_PRI_VAR_3
2202#endif
2203
2204#if defined HCF_HSI_VAR_1 || defined HCF_HSI_VAR_2 || defined HCF_HSI_VAR_3
2205err: HSI variants 1, 2 and 3 correspond with H-I only;
2206#endif
2207
2208#if defined HCF_PRI_VAR_1 || defined HCF_PRI_VAR_2
2209err: primary variants 1 and 2 correspond with H-I only;
2210#endif
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227#if ! defined BASED
2228#define BASED
2229#endif
2230
2231#if ! defined EXTERN_C
2232#ifdef __cplusplus
2233#define EXTERN_C extern "C"
2234#else
2235#define EXTERN_C
2236#endif
2237#endif
2238
2239#if ! defined NULL
2240#define NULL ((void *) 0)
2241#endif
2242
2243#if ! defined TEXT
2244#define TEXT(x) x
2245#endif
2246
2247#if !defined _TCHAR_DEFINED
2248#define TCHAR char
2249#endif
2250
2251
2252
2253
2254#if defined HCF_LITTLE_ENDIAN
2255err: HCF_LITTLE_ENDIAN is obsolete;
2256#endif
2257
2258#if defined HCF_INT_OFF
2259err: HCF_INT_OFF is obsolete;
2260#endif
2261
2262#if HCF_ALIGN != 1 && HCF_ALIGN != 2 && HCF_ALIGN != 4 && HCF_ALIGN != 8
2263err: invalid value for HCF_ALIGN;
2264#endif
2265
2266#if (HCF_ASSERT) & ~( HCF_ASSERT_PRINTF | HCF_ASSERT_SW_SUP | HCF_ASSERT_MB | HCF_ASSERT_RT_MSF_RTN | \
2267 HCF_ASSERT_LNK_MSF_RTN )
2268err: invalid value for HCF_ASSERT;
2269#endif
2270
2271#if (HCF_ASSERT) & HCF_ASSERT_MB && ! ( (HCF_EXT) & HCF_EXT_MB )
2272err: these macros are not used consistently;
2273#endif
2274
2275#if HCF_BIG_ENDIAN != 0 && HCF_BIG_ENDIAN != 1
2276err: invalid value for HCF_BIG_ENDIAN;
2277#endif
2278
2279#if HCF_DL_ONLY != 0 && HCF_DL_ONLY != 1
2280err: invalid value for HCF_DL_ONLY;
2281#endif
2282
2283#if HCF_DMA != 0 && HCF_DMA != 1
2284err: invalid value for HCF_DMA;
2285#endif
2286
2287#if (HCF_ENCAP) & ~( HCF_ENC | HCF_ENC_SUP )
2288err: invalid value for HCF_ENCAP;
2289#endif
2290
2291#if (HCF_EXT) & ~( HCF_EXT_INFO_LOG | HCF_EXT_INT_TX_EX | HCF_EXT_TALLIES_FW | HCF_EXT_TALLIES_HCF | \
2292 HCF_EXT_NIC_ACCESS | HCF_EXT_MB | HCF_EXT_INT_TICK | \
2293 HCF_EXT_IFB_STRCT | HCF_EXT_DESC_STRCT | HCF_EXT_TX_CONT )
2294err: invalid value for HCF_EXT;
2295#endif
2296
2297#if HCF_INT_ON != 0 && HCF_INT_ON != 1
2298err: invalid value for HCF_INT_ON;
2299#endif
2300
2301#if (HCF_IO) & ~( HCF_IO_MEM | HCF_IO_32BITS )
2302err: invalid value for HCF_IO;
2303#endif
2304
2305#if HCF_LEGACY != 0 && HCF_LEGACY != 1
2306err: invalid value for HCF_LEGACY;
2307#endif
2308
2309#if HCF_MAX_LTV < 16 || HCF_MAX_LTV > 2304
2310err: invalid value for HCF_MAX_LTV;
2311#endif
2312
2313#if HCF_PROT_TIME != 0 && ( HCF_PROT_TIME < 19 || 256 < HCF_PROT_TIME )
2314err: below minimum .08 second required by Hermes or possibly above hcf_32 capacity;
2315#endif
2316
2317#if (HCF_SLEEP) & ~( HCF_CDS | HCF_DDS )
2318err: invalid value for HCF_SLEEP;
2319#endif
2320
2321#if (HCF_SLEEP) && ! (HCF_INT_ON)
2322err: these macros are not used consistently;
2323#endif
2324
2325#if (HCF_SLEEP) && ! ( (HCF_EXT) & HCF_EXT_INT_TICK )
2326
2327#endif
2328
2329#if (HCF_TALLIES) & ~( HCF_TALLIES_HCF | HCF_TALLIES_NIC | HCF_TALLIES_RESET ) || \
2330 (HCF_TALLIES) == HCF_TALLIES_RESET
2331err: invalid value for HCF_TALLIES;
2332#endif
2333
2334#if (HCF_TYPE) & ~(HCF_TYPE_WPA | HCF_TYPE_USB | HCF_TYPE_PRELOADED | HCF_TYPE_HII5 | HCF_TYPE_WARP | \
2335 HCF_TYPE_CCX )
2336err: invalid value for HCF_TYPE;
2337#endif
2338
2339#if (HCF_TYPE) & HCF_TYPE_WARP && (HCF_TYPE) & HCF_TYPE_WPA
2340err: at most 1 of these macros should be defined;
2341#endif
2342
2343#endif
2344
2345