import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / connectivity / combo / drv_wlan / mt6630 / wlan / os / windows / ce / hif / sdio / include / hif.h
CommitLineData
6fa3eb70
S
1/*
2** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/windows/ce/hif/sdio/include/hif.h#1 $
3*/
4
5/*! \file "hif.h"
6 \brief sdio specific structure for GLUE layer
7
8 N/A
9*/
10
11
12
13/*
14** $Log: hif.h $
15**
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)
20 *
21 * 07 08 2010 cp.wu
22 *
23 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
24 *
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
31** Update TX PATH API
32** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:31:29 GMT mtk01426
33** Init for develop
34**
35*/
36
37#ifndef _HIF_H
38#define _HIF_H
39/******************************************************************************
40* C O M P I L E R F L A G S
41*******************************************************************************
42*/
43
44/******************************************************************************
45* E X T E R N A L R E F E R E N C E S
46*******************************************************************************
47*/
48#include "SDCardDDK.h"
49#if CFG_SDIO_PATHRU_MODE
50#include <sdhcd.h> /* definition of PSDCARD_HC_CONTEXT */
51#endif
52
53#if _PF_COLIBRI
54#include "colibri.h" /* definition of platformBusInit() */
55#endif
56#if _PF_MT6516
57#include "mt6516.h" /* definition of platformBusInit() */
58#endif
59
60#ifdef MT6620
61#define SDNDIS_REG_PATH TEXT("\\Comm\\MT6620")
62#endif
63
64#include "bldver.h"
65
66#define BLOCK_TRANSFER_LEN (512)
67
68#ifdef __cplusplus
69extern "C" {
70 /* NDIS ddk header */
71#include <ndis.h>
72}
73#endif
74#if (CE_MAJOR_VER >= 4)
75#define NDIS_SUCCESS(Status) ((NDIS_STATUS)(Status) == NDIS_STATUS_SUCCESS)
76#endif
77/******************************************************************************
78* C O N S T A N T S
79*******************************************************************************
80*/
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
86#ifdef X86_CPU
87/* Please make sure the MCR you wrote will not take any effect.
88 * MCR_MIBSDR (0x00C4) has confirm with DE.
89 */* / TODO: yarco */
90#define SDIO_X86_WORKAROUND_WRITE_MCR 0x0000
91#endif
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)
98#endif
99/******************************************************************************
100* D A T A T Y P E S
101*******************************************************************************
102*/
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;
113
114/* SDIO PATHRU mode's data structure, which is outputted by SDHC driver and is
115** attached to HIF info structure.
116 */
117typedef 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;
122
123/* SDIO PATHRU mode's data structure, which is attached to HIF info structure.
124 */
125typedef 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 */
137
138/* host interface's private data structure, which is attached to os glue
139** layer info structure.
140 */
141typedef 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;
149 ULONG WBlkBitSize;
150 WCHAR ActivePath[MAX_ACTIVE_REG_PATH];
151
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 */
155#endif
156
157} GL_HIF_INFO_T, *P_GL_HIF_INFO_T;
158
159
160/******************************************************************************
161* P U B L I C D A T A
162*******************************************************************************
163*/
164
165/******************************************************************************
166* P R I V A T E D A T A
167*******************************************************************************
168*/
169
170/******************************************************************************
171* M A C R O S
172*******************************************************************************
173*/
174#ifdef CFG_HAVE_PLATFORM_INIT
175#define sdioBusDeinit(prGlueInfo) \
176 platformBusDeinit(prGlueInfo)
177#define sdioSetPowerState(prGlueInfo, ePowerMode) \
178 platformSetPowerState(prGlueInfo, ePowerMode)
179#else
180/* define platformBusInit() for platforms that have no such function. This is
181** needed by sdio.c.
182*/
183#define platformBusInit(prGlueInfo) ((BOOLEAN)TRUE)
184#define sdioBusDeinit(prGlueInfo)
185#define sdioSetPowerState(prGlueInfo, ePowerMode)
186#endif
187
188/******************************************************************************
189* F U N C T I O N D E C L A R A T I O N S
190*******************************************************************************
191*/
192
193#if CFG_SDIO_PATHRU_MODE
194VOID sdioInitPathruMode(IN P_GLUE_INFO_T prGlueInfo);
195
196VOID sdioDeinitPathruMode(IN P_GLUE_INFO_T prGlueInfo);
197
198BOOLEAN sdioEnablePathruMode(IN P_GLUE_INFO_T prGlueInfo, IN BOOLEAN fgEnable);
199
200#endif
201
202#endif /* _HIF_H */