summaryrefslogtreecommitdiff
path: root/network/wlan/WDI/HEADER/PlatformDef.h
blob: a8f4fb550181ad63c6881b0d6e0c1bed13522f02 (plain)
1
2
3
4
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
#ifndef __INC_PLATFORMDEF_H
#define __INC_PLATFORMDEF_H

// Forward declaration.
typedef struct _RT_FILE_HANDLER RT_FILE_HANDLER, *PRT_FILE_HANDLER;

typedef enum _PRE_AUTH_INDICATION_REASON  PRE_AUTH_INDICATION_REASON;  //xcode c++ compiler error

typedef struct _ADAPTER ADAPTER, *PADAPTER;

//

// If the destination buffer size is smaller than the source, only copy the last string to destination.
#define	COPY_ANSI_LAST_STRING(__pDest, __MaxSize, __pSource)	\
	memcpy(__pDest, &(__pSource[(strlen(__pSource) > (__MaxSize - 1)) ? (strlen(__pSource) - (__MaxSize - 1)) : 0]), (strlen(__pSource) > (__MaxSize - 1)) ? (__MaxSize - 1) : strlen(__pSource) + 1)

// =================================================================================== 
//      Define RT_EVENT for all platform here
// ===================================================================================
	typedef NDIS_EVENT	RT_EVENT;
	#define	PLATFORM_INIT_RT_EVENT(__RtEvent)					NdisInitializeEvent(&(__RtEvent))
	#define	PLATFORM_FREE_RT_EVENT(__RtEvent)				// No Need to Free the Event in Windows
	#define	PLATFORM_SET_RT_EVENT(__RtEvent)					NdisSetEvent(&(__RtEvent))
	#define	PLATFORM_RESET_RT_EVENT(__RtEvent)				NdisResetEvent(&(__RtEvent))
	#define	PLATFORM_WAIT_RT_EVENT(__RtEvent, __MsToWait)	NdisWaitEvent(&(__RtEvent), (__MsToWait))

// ===================================================================================


// =================================================================================== 
//      Define RT_SPIN_LOCK for all platform here
// ===================================================================================

	typedef NDIS_SPIN_LOCK	RT_SPIN_LOCK;
	#define	PLATFORM_INIT_RT_SPINLOCK(__RtSpinLock)		NdisAllocateSpinLock(&(__RtSpinLock))
	#define	PLATFORM_FREE_RT_SPINLOCK(__RtSpinLock)		NdisFreeSpinLock(&(__RtSpinLock))
	#define	PLATFORM_ACQUIRE_RT_SPINLOCK(__RtSpinLock)	NdisAcquireSpinLock(&(__RtSpinLock))
	#define	PLATFORM_RELEASE_RT_SPINLOCK(__RtSpinLock)	NdisReleaseSpinLock(&(__RtSpinLock))
	
// ===================================================================================



#define		RT_SSID_LENGTH				36


	#define PlatformEFIOWrite1Byte(_a,_b,_c)		\
			PlatformIOWrite1Byte(_a,WLAN_IOREG_DEVICE_ID,_b,_c)
	#define PlatformEFIOWrite2Byte(_a,_b,_c)		\
			PlatformIOWrite2Byte(_a,WLAN_IOREG_DEVICE_ID,_b,EF2Byte(_c))
	#define PlatformEFIOWrite4Byte(_a,_b,_c)		\
			PlatformIOWrite4Byte(_a,WLAN_IOREG_DEVICE_ID,_b,EF4Byte(_c))
	#define PlatformEFIOSyncWriteNByte(_a,_b,_c,_d)		\
			PlatformIOSyncWriteNByte(_a,WLAN_IOREG_DEVICE_ID,_b,_c,_d)		

	
		#define PlatformEFIORead1Byte(_a,_b)		\
				PlatformIORead1Byte(_a,WLAN_IOREG_DEVICE_ID,_b)
		#define PlatformEFIORead2Byte(_a,_b)		\
				EF2Byte(PlatformIORead2Byte(_a,WLAN_IOREG_DEVICE_ID,_b))
		#define PlatformEFIORead4Byte(_a,_b)		\
				EF4Byte(PlatformIORead4Byte(_a,WLAN_IOREG_DEVICE_ID,_b))
		#define PlatformEFIOReadNByte(_a,_b,_c,_d)		\
				PlatformIOReadNByte(_a,WLAN_IOREG_DEVICE_ID,_b,_c,_d)
	
#define GET_SHARED_MEMORY_WITH_OFFSET(_src, _dest, _offset, _length)		\
			(_dest)->VirtualAddress=(_src)->VirtualAddress + (_offset);			\
			(_dest)->PhysicalAddressHigh=(_src)->PhysicalAddressHigh;			\
			(_dest)->PhysicalAddressLow=(_src)->PhysicalAddressLow + (_offset);	\
			if ((_dest)->PhysicalAddressLow < (_src)->PhysicalAddressLow)			\
				(_dest)->PhysicalAddressHigh++;								\
			(_dest)->Length=(_length);

#define MAKE_SHARED_MEMORY_OFFSET_AT_FRONT(_buf, _offset)				\
			{																\
				u4Byte AddrLow;												\
				AddrLow=(_buf)->PhysicalAddressLow;							\
				(_buf)->VirtualAddress +=_offset;								\
				(_buf)->PhysicalAddressLow += _offset;							\
				if((_buf)->PhysicalAddressLow < AddrLow)						\
					(_buf)->PhysicalAddressHigh++;								\
				(_buf)->Length-=_offset;										\
			}

#define RT_TIMER_STATUS_INITIALIZED		BIT0
#define RT_TIMER_STATUS_SET				BIT1
#define RT_TIMER_STATUS_PERIODIC		BIT2
#define RT_TIMER_STATUS_FIRED			BIT3 // This timer had been fired.
#define RT_TIMER_STATUS_CANCEL_NG		BIT4 // Timer cannot be canceled.
#define	RT_TIMER_STATUS_RELEASED		BIT5 // TImer had been released.
#define RT_TIMER_STATUS_SUSPENDED		BIT6 // Timer has been canceled and suspended till resumption


