2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/windows/ce/hif/sdio/include/hif.h#1 $
6 \brief sdio specific structure for GLUE layer
16 ** 09 17 2012 cm.chang
17 ** [BORA00002149] [MT6630 Wi-Fi] Initial software development
18 ** Duplicate source from MT6620 v2.3 driver branch
19 ** (Davinci label: MT6620_WIFI_Driver_V2_3_120913_1942_As_MT6630_Base)
23 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
25 * 06 06 2010 kevin.huang
26 * [WPD00003832][MT6620 5931] Create driver base
27 * [MT6620 5931] Create driver base
28 ** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-04-01 17:12:50 GMT mtk01426
29 ** Move TxServiceThread to Kal layer
30 ** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-16 09:11:24 GMT mtk01461
32 ** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:31:29 GMT mtk01426
39 /******************************************************************************
40 * C O M P I L E R F L A G S
41 *******************************************************************************
44 /******************************************************************************
45 * E X T E R N A L R E F E R E N C E S
46 *******************************************************************************
48 #include "SDCardDDK.h"
49 #if CFG_SDIO_PATHRU_MODE
50 #include <sdhcd.h> /* definition of PSDCARD_HC_CONTEXT */
54 #include "colibri.h" /* definition of platformBusInit() */
57 #include "mt6516.h" /* definition of platformBusInit() */
61 #define SDNDIS_REG_PATH TEXT("\\Comm\\MT6620")
66 #define BLOCK_TRANSFER_LEN (512)
74 #if (CE_MAJOR_VER >= 4)
75 #define NDIS_SUCCESS(Status) ((NDIS_STATUS)(Status) == NDIS_STATUS_SUCCESS)
77 /******************************************************************************
79 *******************************************************************************
81 #define MAX_ACTIVE_REG_PATH 256
82 #define NIC_INTERFACE_TYPE NdisInterfaceInternal
83 #define NIC_ATTRIBUTE NDIS_ATTRIBUTE_DESERIALIZE
84 #define NIC_DMA_MAPPED 0
85 #define NIC_MINIPORT_INT_REG 0
87 /* Please make sure the MCR you wrote will not take any effect.
88 * MCR_MIBSDR (0x00C4) has confirm with DE.
90 #define SDIO_X86_WORKAROUND_WRITE_MCR 0x0000
92 #if CFG_SDIO_PATHRU_MODE
93 #define SDIO_PATHRU_SHC_NAME TEXT("SHC1:")
94 #define FILE_DEVICE_SDHC (0x8CE7) /* MTK custom file device for SDHC */
95 #define _SDHC_CTL_CODE(_Function, _Method, _Access) \
96 CTL_CODE(FILE_DEVICE_SDHC, _Function, _Method, _Access)
97 #define IOCTL_SDHC_PATHRU _SDHC_CTL_CODE(0, METHOD_BUFFERED, FILE_ANY_ACCESS)
99 /******************************************************************************
101 *******************************************************************************
103 #if CFG_SDIO_PATHRU_MODE
104 /* SDIO PATHRU mode's data structure, which is passed into SDHC driver and is
105 ** attached to HIF info structure.
106 */ typedef struct _GL_PATHRU_INFO_IN_T
{
107 DWORD dwEnable
; /* To enable or disable PATHRU mode */
108 DWORD dwSlotNumber
; /* Target slot number to be controlled */
109 VOID(*pIndicateSlotStateChange
) (PSDCARD_HC_CONTEXT pHCContext
, /* Status change event handler in PATHRU */
110 DWORD SlotNumber
, SD_SLOT_EVENT Event
, PVOID pvClient
);
111 PVOID pvClientContext
; /* Client's context used for status indication */
112 } GL_PATHRU_INFO_IN_T
, *P_GL_PATHRU_INFO_IN_T
;
114 /* SDIO PATHRU mode's data structure, which is outputted by SDHC driver and is
115 ** attached to HIF info structure.
117 typedef struct _GL_PATHRU_INFO_OUT_T
{
118 PSDCARD_HC_CONTEXT pHcd
; /* Context of SDHC driver , which is returned by SDHC driver */
119 VOID(*pIndicateSlotStateChange
) (PSDCARD_HC_CONTEXT pHCContext
, /* Status change event handler in SDHC */
120 DWORD SlotNumber
, SD_SLOT_EVENT Event
);
121 } GL_PATHRU_INFO_OUT_T
, *P_GL_PATHRU_INFO_OUT_T
;
123 /* SDIO PATHRU mode's data structure, which is attached to HIF info structure.
125 typedef struct _GL_PATHRU_INFO_T
{
126 HANDLE hSHCDev
; /* handle to SHC */
127 TCHAR szSHCDevName
[16]; /* SHC name */
128 BOOLEAN fgInitialized
; /* pass-through mode initialized or not */
129 BOOLEAN fgEnabled
; /* pass-through mode enabled or not */
130 DWORD dwSlotNumber
; /* slot number passed to SDHC APIs */
131 PSDCARD_HC_CONTEXT pSHCContext
; /* Context of SDHC driver , which is copied from rInfoOut */
132 GL_PATHRU_INFO_IN_T rInfoIn
; /* Info to be passed into SDHC driver */
133 GL_PATHRU_INFO_OUT_T rInfoOut
; /* Info returned by SDHC driver */
134 CRITICAL_SECTION rLock
; /* CriticalSetction for pretecting PATHRU atomic operation and integrity */
135 } GL_PATHRU_INFO_T
, *P_GL_PATHRU_INFO_T
;
136 #endif /* CFG_SDIO_PATHRU_MODE */
138 /* host interface's private data structure, which is attached to os glue
139 ** layer info structure.
141 typedef struct _GL_HIF_INFO_T
{
142 SD_DEVICE_HANDLE hDevice
; /* handle to card */
143 P_GLUE_INFO_T prGlueInfo
; /* handle to glue Info */
144 UCHAR Function
; /* I/O function number */
145 PWSTR pRegPath
; /* reg path for driver */
146 ULONG Errors
; /* error count */
147 SD_CARD_RCA RCA
; /* relative card address */
148 SD_HOST_BLOCK_CAPABILITY sdHostBlockCap
;
150 WCHAR ActivePath
[MAX_ACTIVE_REG_PATH
];
152 #if CFG_SDIO_PATHRU_MODE
153 BOOLEAN fgSDIOFastPathEnable
; /* Fast-path feature in host and bus driver enabled or not */
154 GL_PATHRU_INFO_T rPathruInfo
; /* Pass-through(PATHRU) info structure */
157 } GL_HIF_INFO_T
, *P_GL_HIF_INFO_T
;
160 /******************************************************************************
161 * P U B L I C D A T A
162 *******************************************************************************
165 /******************************************************************************
166 * P R I V A T E D A T A
167 *******************************************************************************
170 /******************************************************************************
172 *******************************************************************************
174 #ifdef CFG_HAVE_PLATFORM_INIT
175 #define sdioBusDeinit(prGlueInfo) \
176 platformBusDeinit(prGlueInfo)
177 #define sdioSetPowerState(prGlueInfo, ePowerMode) \
178 platformSetPowerState(prGlueInfo, ePowerMode)
180 /* define platformBusInit() for platforms that have no such function. This is
183 #define platformBusInit(prGlueInfo) ((BOOLEAN)TRUE)
184 #define sdioBusDeinit(prGlueInfo)
185 #define sdioSetPowerState(prGlueInfo, ePowerMode)
188 /******************************************************************************
189 * F U N C T I O N D E C L A R A T I O N S
190 *******************************************************************************
193 #if CFG_SDIO_PATHRU_MODE
194 VOID
sdioInitPathruMode(IN P_GLUE_INFO_T prGlueInfo
);
196 VOID
sdioDeinitPathruMode(IN P_GLUE_INFO_T prGlueInfo
);
198 BOOLEAN
sdioEnablePathruMode(IN P_GLUE_INFO_T prGlueInfo
, IN BOOLEAN fgEnable
);