xref: /utopia/UTPA2-700.0.x/projects/tmplib/include/MsTypes.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 // Copyright (c) 2006-2009 MStar Semiconductor, Inc.
82 // All rights reserved.
83 //
84 // Unless otherwise stipulated in writing, any and all information contained
85 // herein regardless in any format shall remain the sole proprietary of
86 // MStar Semiconductor Inc. and be kept in strict confidence
87 // ("MStar Confidential Information") by the recipient.
88 // Any unauthorized act including without limitation unauthorized disclosure,
89 // copying, use, reproduction, sale, distribution, modification, disassembling,
90 // reverse engineering and compiling of the contents of MStar Confidential
91 // Information is unlawful and strictly prohibited. MStar hereby reserves the
92 // rights to any and all damages, losses, costs and expenses resulting therefrom.
93 //
94 ////////////////////////////////////////////////////////////////////////////////
95 
96 ///////////////////////////////////////////////////////////////////////////////////////////////////
97 ///
98 /// @file   MsTypes.h
99 /// @brief  MStar General Data Types
100 /// @author MStar Semiconductor Inc.
101 ///////////////////////////////////////////////////////////////////////////////////////////////////
102 
103 #ifndef _MS_TYPES_H_
104 #define _MS_TYPES_H_
105 
106 
107 #ifdef CONFIG_ENABLE_MENUCONFIG
108     #include "autoconf.h"
109 #endif
110 
111 #include <stddef.h>
112 //-------------------------------------------------------------------------------------------------
113 //  System Data Type
114 //-------------------------------------------------------------------------------------------------
115 #define SUPPORT_ANDROID_L_PHYVIR_TYPE
116 
117 #if defined (__aarch64__)
118     /// data type unsigned char, data length 1 byte
119     typedef unsigned char               MS_U8;                              // 1 byte
120     /// data type unsigned short, data length 2 byte
121     typedef unsigned short              MS_U16;                             // 2 bytes
122     /// data type unsigned int, data length 4 byte
123     typedef unsigned int                MS_U32;                             // 4 bytes
124     /// data type unsigned int, data length 8 byte
125     typedef unsigned long               MS_U64;                             // 8 bytes
126     /// data type signed char, data length 1 byte
127     typedef signed char                 MS_S8;                              // 1 byte
128     /// data type signed short, data length 2 byte
129     typedef signed short                MS_S16;                             // 2 bytes
130     /// data type signed int, data length 4 byte
131     typedef signed int                  MS_S32;                             // 4 bytes
132     /// data type signed int, data length 8 byte
133     typedef signed long                 MS_S64;                             // 8 bytes
134     /// data type float, data length 4 byte
135     typedef float                       MS_FLOAT;                           // 4 bytes
136     /// data type pointer content
137     typedef size_t                      MS_VIRT;                            // 8 bytes
138     /// data type hardware physical address
139     typedef size_t                      MS_PHYADDR;                         // 8 bytes
140     /// data type size_t
141     typedef size_t                      MS_SIZE;                            // 8 bytes
142     /// data type 64bit physical address
143     typedef MS_U64                      MS_PHY;                             // 8 bytes
144     /// definition for MS_BOOL
145     typedef unsigned char               MS_BOOL;                            // 1 byte
146     /// print type  MPRI_PHY
147     #define                             MPRI_PHY                            "%x"
148     /// print type  MPRI_VIRT
149     #define                             MPRI_VIRT                           "%tx"
150 #elif defined(MSOS_TYPE_NUTTX)
151     /// data type unsigned char, data length 1 byte
152     typedef unsigned char               MS_U8;                              // 1 byte
153     /// data type unsigned short, data length 2 byte
154     typedef unsigned short              MS_U16;                             // 2 bytes
155     /// data type unsigned int, data length 4 byte
156     typedef unsigned long               MS_U32;                             // 4 bytes
157     /// data type unsigned int, data length 8 byte
158     typedef unsigned long long          MS_U64;                             // 8 bytes
159     /// data type signed char, data length 1 byte
160     typedef signed char                 MS_S8;                              // 1 byte
161     /// data type signed short, data length 2 byte
162     typedef signed short                MS_S16;                             // 2 bytes
163     /// data type signed int, data length 4 byte
164     typedef signed long                 MS_S32;                             // 4 bytes
165     /// data type signed int, data length 8 byte
166     typedef signed long long            MS_S64;                             // 8 bytes
167     /// data type float, data length 4 byte
168     typedef float                       MS_FLOAT;                           // 4 bytes
169     /// data type pointer content
170     typedef MS_U32                      MS_VIRT;                            // 8 bytes
171     /// data type hardware physical address
172     typedef MS_U32                      MS_PHYADDR;                         // 8 bytes
173     /// data type 64bit physical address
174     typedef MS_U32                      MS_PHY;                             // 8 bytes
175     /// data type size_t
176     typedef MS_U32                      MS_SIZE;                            // 8 bytes
177     /// definition for MS_BOOL
178     typedef unsigned char               MS_BOOL;                            // 1 byte
179     /// print type  MPRI_PHY
180     #define                             MPRI_PHY                            "%x"
181     /// print type  MPRI_PHY
182     #define                             MPRI_VIRT                           "%tx"
183 #else
184 #if (defined(CONFIG_PURE_SN) || defined(CONFIG_MBOOT))
185     /// data type unsigned char, data length 1 byte
186     typedef unsigned char               MS_U8;                              // 1 byte
187     /// data type unsigned short, data length 2 byte
188     typedef unsigned short              MS_U16;                             // 2 bytes
189     /// data type unsigned int, data length 4 byte
190     typedef unsigned long               MS_U32;                             // 4 bytes
191     /// data type unsigned int, data length 8 byte
192     typedef unsigned long long          MS_U64;                             // 8 bytes
193     /// data type signed char, data length 1 byte
194     typedef signed char                 MS_S8;                              // 1 byte
195     /// data type signed short, data length 2 byte
196     typedef signed short                MS_S16;                             // 2 bytes
197     /// data type signed int, data length 4 byte
198     typedef signed long                 MS_S32;                             // 4 bytes
199     /// data type signed int, data length 8 byte
200     typedef signed long long            MS_S64;                             // 8 bytes
201     /// data type float, data length 4 byte
202     typedef float                       MS_FLOAT;                           // 4 bytes
203     /// data type pointer content
204     typedef MS_U32                      MS_VIRT;                            // 8 bytes
205     /// data type hardware physical address
206     typedef MS_U32                      MS_PHYADDR;                         // 8 bytes
207     /// data type 64bit physical address
208     typedef MS_U32                      MS_PHY;                             // 8 bytes
209     /// data type size_t
210     typedef MS_U32                      MS_SIZE;                            // 8 bytes
211     /// definition for MS_BOOL
212     typedef unsigned char               MS_BOOL;                            // 1 byte
213     /// print type  MPRI_PHY
214     #define                             MPRI_PHY                            "%x"
215     /// print type  MPRI_PHY
216     #define                             MPRI_VIRT                           "%tx"
217 #else
218     /// data type unsigned char, data length 1 byte
219     typedef unsigned char               MS_U8;                              // 1 byte
220     /// data type unsigned short, data length 2 byte
221     typedef unsigned short              MS_U16;                             // 2 bytes
222     /// data type unsigned int, data length 4 byte
223     typedef unsigned int                MS_U32;                             // 4 bytes
224     /// data type unsigned int, data length 8 byte
225     typedef unsigned long long          MS_U64;                             // 8 bytes
226     /// data type signed char, data length 1 byte
227     typedef signed char                 MS_S8;                              // 1 byte
228     /// data type signed short, data length 2 byte
229     typedef signed short                MS_S16;                             // 2 bytes
230     /// data type signed int, data length 4 byte
231     typedef signed int                  MS_S32;                             // 4 bytes
232     /// data type signed int, data length 8 byte
233     typedef signed long long            MS_S64;                             // 8 bytes
234     /// data type float, data length 4 byte
235     typedef float                       MS_FLOAT;                           // 4 bytes
236     /// data type pointer content
237     typedef size_t                      MS_VIRT;                            // 8 bytes
238     /// data type hardware physical address
239     typedef size_t                      MS_PHYADDR;                         // 8 bytes
240     /// data type 64bit physical address
241     typedef MS_U64                      MS_PHY;                             // 8 bytes
242     /// data type size_t
243     typedef size_t                      MS_SIZE;                            // 8 bytes
244     /// definition for MS_BOOL
245     typedef unsigned char               MS_BOOL;                            // 1 byte
246     /// print type  MPRI_PHY
247     #define                             MPRI_PHY                            "%x"
248     /// print type  MPRI_PHY
249     #define                             MPRI_VIRT                           "%tx"
250 #endif
251 #endif
252 
253 #ifdef NULL
254 #undef NULL
255 #endif
256 #define NULL                        0
257 
258 
259 
260 
261 //-------------------------------------------------------------------------------------------------
262 //  Software Data Type
263 //-------------------------------------------------------------------------------------------------
264 
265 /// definition for VOID
266 typedef void                        VOID;
267 /// definition for FILEID
268 typedef MS_S32                      FILEID;
269 
270 //[TODO] use MS_U8, ... instead
271 // data type for 8051 code
272 //typedef MS_U16                      WORD;
273 //typedef MS_U8                       BYTE;
274 
275 #ifndef MSOS_TYPE_LINUX_KERNEL
276 #ifndef true
277 /// definition for true
278 #define true                        1
279 /// definition for false
280 #define false                       0
281 #endif
282 #endif //End undef MSOS_TYPE_LINUX_KERNEL
283 
284 #if !defined(TRUE) && !defined(FALSE)
285 /// definition for TRUE
286 #define TRUE                        1
287 /// definition for FALSE
288 #define FALSE                       0
289 #endif
290 
291 
292 #if defined(ENABLE) && (ENABLE!=1)
293 #warning ENALBE is not 1
294 #else
295 #define ENABLE                      1
296 #endif
297 
298 #if defined(DISABLE) && (DISABLE!=0)
299 #warning DISABLE is not 0
300 #else
301 #define DISABLE                     0
302 #endif
303 
304 
305 ///Define MS FB Format, to share with GE,GOP
306 /// FIXME THE NAME NEED TO BE REFINED, AND MUST REMOVE UNNESSARY FMT
307 typedef enum
308 {
309     /// color format I1
310     E_MS_FMT_I1                     = 0x0,
311     /// color format I2
312     E_MS_FMT_I2                     = 0x1,
313     /// color format I4
314     E_MS_FMT_I4                     = 0x2,
315     /// color format palette 256(I8)
316     E_MS_FMT_I8                     = 0x4,
317     /// color format blinking display
318     E_MS_FMT_FaBaFgBg2266  = 0x6,
319     /// color format for blinking display format
320     E_MS_FMT_1ABFgBg12355           = 0x7,
321     /// color format RGB565
322     E_MS_FMT_RGB565                 = 0x8,
323     /// color format ARGB1555
324     /// @note <b>[URANUS] <em>ARGB1555 is only RGB555</em></b>
325     E_MS_FMT_ARGB1555               = 0x9,
326     /// color format ARGB4444
327     E_MS_FMT_ARGB4444               = 0xa,
328     /// color format ARGB1555 DST
329     E_MS_FMT_ARGB1555_DST           = 0xc,
330     /// color format YUV422
331     E_MS_FMT_YUV422                 = 0xe,
332     /// color format ARGB8888
333     E_MS_FMT_ARGB8888               = 0xf,
334     /// color format RGBA5551
335     E_MS_FMT_RGBA5551               = 0x10,
336     /// color format RGBA4444
337     E_MS_FMT_RGBA4444               = 0x11,
338     /// Start of New color define
339     /// color format BGRA5551
340     E_MS_FMT_BGRA5551               = 0x12,
341     /// color format ABGR1555
342     E_MS_FMT_ABGR1555               = 0x13,
343     /// color format ABGR4444
344     E_MS_FMT_ABGR4444               = 0x14,
345     /// color format BGRA4444
346     E_MS_FMT_BGRA4444               = 0x15,
347     /// color format BGR565
348     E_MS_FMT_BGR565                 = 0x16,
349     /// color format RGBA8888
350     E_MS_FMT_RGBA8888               = 0x1d,
351     /// color format BGRA8888
352     E_MS_FMT_BGRA8888               = 0x1e,
353     /// color format ABGR8888
354     E_MS_FMT_ABGR8888               = 0x1f,
355     /// color format AYUV8888
356     E_MS_FMT_AYUV8888               = 0x20,
357 
358     E_MS_FMT_GENERIC                = 0xFFFF,
359 
360 } MS_ColorFormat;
361 
362 typedef union _MSIF_Version
363 {
364     struct _DDI
365     {
366         MS_U8                       tag[4];
367         MS_U8                       type[2];
368         MS_U16                      customer;
369         MS_U16                      model;
370         MS_U16                      chip;
371         MS_U8                       cpu;
372         MS_U8                       name[4];
373         MS_U8                       version[2];
374         MS_U8                       build[2];
375         MS_U8                       change[8];
376         MS_U8                       os;
377     } DDI;
378     struct _MW
379     {
380         MS_U8                                     tag[4];
381         MS_U8                                     type[2];
382         MS_U16                                    customer;
383         MS_U16                                    mod;
384         MS_U16                                    chip;
385         MS_U8                                     cpu;
386         MS_U8                                     name[4];
387         MS_U8                                     version[2];
388         MS_U8                                     build[2];
389         MS_U8                                     changelist[8];
390         MS_U8                                     os;
391     } MW;
392     struct _APP
393     {
394         MS_U8                                     tag[4];
395         MS_U8                                     type[2];
396         MS_U8                                     id[4];
397         MS_U8                                     quality;
398         MS_U8                                     version[4];
399         MS_U8                                     time[6];
400         MS_U8                                     changelist[8];
401         MS_U8                                     reserve[3];
402     } APP;
403 } MSIF_Version;
404 
405 typedef struct _MS_SW_VERSION_INFO
406 {
407     char    UtopiaBspVersion[8];    //Utopia BSP Version
408     char    MajorVersion[4];        //Major Version Number
409     char    MinorVersion[4];        //Minor Version Number
410     char    ChangeList_API[16];     //Sync Perforce Change List Number in API Folder
411     char    ChangeList_DRV[16];     //Sync Perforce Change List Number in DRV Folder
412     char    ChangeList_HAL[16];     //Sync Perforce Change List Number in HAL Folder
413 
414 } MS_SW_VERSION_INFO;
415 
416 typedef struct _MS_SW_VERSION_NUM
417 {
418     char    UtopiaBspVersion[32];
419     MS_U32  UtopiaVerNum;
420 } MS_SW_VERSION_NUM;
421 
422 /*
423  * function pointers
424  */
425 typedef MS_U32 (*FUtopiaOpen)(void** ppInstance, const void* const pAttribute);
426 typedef MS_U32 (*FUtopiaIOctl)(void* pInstance,
427         MS_U32 u32Cmd, void* const pArgs);
428 typedef MS_U32 (*FUtopiaClose)(void* pInstance);
429 typedef MS_U32 (*FUtopiaSTR)(MS_U32 u32PowerState, void* pModule);
430 
431 #ifdef CONFIG_UTOPIA_FRAMEWORK_KERNEL_DRIVER_STRUCT_PACKED
432 #define DLL_PACKED                      __attribute__((__packed__))
433 #else
434 #define DLL_PACKED
435 #endif
436 
437 #endif // _MS_TYPES_H_
438