#define RT_THREAD_STATUS_INITIALIZED		BIT0
#define RT_THREAD_STATUS_SET			BIT1
#define RT_THREAD_STATUS_PERIODIC		BIT2
#define RT_THREAD_STATUS_FIRED			BIT3 // This timer had been fired.
#define RT_THREAD_STATUS_CANCEL			BIT4 // Timer cannot be canceled.
#define RT_THREAD_STATUS_CANCEL_NG		BIT5 // Timer cannot be canceled.
#define RT_THREAD_STATUS_RELEASED		BIT6 // TImer had been released.


typedef  	UCHAR	RT_THREAD_LEVEL;

#define RT_THREAD_LEVEL_PASSIVE		BIT0
#define RT_THREAD_LEVEL_APC			BIT1
#define RT_THREAD_LEVEL_DISPATCH	BIT2

//
// PlatformSleepUs() will put the thread into wait queue for specified period 
// in us and OS can reschedule now.
// So, we MUST make sure we are in proper context to use this function.
//

	#define PlatformSleepUs					NdisMSleep

	#define INT8_C(v)    (v)
	#define INT16_C(v)   (v)
	#define INT32_C(v)   (v)
	#define INT64_C(v)   (v)

	#define UINT8_C(v)   (v)
	#define UINT16_C(v)  (v)
	#define UINT32_C(v)  (v)
	#define UINT64_C(v)  (v)

	#define INTMAX_C(v)  (v)
	#define UINTMAX_C(v) (v)
	
	#define i64fmt		"I64"
	
// Macro for getting Ibss Addition IEs. By Bruce, 2007-08-13.

	#define	GetIbssAdditionalData(_pAdapter, _pOctetString)												\
			if(((_pAdapter)->pNdisCommon->dot11IbssParams.AdditionalIESize) < 0xFFFF)					\
			{																							\
				(_pOctetString)->Octet = (pu1Byte)((_pAdapter)->pNdisCommon->dot11IbssParams.AdditionalIEData);	\
				(_pOctetString)->Length = (u2Byte)((_pAdapter)->pNdisCommon->dot11IbssParams.AdditionalIESize);	\
			}																							\
			else																						\
			{																							\
				(_pOctetString)->Octet = NULL;															\
				(_pOctetString)->Length = 0;															\
			}

	#define GetIbssbJoinOnly(	_pAdapter)	(_pAdapter->pNdisCommon->dot11IbssParams.bDot11IbssJoinOnly)			
	//
	// Note:
	//	According to Ndis6 WDK, this default value should be "FALSE", and XP in DTM should be
	//	"TRUE" because it doesn't support this mode.
	// By Bruce, 2008-06-27.
	#define	DEFAULT_HIDDEN_SSID		(FALSE)

#ifndef PCI_TYPE1_ADDRESS
	#define PCI_CONF_ADDRESS   0x0CF8   // PCI Configuration Space Address 
	#define PCI_CONF_DATA		0x0CFC   // PCI Configuration Space Data 
#endif


// Place Holder for Private Data ---------------------
typedef u1Byte PRIVATE_DATA_ZONE;
// ---------------------------------------------

// Vaild Pairs ------------------------------------------------------------------
typedef struct _RT_VALID_PAIR_BOOLEAN
{
	BOOLEAN 	bVaild;
	BOOLEAN 	Data;
	
} RT_VALID_PAIR_BOOLEAN, *PRT_VALID_PAIR_BOOLEAN; 

typedef struct _RT_VALID_PAIR_U4BYTE
{
	BOOLEAN 	bVaild;
	u4Byte		Data;
	
} RT_VALID_PAIR_U4BYTE, *PRT_VALID_PAIR_U4BYTE;
// ---------------------------------------------------------------------------


typedef struct _MEMORY_BUFFER {
	pu1Byte	Buffer;
	u4Byte	Length;
}MEMORY_BUFFER, *PMEMORY_BUFFER;

typedef struct _VIRTUAL_MEMORY{
	PVOID				Ptr;
	u4Byte				Length;
}VIRTUAL_MEMORY,*PVIRTUAL_MEMORY;
	
typedef struct _PHYSICAL_MEMORY{
	u4Byte				AddressLow;
	u4Byte				AddressHigh;
	u4Byte				Length;
}PHYSICAL_MEMORY,*PPHYSICAL_MEMORY;

typedef struct _SHARED_MEMORY{
	pu1Byte			VirtualAddress;
	u4Byte			PhysicalAddressHigh;
	u4Byte			PhysicalAddressLow;
	u4Byte			Length;
}SHARED_MEMORY,*PSHARED_MEMORY;

typedef struct _ALIGNED_SHARED_MEMORY{
	SHARED_MEMORY	OriginalSharedMemory;
	pu1Byte			VirtualAddress;
	u4Byte			PhysicalAddressHigh;
	u4Byte			PhysicalAddressLow;
	u4Byte			Length;
}ALIGNED_SHARED_MEMORY,*PALIGNED_SHARED_MEMORY;



typedef VOID
(*RT_THREAD_CALL_BACK)(
	PVOID   Adapter
	);

typedef struct __RT_THREAD
{
	PADAPTER					Adapter;
	u1Byte					Status;
	PVOID					pPlatformExt;
	PVOID					pContext;
	RT_THREAD_CALL_BACK		CallbackFunc;	
	RT_THREAD_CALL_BACK		PreTheradExitCb;
	u2Byte					RefCnt;
	u2Byte					ScheduleCnt;	// only for debug information
	BOOLEAN					bEventTriger;
	char						szID[36]; 
	u1Byte					Argc;
	u1Byte					Argv[1];
}RT_THREAD, *PRT_THREAD;


