xref: /utopia/UTPA2-700.0.x/modules/pcmcia/drv/pcmcia/pcmcia.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 //    Software and any modification/derivatives thereof.
18 //    No right, ownership, or interest to MStar Software and any
19 //    modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 //    supplied together with third party`s software and the use of MStar
23 //    Software may require additional licenses from third parties.
24 //    Therefore, you hereby agree it is your sole responsibility to separately
25 //    obtain any and all third party right and license necessary for your use of
26 //    such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 //    MStar`s confidential information and you agree to keep MStar`s
30 //    confidential information in strictest confidence and not disclose to any
31 //    third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 //    kind. Any warranties are hereby expressly disclaimed by MStar, including
35 //    without limitation, any warranties of merchantability, non-infringement of
36 //    intellectual property rights, fitness for a particular purpose, error free
37 //    and in conformity with any international standard.  You agree to waive any
38 //    claim against MStar for any loss, damage, cost or expense that you may
39 //    incur related to your use of MStar Software.
40 //    In no event shall MStar be liable for any direct, indirect, incidental or
41 //    consequential damages, including without limitation, lost of profit or
42 //    revenues, lost or damage of data, and unauthorized system use.
43 //    You agree that this Section 4 shall still apply without being affected
44 //    even if MStar Software has been modified by MStar in accordance with your
45 //    request or instruction for your use, except otherwise agreed by both
46 //    parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 //    services in relation with MStar Software to you for your use of
50 //    MStar Software in conjunction with your or your customer`s product
51 //    ("Services").
52 //    You understand and agree that, except otherwise agreed by both parties in
53 //    writing, Services are provided on an "AS IS" basis and the warranty
54 //    disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 //    or otherwise:
58 //    (a) conferring any license or right to use MStar name, trademark, service
59 //        mark, symbol or any other identification;
60 //    (b) obligating MStar or any of its affiliates to furnish any person,
61 //        including without limitation, you and your customers, any assistance
62 //        of any kind whatsoever, or any information; or
63 //    (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 //    of Taiwan, R.O.C., excluding its conflict of law rules.
67 //    Any and all dispute arising out hereof or related hereto shall be finally
68 //    settled by arbitration referred to the Chinese Arbitration Association,
69 //    Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 //    Rules of the Association by three (3) arbitrators appointed in accordance
71 //    with the said Rules.
72 //    The place of arbitration shall be in Taipei, Taiwan and the language shall
73 //    be English.
74 //    The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 // ********************************************************
79 //
80 
81 ///////////////////////////////////////////////////////////////////////////////
82 ///
83 /// file    pcmcia.h
84 /// @brief  PCMCIA Driver Utopia2.0 Interface header
85 /// @author MStar Semiconductor Inc.
86 ///////////////////////////////////////////////////////////////////////////////
87 #ifndef __PCMCIA_H__
88 #define __PCMCIA_H__
89 
90 /*****************************************************************************/
91 /*                       Header Files                                        */
92 /*****************************************************************************/
93 // Common Definition
94 #include "MsTypes.h"
95 #include "drvPCMCIA.h"
96 
97 typedef enum {
98     E_MDRV_CMD_PCM_Init,
99     E_MDRV_CMD_PCM_Detect,
100     E_MDRV_CMD_PCM_Enable_Interrupt,
101     E_MDRV_CMD_PCM_Exit,
102     E_MDRV_CMD_PCM_Get_CD_Interval,
103     E_MDRV_CMD_PCM_Get_InterruptStatus,
104     E_MDRV_CMD_PCM_GetLibVer,
105     E_MDRV_CMD_PCM_InstallIsrCallback,
106     E_MDRV_CMD_PCM_IsDataAvailable,
107     E_MDRV_CMD_PCM_IsModuleStillPlugged,
108     E_MDRV_CMD_PCM_NegotiateBufferSize,
109     E_MDRV_CMD_PCM_ParseAttribMem,
110     E_MDRV_CMD_PCM_Polling,
111     E_MDRV_CMD_PCM_ReadAttribMem,
112     E_MDRV_CMD_PCM_ReadData,
113     E_MDRV_CMD_PCM_ReadIOMem,
114     E_MDRV_CMD_PCM_ResetHW,
115     E_MDRV_CMD_PCM_ResetInterface,
116     E_MDRV_CMD_PCM_Set_Detect_Enable,
117     E_MDRV_CMD_PCM_Set_Detect_Trigger,
118     E_MDRV_CMD_PCM_Set_HW_ResetDuration,
119     E_MDRV_CMD_PCM_Set_InterruptStatus,
120     E_MDRV_CMD_PCM_SetCommandBit,
121     E_MDRV_CMD_PCM_SwitchToIOmode,
122     E_MDRV_CMD_PCM_WaitForStatusBit,
123     E_MDRV_CMD_PCM_WriteAttribMem,
124     E_MDRV_CMD_PCM_WriteBufferSize,
125     E_MDRV_CMD_PCM_WriteData,
126     E_MDRV_CMD_PCM_WriteIOMem,
127     E_MDRV_CMD_PCM_WriteIOMemLong,
128     E_MDRV_CMD_PCM_SetPowerState,
129     E_MDRV_CMD_PCM_GetConfig,
130     E_MDRV_CMD_PCM_MAX,
131 } ePcmIoctlOpt;
132 
133 // E_MDRV_CMD_PCM_Detect
134 typedef struct {
135     PCMCIA_MODULE   eModule;
136     MS_BOOL         bDetected;
137 } PCM_DETECT;
138 
139 // E_MDRV_CMD_PCM_Enable_Interrupt
140 typedef struct {
141     PCMCIA_MODULE   eModule;
142     MS_BOOL         bEnable;
143 } PCM_ENABLE_INT;
144 
145 // E_MDRV_CMD_PCM_InstallIsrCallback
146 typedef struct {
147     PCMCIA_MODULE   eModule;
148     IsrCallback     pfcb;
149 } PCM_INSTCB;
150 
151 // E_MDRV_CMD_PCM_Get_CD_Interval
152 typedef struct {
153     PCMCIA_MODULE   eModule;
154     MS_U32          u32Interval;
155 } PCM_GET_CD_INTERVAL;
156 
157 // E_MDRV_CMD_PCM_Get_InterruptStatus
158 typedef struct {
159     PCMCIA_MODULE   eModule;
160     MS_BOOL         bIntStatus;
161 } PCM_GET_INT_STATUS;
162 
163 // E_MDRV_CMD_PCM_IsDataAvailable
164 typedef struct {
165     PCMCIA_MODULE   eModule;
166     MS_BOOL         bDA; // data available
167 } PCM_DATA_AVAILABLE;
168 
169 // E_MDRV_CMD_PCM_IsModuleStillPlugged
170 typedef struct {
171     PCMCIA_MODULE   eModule;
172     MS_BOOL         bPlugIn;
173 } PCM_MODULE_PLUGIN;
174 
175 // E_MDRV_CMD_PCM_NegotiateBufferSize
176 typedef struct {
177     PCMCIA_MODULE   eModule;
178     PCMCIA_INFO*    pInfo;
179     MS_U16          u16BufSize;
180 } PCM_NETOTIAGE_BUFSIZE;
181 
182 // E_MDRV_CMD_PCM_ParseAttribMem
183 typedef struct {
184     MS_U8*          pu8AttribMem;
185     MS_U16          u16DwLen;
186     PCMCIA_INFO*    pInfo;
187 } PCM_PARSE_ATTRIBUTE;
188 
189 // E_MDRV_CMD_PCM_Polling
190 typedef struct {
191     PCMCIA_MODULE   eModule;
192     MS_BOOL         bChanged; // card insertion status change
193 } PCM_POLL;
194 
195 // E_MDRV_CMD_PCM_ReadAttribMem
196 typedef struct {
197     PCMCIA_MODULE   eModule;
198     MS_U16          u16Addr;
199     MS_U8           u8Data;
200 } PCM_READ_ATTRIB_MEM;
201 
202 // E_MDRV_CMD_PCM_ReadIOMem
203 typedef struct {
204     PCMCIA_MODULE   eModule;
205     MS_U16          u16Addr;
206     MS_U8           u8Data;
207 } PCM_READ_IO_MEM;
208 
209 // E_MDRV_CMD_PCM_ResetInterface
210 typedef struct {
211     PCMCIA_MODULE   eModule;
212 } PCM_RESET_INTERFACE;
213 
214 // E_MDRV_CMD_PCM_ReadData
215 typedef struct {
216     PCMCIA_MODULE   eModule;
217     MS_U8*          pu8ReadBuffer;
218     MS_U16          u16ReadBufferSize;
219     MS_U16          u16SizeRead;
220 } PCM_READ_DATA;
221 
222 // E_MDRV_CMD_PCM_Set_InterruptStatus
223 typedef struct {
224     PCMCIA_MODULE   eModule;
225     MS_BOOL         bStatus;
226 } PCM_SET_INTR_STATUS;
227 
228 // E_MDRV_CMD_PCM_SetCommandBit
229 typedef struct {
230     PCMCIA_MODULE   eModule;
231     MS_U8           u8CmdBit;
232     MS_BOOL         bValue;
233 } PCM_SETCOMMANDBIT;
234 
235 // E_MDRV_CMD_PCM_SwitchToIOmode
236 typedef struct {
237     PCMCIA_MODULE   eModule;
238     PCMCIA_INFO*    pInfo;
239 } PCM_SWITCH_TO_IOMODE;
240 
241 // E_MDRV_CMD_PCM_WaitForStatusBit
242 typedef struct {
243     PCMCIA_MODULE   eModule;
244     MS_U8           u8StatusBit;
245 } PCM_WAIT_STATUS;
246 
247 // E_MDRV_CMD_PCM_WriteAttribMem
248 // E_MDRV_CMD_PCM_WriteIOMem
249 typedef struct {
250     PCMCIA_MODULE   eModule;
251     MS_U16          u16Addr;
252     MS_U8           u8Value;
253 } PCM_WRITE_ATTRIB_MEM, PCM_WRITE_IO_MEM;
254 
255 // E_MDRV_CMD_PCM_WriteBufferSize
256 typedef struct {
257     PCMCIA_MODULE   eModule;
258     MS_U16          u16BufferSize;
259 } PCM_WRITE_BUF_SIZE;
260 
261 // E_MDRV_CMD_PCM_WriteData
262 typedef struct {
263     PCMCIA_MODULE   eModule;
264     MS_U8*          pu8WriteBuffer;
265     MS_U16          u16DataLen;
266 } PCM_WRITE_DATA;
267 
268 // E_MDRV_CMD_PCM_WriteIOMemLong
269 typedef struct {
270     PCMCIA_MODULE   eModule;
271     MS_U16          u16Addr;
272     MS_U8           u8Value;
273     MS_U16          u16DataLen;
274     MS_U8*          pu8WriteBuffer;
275 } PCM_WRITE_IO_MEM_LONG;
276 
277 void CIRegisterToUtopia(FUtopiaOpen ModuleType);
278 MS_U32 PCMCIAOpen(void** pInstantTmp, const void* const pAttribute);
279 MS_U32 PCMCIAClose(void* pInstantTmp);
280 MS_U32 PCMCIAIoctl(void* pInstance, MS_U32 u32Cmd, void* const pArgs);
281 
282 #endif //__PCMCIA_H__
283