2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/include/gl_typedef.h#1 $
6 \brief Definition of basic data type(os dependent).
8 In this file we define the basic data type.
14 ** $Log: gl_typedef.h $
17 * [WCXRP00001257] [MT6620][MT5931][MT6628][Driver][Linux] Modify KAL_HZ to align ms accuracy
18 * modify KAL_HZ to (1000) for correct definition.
21 * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer
22 * portability improvement
24 * 02 15 2011 jeffrey.chang
26 * to support early suspend in android
30 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
32 * 06 06 2010 kevin.huang
33 * [WPD00003832][MT6620 5931] Create driver base
34 * [MT6620 5931] Create driver base
36 * 03 24 2010 jeffrey.chang
37 * [WPD00003826]Initial import for Linux port
38 * initial import for Linux port
39 ** \main\maintrunk.MT5921\6 2009-08-18 22:57:14 GMT mtk01090
40 ** Add Linux SDIO (with mmc core) support.
41 ** Add Linux 2.6.21, 2.6.25, 2.6.26.
42 ** Fix compile warning in Linux.
43 ** \main\maintrunk.MT5921\5 2008-09-22 23:19:30 GMT mtk01461
44 ** Update comment for code review
45 ** \main\maintrunk.MT5921\4 2008-09-05 17:25:16 GMT mtk01461
46 ** Update Driver for Code Review
47 ** \main\maintrunk.MT5921\3 2007-11-09 11:00:50 GMT mtk01425
48 ** 1. Use macro to unify network-to-host and host-to-network related functions
49 ** Revision 1.3 2007/06/27 02:18:51 MTK01461
50 ** Update SCAN_FSM, Initial(Can Load Module), Proc(Can do Reg R/W), TX API
52 ** Revision 1.2 2007/06/25 06:16:24 MTK01461
53 ** Update illustrations, gl_init.c, gl_kal.c, gl_kal.h, gl_os.h and RX API
60 #if defined(CONFIG_HAS_EARLYSUSPEND)
61 #include <linux/earlysuspend.h>
64 /*******************************************************************************
65 * C O M P I L E R F L A G S
66 ********************************************************************************
69 /*******************************************************************************
70 * E X T E R N A L R E F E R E N C E S
71 ********************************************************************************
74 /*******************************************************************************
76 ********************************************************************************
78 /* Define HZ of timer tick for function kalGetTimeTick() */
81 /* Miscellaneous Equates */
83 #define FALSE ((BOOL) 0)
84 #define TRUE ((BOOL) 1)
88 #if defined(__cplusplus)
91 #define NULL ((void *) 0)
95 #if defined(CONFIG_HAS_EARLYSUSPEND)
96 typedef void (*early_suspend_callback)(struct early_suspend *h);
97 typedef void (*late_resume_callback) (struct early_suspend *h);
101 /*******************************************************************************
103 ********************************************************************************
105 /* Type definition for void */
106 typedef void VOID, *PVOID, **PPVOID;
108 /* Type definition for Boolean */
109 typedef unsigned char BOOL, *PBOOL, BOOLEAN, *PBOOLEAN;
111 /* Type definition for signed integers */
112 typedef signed char CHAR, *PCHAR, **PPCHAR;
113 typedef signed char INT_8, *PINT_8, **PPINT_8;
114 typedef signed short INT_16, *PINT_16, **PPINT_16;
115 typedef signed long INT_32, *PINT_32, **PPINT_32;
116 typedef signed long long INT_64, *PINT_64, **PPINT_64;
118 /* Type definition for unsigned integers */
119 typedef unsigned char UCHAR, *PUCHAR, **PPUCHAR;
120 typedef unsigned char UINT_8, *PUINT_8, **PPUINT_8, *P_UINT_8;
121 typedef unsigned short UINT_16, *PUINT_16, **PPUINT_16;
122 typedef unsigned long ULONG, UINT_32, *PUINT_32, **PPUINT_32;
123 typedef unsigned long long UINT_64, *PUINT_64, **PPUINT_64;
125 typedef unsigned long OS_SYSTIME, *POS_SYSTIME, **PPOS_SYSTIME;
128 /* Type definition of large integer (64bits) union to be comptaible with
129 * Windows definition, so we won't apply our own coding style to these data types.
130 * NOTE: LARGE_INTEGER must NOT be floating variable.
131 * <TODO>: Check for big-endian compatibility.
133 typedef union _LARGE_INTEGER {
139 } LARGE_INTEGER, *PLARGE_INTEGER;
141 typedef union _ULARGE_INTEGER {
147 } ULARGE_INTEGER, *PULARGE_INTEGER;
150 typedef INT_32 (*probe_card)(PVOID pvData);
151 typedef VOID (*remove_card)(VOID);
153 /*******************************************************************************
154 * P U B L I C D A T A
155 ********************************************************************************
158 /*******************************************************************************
159 * P R I V A T E D A T A
160 ********************************************************************************
163 /*******************************************************************************
165 ********************************************************************************
167 #define IN //volatile
168 #define OUT //volatile
170 #define __KAL_INLINE__ static __inline__
171 #define __KAL_ATTRIB_PACKED__ __attribute__((__packed__))
172 #define __KAL_ATTRIB_ALIGN_4__ __attribute__ ((aligned (4)))
176 #define BIT(n) ((UINT_32) 1UL << (n))
180 /* bits range: for example BITS(16,23) = 0xFF0000
181 * ==> (BIT(m)-1) = 0x0000FFFF ~(BIT(m)-1) => 0xFFFF0000
182 * ==> (BIT(n+1)-1) = 0x00FFFFFF
184 #define BITS(m,n) (~(BIT(m)-1) & ((BIT(n) - 1) | BIT(n)))
188 /* This macro returns the byte offset of a named field in a known structure
190 _type - structure name,
191 _field - field name of the structure */
193 #define OFFSET_OF(_type, _field) ((UINT_32)&(((_type *)0)->_field))
194 #endif /* OFFSET_OF */
197 /* This macro returns the base address of an instance of a structure
198 * given the type of the structure and the address of a field within the
199 * containing structure.
200 * _addrOfField - address of current field of the structure,
201 * _type - structure name,
202 * _field - field name of the structure
205 #define ENTRY_OF(_addrOfField, _type, _field) \
206 ((_type *)((PINT_8)(_addrOfField) - (PINT_8)OFFSET_OF(_type, _field)))
207 #endif /* ENTRY_OF */
210 /* This macro align the input value to the DW boundary.
211 * _value - value need to check
214 #define ALIGN_4(_value) (((_value) + 3) & ~3u)
217 /* This macro check the DW alignment of the input value.
218 * _value - value of address need to check
221 #define IS_ALIGN_4(_value) (((_value) & 0x3) ? FALSE : TRUE)
222 #endif /* IS_ALIGN_4 */
224 #ifndef IS_NOT_ALIGN_4
225 #define IS_NOT_ALIGN_4(_value) (((_value) & 0x3) ? TRUE : FALSE)
226 #endif /* IS_NOT_ALIGN_4 */
229 /* This macro evaluate the input length in unit of Double Word(4 Bytes).
230 * _value - value in unit of Byte, output will round up to DW boundary.
232 #ifndef BYTE_TO_DWORD
233 #define BYTE_TO_DWORD(_value) ((_value + 3) >> 2)
234 #endif /* BYTE_TO_DWORD */
236 /* This macro evaluate the input length in unit of Byte.
237 * _value - value in unit of DW, output is in unit of Byte.
239 #ifndef DWORD_TO_BYTE
240 #define DWORD_TO_BYTE(_value) ((_value) << 2)
241 #endif /* DWORD_TO_BYTE */
243 #if 1 // Little-Endian
244 #define CONST_NTOHS(_x) __constant_ntohs(_x)
246 #define CONST_HTONS(_x) __constant_htons(_x)
248 #define NTOHS(_x) ntohs(_x)
250 #define HTONS(_x) htons(_x)
252 #define NTOHL(_x) ntohl(_x)
254 #define HTONL(_x) htonl(_x)
258 #define CONST_NTOHS(_x)
260 #define CONST_HTONS(_x)
268 /*******************************************************************************
269 * F U N C T I O N D E C L A R A T I O N S
270 ********************************************************************************
273 /*******************************************************************************
275 ********************************************************************************
278 #endif /* _GL_TYPEDEF_H */