typedef VOID
(*RT_TIMER_CALL_BACK)(
	PVOID			pRtTimer
	);

typedef struct _RT_TIMER{
	RT_TIMER_HANDLE		Handle; // Platform-dependent handle for this workitem, e.g. Ndis Workitem object.
	PVOID			Adapter; // Pointer to Adapter object.
	RT_TIMER_CALL_BACK	CallBackFunc; // Callback function of the workitem.
	u4Byte			Status; // Status of the timer. see RT_TIMER_STATUS_XXX for possible value.
	u4Byte			PreviousStatus; // Previous status of the timer, i.e., status before timer suspended
	u4Byte			msDelay; // The interval ms to call CallBackFunc after setting timer. Inialize as 0 and will be udpated when timer set.
	PVOID			Context; // Timer specific context.
	u2Byte			RefCnt; // Per timer scheduled counter. by Roger ,2007.04.27.
	u2Byte			TimerStallSlotCount; // For Timer stall checking mechanism. Added by Roger, 2007.04.27.
	char				szID[36]; // An identity string of this timer.
}RT_TIMER, *PRT_TIMER;

typedef VOID
(*RT_WORKITEM_CALL_BACK)(
	PVOID			pContext
	);

typedef struct _RT_WORK_ITEM
{
	RT_WORKITEM_HANDLE			Handle;			// Platform-dependent handle for this workitem, e.g. Ndis Workitem object.
	PVOID						Adapter;		// Pointer to Adapter object.
	PVOID						pContext;		// Parameter to passed to CallBackFunc(). 
	RT_WORKITEM_CALL_BACK		CallbackFunc;	// Callback function of the workitem.
	u1Byte						RefCount;		// 0: driver is going to unload, 1: No such workitem scheduled, 2: one workitem is schedueled. 
	PVOID						pPlatformExt;	// Pointer to platform-dependent extension.	
	BOOLEAN						bFree;
	char						szID[36];		// An identity string of this workitem.
}RT_WORK_ITEM, *PRT_WORK_ITEM;


typedef enum _RT_MEDIA_STATUS{
	RT_MEDIA_DISCONNECT = 0,
	RT_MEDIA_CONNECT       = 1
}RT_MEDIA_STATUS;


typedef enum _RT_SPINLOCK_TYPE{
	RT_TX_SPINLOCK = 1,
	RT_RX_SPINLOCK = 2,
	RT_RM_SPINLOCK = 3,
	RT_CAM_SPINLOCK = 4,
	RT_SCAN_SPINLOCK = 5,
	RT_LOG_SPINLOCK = 7, 
	RT_BW_SPINLOCK = 8,
	RT_CHNLOP_SPINLOCK = 9,
	RT_RF_OPERATE_SPINLOCK = 10,
	RT_INITIAL_SPINLOCK = 11,
	RT_RF_STATE_SPINLOCK = 12, // For RF state. Added by Bruce, 2007-10-30.
#if VISTA_USB_RX_REVISE
	RT_USBRX_CONTEXT_SPINLOCK = 13,
	RT_USBRX_POSTPROC_SPINLOCK = 14, // protect data of Adapter->IndicateW/ IndicateR
#endif
	//Shall we define Ndis 6.2 SpinLock Here ?
	RT_PORT_SPINLOCK=16,
	RT_H2C_SPINLOCK = 20, // For H2C cmd. Added by tynli. 2009.11.09.
	RT_IOTHREAD_SPINLOCK = 21,
	RT_BTData_SPINLOCK=25,

	RT_WAPI_OPTION_SPINLOCK=26,
	RT_WAPI_RX_SPINLOCK=27,

      // add for 92D CCK control issue  
	RT_CCK_PAGEA_SPINLOCK = 28,
	RT_BUFFER_SPINLOCK = 29,
	RT_CHANNEL_AND_BANDWIDTH_SPINLOCK = 30,
	RT_GEN_TEMP_BUF_SPINLOCK = 31,
	RT_AWB_SPINLOCK = 32,
	RT_FW_PS_SPINLOCK = 33,
	RT_HW_TIMER_SPIN_LOCK = 34,
	RT_MPT_WI_SPINLOCK = 35,
	RT_P2P_SPIN_LOCK = 36,	// Protect P2P context
	RT_DBG_SPIN_LOCK = 37,
	RT_IQK_SPINLOCK = 38,
	RT_PENDED_OID_SPINLOCK = 39,
	RT_CHNLLIST_SPINLOCK = 40,	
	RT_INDIC_SPINLOCK = 41,		//protect indication		
	RT_DRV_STATE_SPINLOCK = 42,
	RT_RFD_SPINLOCK = 43,	
	RT_ACS_SPINLOCK = 44,	// Auto Channel Switching
	RT_RX_REF_CNT_SPINLOCK = 45,
	RT_SYNC_IO_CNT_SPINLOCK = 46,
	RT_CUSTOM_SCAN_SPINLOCK = 47,
	RT_RX_CONTROL_SPINLOCK = 48,
	RT_RX_QUEUE_SPINLOCK = 49,
	RT_DYN_TXPWRTBL_SPINLOCK = 50,
	RT_LAST_SPINLOCK,
}RT_SPINLOCK_TYPE;

typedef enum _RT_EVENTLOG_TYPE{
	RT_FW_DOWLOAD_F = 0,
	RT_INIT_HANDLER_FAIL = 1,
	RT_INIT_FAIL = 2,
	RT_MUTUAL_AUTHENTICATION_FAIL=3,
	RT_INIT_OK			=4,
	RT_SCAN_START		=5,
	RT_SCAN_COMPLETE	=6,
	RT_SCAN_NUM		=7,
	RT_TKIP_MIC_ERROR	= 8,
	RT_HW_AIRPLANE_MODE_TRIGGERED = 9,
}RT_EVENTLOG_TYPE;

// DMA buffer catch sync diection
typedef enum _RT_DMA_DIRECTION {
	RT_DMA_BIDIRECTIONAL=0,
	RT_DMA_TO_DEVICE=1,
	RT_DMA_FROM_DEVICE=2,
	RT_DMA_NONE
} RT_DMA_DIRECTION, *PRT_DMA_DIRECTION;

typedef enum _RT_RX_INDICATION_LEVEL {
	RT_RX_INDICATION_DPC, 		//In a DPC
	RT_RX_INDICATION_GENERAL,	//Include DISPATCH/PASSIVE level
	RT_RX_INDICATION_RESUME		//WDI resume Rx
} RT_RX_INDICATION_LEVEL;

//
// Sinda, 20150511
// Redefine CCX_ASOC_REASON for prepare roaming type in Win10 to decide to skip scan from WDI or not.
//
typedef enum _RT_PREPARE_ROAM_TYPE{
	RT_PREPARE_ROAM_UNSPECIFIED = 0,
	RT_PREPARE_ROAM_NORMAL_ROAM_POOR_LINK = 1,
	RT_PREPARE_ROAM_NORMAL_ROAM_LOAD_BALANCING = 2,
	RT_PREPARE_ROAM_INSUFFICIENT_CAPACITY = 3,
	RT_PREPARE_ROAM_DIRECT_ROAM = 4,
	RT_PREPARE_ROAM_FIRST_ASSOCIATION = 5,
	RT_PREPARE_ROAM_ROAM_FROM_WAN = 6,
	RT_PREPARE_ROAM_ROAM_TO_WAN = 7,
	RT_PREPARE_ROAM_NORMAL_ROAM_BETTER_AP = 8,
	RT_PREPARE_ROAM_DEAUTH_DISASSOC = 9,
	RT_PREPARE_ROAM_NONE,
} RT_PREPARE_ROAM_TYPE, *PRT_PREPARE_ROAM_TYPE;


/*
 *	Note:	1. Each platform should have its implementation of all following functions.
 *			2. PlatformEFIOxxxxxxByte is used to read/write integer to hardware
 *			3. PlatformIOxxxxxxByte is used to read/write raw data
 *
*/

VOID
PlatformIOWrite1Byte(
	PVOID		Adapter,
	u1Byte		DeviceID,
	u4Byte		offset,
	u1Byte		data
	);

VOID
PlatformIOWrite2Byte(
	PVOID		Adapter,
	u1Byte		DeviceID,
	u4Byte		offset,
	u2Byte		data
	);

VOID
PlatformIOWrite4Byte(
	PVOID		Adapter,
	u1Byte		DeviceID,
	u4Byte		offset,
	u4Byte		data
	);

VOID
PlatformIOSyncWriteNByte(
	PVOID		Adapter,
	u1Byte		DeviceID,
	u4Byte		offset,
	u4Byte		count,
	pu1Byte		pdata
	);

VOID
PlatformIOWriteNByte(
	PVOID		Adapter,
	u1Byte		DeviceID,
	u4Byte		offset,
	u4Byte		count,
	pu1Byte		pdata
	);

u1Byte
PlatformIORead1Byte(
	PVOID		Adapter,
	u1Byte		DeviceID,
	u4Byte		offset
	);

u2Byte
PlatformIORead2Byte(
	PVOID		Adapter,
	u1Byte		DeviceID,
	u4Byte		offset
	);

u4Byte
PlatformIORead4Byte(
	PVOID		Adapter,
	u1Byte		DeviceID,
	u4Byte		offset
	);

VOID
PlatformIOReadNByte(
	IN	PVOID	Adapter,
	IN	u1Byte	DeviceID,
	IN	u4Byte	offset,
	IN	u4Byte	count,
	OUT pu1Byte	pBuffer
	);

RT_STATUS
PlatformAllocateMemoryWithTag(
	IN      PVOID		Adapter,
	IN      u4Byte      Tag,
	OUT     PVOID		*pPtr,
	IN      u4Byte		length
	);
    
VOID
PlatformFreeMemory(
	IN PVOID		ptr,
	IN u4Byte		length
	);

RT_STATUS
PlatformAllocateMemoryWithZero(
							   IN	PVOID		Adapter,
							   OUT	PVOID		*pPtr,
							   IN	u4Byte		length
							   );

#define RtDbgInitMem()
#define RtDbgDeinitMem()
#define	PlatformAllocateMemory(__Adapter, __Ptr, __Len) \
			PlatformAllocateMemoryWithTag(__Adapter, GenTag(__FUNCTION__), __Ptr, __Len)
#define	PlatformFreeMemory(ptr, length) \
			PlatformFreeMemory(ptr, length)			
#define	PlatformAllocateMemoryWithZero(__Adapter, __Ptr, __Len) \
			PlatformAllocateMemoryWithZero(__Adapter, __Ptr, __Len)



RT_STATUS
PlatformAllocateSharedMemory(
	PVOID				Adapter,
	PSHARED_MEMORY		pSharedMemory,
	u4Byte				length
	);

VOID
PlatformFreeSharedMemory(
	PVOID				Adapter,
	PSHARED_MEMORY		pSharedMemory
	);

RT_STATUS
PlatformAllocateAlignedSharedMemory(
	PVOID						Adapter,
	PALIGNED_SHARED_MEMORY	pAlignedSharedMemory,
	u4Byte						length
	);

VOID
PlatformFreeAlignedSharedMemory(
	PVOID						Adapter,
	PALIGNED_SHARED_MEMORY	pAlignedSharedMemory
	);

VOID
PlatformZeroMemory(
	PVOID		ptr,
	u4Byte		length
	);

VOID
PlatformMoveMemory(
	PVOID		pDest,
	PVOID		pSrc,
	u4Byte		length
	);

s4Byte
PlatformCompareMemory(
	PVOID		pBuf1,
	PVOID		pBuf2,
	u4Byte		length
	);

VOID
PlatformFillMemory(
	PVOID		Buf,
	u4Byte		Length,
	u1Byte		Fill
	);

VOID
PlatformStallExecution(
	u4Byte		usDelay
	);
VOID
PlatformForceStallExecution(
	u4Byte		usDelay
	);

#define PlatformAllocateAlignedDmaMemory		PlatformAllocateAlignedSharedMemory
#define PlatformFreeAlignedDmaMemory			PlatformFreeAlignedSharedMemory
#define PlatformDmaMapSingle
#define PlatformDmaUnMapSingle
#define smp_wmb()

//
// 2009/04/17 MH Vista timer has s strange condition. If we delay
// more than 50 us in dispatch level. Our driver will be scheduled out and
// then delay time will be more than what we require. For example, delay
// 100us, real delay time will be 15ms!!!
// Be carefule!!!!. We need to use a macro to execute the special delay
// process. If you use a function, Vista will also delay more than what you
// need. You need to plus a useless I/O operation to prevent the strange
// Vista scheduler behavior.
// We can fix SE IPS power on delay time from 200ms to 5ms.
// Test more than 4 days IPS and S3/S4 resume OK on 8 platforms..
//

#define	PLATFORM_STALLEXE_DISPATCH(pAdapter, usDelay)	\
{															\
	u1Byte		u1bTmp, i;									\
	for (i = 0; i < (usDelay/MAX_STALL_TIME); i++)				\
	{														\
		PlatformStallExecution(MAX_STALL_TIME-1);			\
		u1bTmp = PlatformEFIORead1Byte(pAdapter, 0x0);		\
	}														\
}


VOID
PlatformInitializeTimer(
	PVOID				Adapter,
	PRT_TIMER			pTimer,
	RT_TIMER_CALL_BACK	CallBackFunc, 
	PVOID				pContext,
	const char*				szID
	);

BOOLEAN
PlatformSetTimer(
	PVOID				Adapter,
	PRT_TIMER			pTimer,
	u4Byte				msDelay
	);

BOOLEAN
PlatformSetPeriodicTimer(
	PVOID				Adapter,
	PRT_TIMER			pTimer,
	u4Byte				msDelay
	);

BOOLEAN
PlatformCancelTimer(
	PVOID				Adapter,
	PRT_TIMER			pTimer
	);


BOOLEAN
PlatformReleaseTimer(
	PVOID				Adapter,
	PRT_TIMER			pTimer
	);
	
BOOLEAN
PlatformSuspendTimer(
	IN	PVOID				Adapter,
	IN	PRT_TIMER			pTimer
	);

BOOLEAN
PlatformResumeTimer(
	IN	PVOID				Adapter,
	IN	PRT_TIMER			pTimer
	);	

RT_STATUS
PlatformInitializeWorkItem(
	PVOID						Adapter,
	PRT_WORK_ITEM				pRtWorkItem,
	RT_WORKITEM_CALL_BACK		NdisWorkItemCallback,
	PVOID						pContext,
	const char*						szID
);

VOID
PlatformStartWorkItem(
	PRT_WORK_ITEM				pRtWorkItem
);

VOID
PlatformStopWorkItem(
	PRT_WORK_ITEM				pRtWorkItem
);

VOID
PlatformFreeWorkItem(
	PRT_WORK_ITEM				pRtWorkItem
);

BOOLEAN 
PlatformScheduleWorkItem(
	PRT_WORK_ITEM				pRtWorkItem
);

VOID
PlatformLeaveCallbackOfWorkItem(
	PRT_WORK_ITEM	pRtWorkItem
);
	
BOOLEAN
PlatformIsWorkItemScheduled(
	PRT_WORK_ITEM				pRtWorkItem
	);

u8Byte
PlatformGetCurrentTime(
	VOID
	);

VOID
_PlatformInitializeSpinLock(
	PVOID				Adapter,
	RT_SPINLOCK_TYPE	type
	);

VOID
_PlatformFreeSpinLock(
	PVOID				Adapter,
	RT_SPINLOCK_TYPE	type
	);

#pragma warning( disable: 28167 ) // Prefast says we don't annotated the change.
VOID
_IRQL_raises_(DISPATCH_LEVEL)
_PlatformAcquireSpinLock(
	PVOID				Adapter,
	RT_SPINLOCK_TYPE	type
	);

#pragma warning( disable: 28167 ) // Prefast says we don't annotated the change.
VOID
_IRQL_requires_(DISPATCH_LEVEL)
_PlatformReleaseSpinLock(
	PVOID				Adapter,
	RT_SPINLOCK_TYPE	type
	);

#define	RtDbgInitSpinlock()
#define RtDbgDeinitSpinlock()
#define	PlatformInitializeSpinLock(__Adapter, __Type)	\
			_PlatformInitializeSpinLock(__Adapter, __Type)
#define PlatformAcquireSpinLock(__Adapter, __Type)	\
            _PlatformAcquireSpinLock(__Adapter, __Type)
#define PlatformReleaseSpinLock(__Adapter, __Type)	\
			_PlatformReleaseSpinLock(__Adapter, __Type)
#define PlatformFreeSpinLock(__Adapter, __Type)	\
			_PlatformFreeSpinLock(__Adapter, __Type)


u4Byte
PlatformAtomicExchange(
	pu4Byte				target,
	u4Byte				newValue
	);

u4Byte
PlatformAtomicAnd(
	pu1Byte				target,
	u1Byte				value
	);

u4Byte
PlatformAtomicOr(
	pu1Byte				target,
	u1Byte				value
	);

VOID
PlatformInitializeMutex(
	IN PPlatformMutex	Mutex
	);
VOID
PlatformAcquireMutex(
	IN PPlatformMutex	Mutex
	);
VOID
PlatformReleaseMutex(
	IN PPlatformMutex	Mutex
	);
#define	RtDbgInitMutex()
#define RtDbgDeinitMutex()


VOID
PlatformIndicateMediaStatus(
	PVOID				Adapter,
	RT_MEDIA_STATUS	mstatus
	);

RT_STATUS
PlatformIndicateCustomStatus(
	IN	PADAPTER	pAdapter,
	IN	u4Byte		event,
	IN	u4Byte		target,
	IN	PVOID		pInfoBuffer,
	IN	u4Byte		InfoBruuferLen
	);

RT_STATUS
PlatformIndicateActionFrame(
	IN	PADAPTER		pAdapter,
	IN	PVOID			posMpdu
	);

VOID
PlatformIndicatePMWakeReason(
	IN PADAPTER		Adapter,
	IN BOOLEAN		bWakePacket,
	IN pu1Byte		pBuffer,
	IN u2Byte		BufferLen
	);

VOID
PlatformSetCheckForHangTimer(
	IN PADAPTER		Adapter
	);

VOID
PlatformHandleTKIPMICError(
	IN	PVOID			Adapter,
	IN	BOOLEAN			bMcstDest,
	IN	u1Byte			Keyidx,
	IN	pu1Byte			pSrcAddr
	);

VOID
PlatformHandleNLOnScanCancel(
	IN	PVOID			pvAdapter
);

VOID
PlatformHandleNLOnScanComplete(
	IN	PVOID			pvAdapter
);

VOID
PlatformHandleNLOnScanRequest(
	IN	PVOID			pvAdapter
);


VOID
PlatformHandlePwiseKeyUpdata(
	IN	PVOID				Adapter
);

VOID
PlatformRequestPreAuthentication(
	PVOID							Adapter,
	PRE_AUTH_INDICATION_REASON		Reason
	);

RT_STATUS
PlatformReadFile(
	IN		PVOID				Adapter,
	IN		UNICODE_STRING*		fileName,
	IN OUT	pu1Byte				pBufOfLines,
	IN		s4Byte				nMaxNumLine,
	IN		s4Byte				nMaxByteCntLine,
	OUT		ps4Byte				pnNumLinesRead
	);

RT_STATUS
PlatformOpenFile(
	IN		UNICODE_STRING*		fileName,
	IN OUT	HANDLE*				fileHandle
	);

RT_STATUS
PlatformMapFile(
	IN OUT	HANDLE*	fileHandle,
	OUT		u1Byte* contentBuffer,
	OUT		s4Byte* contentBufferLength
	);

VOID
PlatformUnMapFile(
	IN OUT	u1Byte* contentBuffer
	);

VOID
PlatformCloseFile(
	IN OUT	HANDLE* fileHandle
	);

RT_STATUS
PlatformReadAndMapFile(
	IN		UNICODE_STRING*		fileName,
	OUT		u1Byte*				outFileBuffer,
	OUT		u4Byte*				outFileBufferLength
	);

BOOLEAN
PlatformIsTxQueueAvailable(
	IN	PADAPTER	Adapter,
	IN	u1Byte		QueueID,
	IN	u2Byte		BufferCount);

VOID
PlatformReleaseDataFrameQueued(
	IN	PADAPTER	Adapter
	);

BOOLEAN
PlatformSetPMCSR(
	IN		PADAPTER	Adapter,
	IN 		u1Byte		value,
	IN		BOOLEAN		bTempSetting
	);

u4Byte
PlatformResetPciSpace(
	IN		PADAPTER	Adapter,
	IN 		u1Byte		Value
	);
	
BOOLEAN
PlatformSwitchClkReq(
	IN		PADAPTER	Adapter,
	IN 		u1Byte		value
	);

BOOLEAN
PlatformSwitchDevicePciASPM(
	IN		PADAPTER	Adapter,
	IN 		u1Byte		value
	);

VOID
PlatformSetPciConfiguration(
	IN		PADAPTER	Adapter
	);


VOID 
PlatformBackupPciCfgSpaceReg(
	IN	PADAPTER Adapter
	);


VOID 
PlatformRestorePciCfgSpaceReg(
	IN	PADAPTER Adapter
	);


VOID
PlatformEnableASPM(
	IN		PADAPTER	Adapter
	);

VOID
PlatformDisableASPM(
	IN		PADAPTER	Adapter
	);

VOID
PlatformDbgYB(
	IN		PADAPTER	Adapter,
	IN		u2Byte		Offset
	);


// Strange function declared here!!
BOOLEAN
PlatformEnable92CEDMA64(
	IN		PADAPTER	Adapter
	);

VOID
PlatformSetPciPMEEnable(
	IN		PADAPTER		Adapter	
	);

VOID
PlatformClearPciPMEStatus(
	IN		PADAPTER		Adapter	
	);

u4Byte
PlatformEnableMSIHandler(
	IN		PADAPTER	Adapter,
	IN 		u1Byte		Value
	);

VOID
PlatformInitializeEvent(
	IN 	PPlatformEvent	pEvent
	);

VOID
PlatformResetEvent(
	IN 	PPlatformEvent	pEvent
	);

VOID
PlatformSetEvent(
	IN	PPlatformEvent	pEvent
	);

VOID
PlatformFreeEvent(
	IN 	PPlatformEvent	pEvent
	);

BOOLEAN
PlatformWaitEvent(
	IN 	PPlatformEvent	pEvent,
	IN	u4Byte			msToWait
	);


#define	PlatformIndicateBTEvent(Adapter, pEvntData, dataLen)			RT_STATUS_FAILURE
#define	PlatformIndicateBTACLData(Adapter, pData, dataLen, EntryNum)	RT_STATUS_FAILURE
#define	PlatformProcessHCICommands(pContext)

u8Byte
PlatformDivision64(
	IN u8Byte	x,
	IN u8Byte	y
);

u8Byte
PlatformModular64(
	IN u8Byte	x,
	IN u8Byte	y
);

VOID
PlatformEnableNetworkMonitorMode(
	IN	PADAPTER	Adapter
	);

VOID
PlatformDisableNetworkMonitorMode(
	IN	PADAPTER	Adapter
	);

VOID
PlatformSetFwPsClkOffEvent(
	IN	PADAPTER	Adapter,
	IN	u1Byte		SetEvent
	);

RT_STATUS
PlatformInitializeThread(
	IN	PADAPTER			Adapter,
	IN	PRT_THREAD			pRtThread,
	IN	RT_THREAD_CALL_BACK	CallBackFunc, 
	IN	const char*			szID,
	IN	BOOLEAN				EventTriger,
	IN	u4Byte				Period,
	IN	PVOID				pContext
	);

RT_STATUS
PlatformInitializeThreadEx(
	IN	PADAPTER			Adapter,
	IN	PRT_THREAD			pRtThread,
	IN	RT_THREAD_CALL_BACK	CallBackFunc, 
	IN  RT_THREAD_CALL_BACK PreThreadExitCb,
	IN	const char*			szID,
	IN	BOOLEAN				EventTriger,
	IN	u4Byte				Period,
	IN	PVOID				pContext
	);

RT_STATUS
PlatformSetEventTrigerThread(
	IN	PADAPTER		Adapter,
	IN	PRT_THREAD	pRtThread,
	IN 	RT_THREAD_LEVEL 	Priority,
	IN	PVOID		pContext
    );

VOID
PlatformSetEventToTrigerThread(
	IN	PADAPTER		Adapter,
	IN	PRT_THREAD	pRtThread
);

VOID
PlatformWaitThreadEnd(
	IN	PADAPTER	pAdapter,
	IN	PRT_THREAD pRtThread);


VOID
PlatformCancelThread(
	IN	PADAPTER	pAdapter,
	IN	PRT_THREAD pRtThread);

RT_STATUS
PlatformRunThread(
	IN	PADAPTER		Adapter,
	IN	PRT_THREAD	pRtThread,
	IN 	RT_THREAD_LEVEL 	Priority,
	IN	PVOID		pContext
    );

VOID
PlatformReleaseThread(
	IN	PADAPTER	pAdapter,
	IN	PRT_THREAD pRtThread);


#define SEMA_UPBND	(0x7FFFFFFF)

VOID
PlatformInitializeSemaphore(	
	IN 	PPlatformSemaphore	Sema,
	IN	u4Byte	InitCnt
	);

RT_STATUS
PlatformAcquireSemaphore(	
	IN 	PPlatformSemaphore	Sema
	);

VOID
PlatformReleaseSemaphore(	
	IN 	PPlatformSemaphore	Sema
	);

VOID
PlatformFreeSemaphore(	
	IN 	PPlatformSemaphore	Sema
	);

VOID
PlatformCriticalSectionLeave(
							 IN PADAPTER			pAdapter,
							 IN PPlatformMutex	Mutex,
							 IN RT_SPINLOCK_TYPE	Spinlock
							 );
VOID
PlatformCriticalSectionEnter(
							 IN PADAPTER			pAdapter,
							 IN PPlatformMutex	Mutex,
							 IN RT_SPINLOCK_TYPE	Spinlock
							 );

VOID
PlatformExtApSupport(
	IN	PADAPTER	Adapter,
	IN	BOOLEAN		bSupport
	);

BOOLEAN
PlatformInitReady(
	IN	PADAPTER	Adapter
	);


//
// <Roger_Notes> The following Export SDIO Commands are for IO_RW_DIRECT Command (CMD52) 
// and IO_RW_EXTENDED Command (CMD53) to read or write 
// corresponding offset and data for specific device ID.
// 2010.12.23.
//
#define PlatformEFSdioCmd52Read1Byte(_a,_b,_c,_d)		\
			PlatformSdioCmd52Read1Byte(_a,_b,_c,_d)
#define PlatformEFSdioCmd52Read2Byte(_a,_b,_c,_d)		\
			EF2Byte(PlatformSdioCmd52Read2Byte(_a,_b,_c,_d))
#define PlatformEFSdioCmd52Read4Byte(_a,_b,_c,_d)		\
			EF4Byte(PlatformSdioCmd52Read4Byte(_a,_b,_c,_d))
#define PlatformEFSdioCmd52Write1Byte(_a,_b,_c,_d,_e)		\
			PlatformSdioCmd52Write1Byte(_a,_b,_c,_d,_e)
#define PlatformEFSdioCmd52Write2Byte(_a,_b,_c,_d,_e)		\
			PlatformSdioCmd52Write2Byte(_a,_b,_c,EF2Byte(_d), _e)
#define PlatformEFSdioCmd52Write4Byte(_a,_b,_c,_d,_e)		\
			PlatformSdioCmd52Write4Byte(_a,_b,_c,EF4Byte(_d),_e)
#define PlatformEFSdioCmd53Read1Byte(_a,_b,_c)		\
			PlatformIORead1Byte(_a,_b,_c)
#define PlatformEFSdioCmd53Read2Byte(_a,_b,_c)		\
			EF2Byte(PlatformIORead2Byte(_a,_b,_c))
#define PlatformEFSdioCmd53Read4Byte(_a,_b,_c)		\
			EF4Byte(PlatformIORead4Byte(_a,_b,_c))
#define PlatformEFSdioCmd53ReadNByte(_a,_b,_c,_d,_e)		\
			PlatformIOReadNByte(_a,_b,_c,_d,_e)
#define PlatformEFSdioCmd53Write1Byte(_a,_b,_c,_d)		\
			PlatformIOWrite1Byte(_a,_b,_c,_d)
#define PlatformEFSdioCmd53Write2Byte(_a,_b,_c,_d)		\
			PlatformIOWrite2Byte(_a,_b,_c,EF2Byte(_d))
#define PlatformEFSdioCmd53Write4Byte(_a,_b,_c,_d)		\
			PlatformIOWrite4Byte(_a,_b,_c,EF4Byte(_d))

//
// Use CMD52 to perform SDIO Local I/O Bus domain Read/Write for Function 1 space.
//
#define PlatformEFSdioLocalCmd52Read1Byte(_a,_b)		\
			PlatformEFSdioCmd52Read1Byte(_a,SDIO_LOCAL_DEVICE_ID,1,_b)
#define PlatformEFSdioLocalCmd52Read2Byte(_a,_b)		\
			PlatformEFSdioCmd52Read2Byte(_a,SDIO_LOCAL_DEVICE_ID,1,_b)
#define PlatformEFSdioLocalCmd52Read4Byte(_a,_b)		\
			PlatformEFSdioCmd52Read4Byte(_a,SDIO_LOCAL_DEVICE_ID,1,_b)
#define PlatformEFSdioLocalCmd52Write1Byte(_a,_b,_c)		\
			PlatformSdioCmd52Write1Byte(_a,SDIO_LOCAL_DEVICE_ID,1,_b,_c)
#define PlatformEFSdioLocalCmd52Write2Byte(_a,_b,_c)		\
			PlatformSdioCmd52Write2Byte(_a,SDIO_LOCAL_DEVICE_ID,1,_b,EF2Byte(_c))
#define PlatformEFSdioLocalCmd52Write4Byte(_a,_b,_c)		\
			PlatformSdioCmd52Write4Byte(_a,SDIO_LOCAL_DEVICE_ID,1,_b,EF4Byte(_c))
			
//
// Use CMD53 to perform SDIO Local I/O Bus domain Read/Write for Function 1 space.
// We will NOT use CMD53 to access SDIO Function 0 space.
//
#define PlatformEFSdioLocalCmd53Read1Byte(_a,_b)		\
			PlatformEFSdioCmd53Read1Byte(_a,SDIO_LOCAL_DEVICE_ID,_b)
#define PlatformEFSdioLocalCmd53Read2Byte(_a,_b)		\
			PlatformEFSdioCmd53Read2Byte(_a,SDIO_LOCAL_DEVICE_ID,_b)
#define PlatformEFSdioLocalCmd53Read4Byte(_a,_b)		\
			PlatformEFSdioCmd53Read4Byte(_a,SDIO_LOCAL_DEVICE_ID,_b)
#define PlatformEFSdioLocalCmd53ReadNByte(_a,_b,_c,_d)		\
			PlatformEFSdioCmd53ReadNByte(_a,SDIO_LOCAL_DEVICE_ID,_b,_c,_d)
#define PlatformEFSdioLocalCmd53Write1Byte(_a,_b,_c)		\
			PlatformEFSdioCmd53Write1Byte(_a,SDIO_LOCAL_DEVICE_ID,_b,_c)
#define PlatformEFSdioLocalCmd53Write2Byte(_a,_b,_c)		\
			PlatformEFSdioCmd53Write2Byte(_a,SDIO_LOCAL_DEVICE_ID,_b,EF2Byte(_c))
#define PlatformEFSdioLocalCmd53Write4Byte(_a,_b,_c)		\
			PlatformEFSdioCmd53Write4Byte(_a,SDIO_LOCAL_DEVICE_ID,_b,EF4Byte(_c))
			
//20130422 KaiYuan add for 8814 available page read
#define PlatformEFMacLocalCmd53ReadNByte(_a,_b,_c,_d)		\
			PlatformEFSdioCmd53ReadNByte(_a,WLAN_IOREG_DEVICE_ID,_b,_c,_d)

u1Byte
PlatformSdioCmd52Read1Byte(
	IN	PVOID		Adapter,
	IN	u1Byte		DeviceID,
	IN	u1Byte		FuncNum,
	IN	u4Byte		offset
	);

u2Byte
PlatformSdioCmd52Read2Byte(
	IN	PVOID		Adapter,
	IN	u1Byte		DeviceID,
	IN	u1Byte		FuncNum,
	IN	u4Byte		offset
	);

u4Byte
PlatformSdioCmd52Read4Byte(
	IN	PVOID		Adapter,
	IN	u1Byte		DeviceID,
	IN	u1Byte		FuncNum,
	IN	u4Byte		offset
	);

VOID
PlatformSdioCmd52Write1Byte(
	PVOID			sAdapter,
	IN	u1Byte		DeviceID,
	IN	u1Byte		FuncNum,
	IN	u4Byte		offset,
	IN	u1Byte		data
	);

VOID
PlatformSdioCmd52Write2Byte(
	PVOID			Adapter,
	IN	u1Byte		DeviceID,
	IN	u1Byte		FuncNum,
	IN	u4Byte		offset,
	IN	u2Byte		data
	);

VOID
PlatformSdioCmd52Write4Byte(
	PVOID			Adapter,
	IN	u1Byte		DeviceID,
	IN	u1Byte		FuncNum,
	IN	u4Byte		offset,
	IN	u4Byte		data
	);



// For P2P Platform-dependant Indication ------------------------------------
VOID
PlatformIndicateP2PEvent(
	PVOID pvP2PInfo, 
	u4Byte EventID,
	PMEMORY_BUFFER pInformation
);

// For Return TX pending packet case.
VOID
PlatformReturnAllPendingTxPackets(
	IN 	PADAPTER 		pAdapter
	);

// For Dual mac restore last init setting.
VOID
PlatformRestoreLastInitSetting(
	IN 	PADAPTER 		pAdapter
	);

BOOLEAN
PlatformIsOverrideAddress(
	IN	PADAPTER	Adapter
	);

pu1Byte
PlatformGetOverrideAddress(
	IN	PADAPTER	Adapter
	);
//---------------------------------------------------------------------


#endif // #ifndef __INC_PLATFORMDEF_H