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 #include "UFO.h" 113 //------------------------------------------------------------------------------------------------- 114 // System Data Type 115 //------------------------------------------------------------------------------------------------- 116 #define SUPPORT_ANDROID_L_PHYVIR_TYPE 117 118 #if defined(UFO_PUBLIC_HEADER_300) 119 /// data type unsigned char, data length 1 byte 120 typedef unsigned char MS_U8; // 1 byte 121 /// data type unsigned short, data length 2 byte 122 typedef unsigned short MS_U16; // 2 bytes 123 /// data type unsigned int, data length 4 byte 124 typedef unsigned long MS_U32; // 4 bytes 125 /// data type unsigned int, data length 8 byte 126 typedef unsigned long long MS_U64; // 8 bytes 127 /// data type signed char, data length 1 byte 128 typedef signed char MS_S8; // 1 byte 129 /// data type signed short, data length 2 byte 130 typedef signed short MS_S16; // 2 bytes 131 /// data type signed int, data length 4 byte 132 typedef signed long MS_S32; // 4 bytes 133 /// data type signed int, data length 8 byte 134 typedef signed long long MS_S64; // 8 bytes 135 /// data type float, data length 4 byte 136 typedef float MS_FLOAT; // 4 bytes 137 /// data type pointer content 138 typedef MS_U32 MS_VIRT; // 8 bytes 139 /// data type hardware physical address 140 typedef MS_U32 MS_PHYADDR; // 8 bytes 141 /// data type 64bit physical address 142 typedef MS_U32 MS_PHY; // 8 bytes 143 /// data type size_t 144 typedef size_t MS_SIZE; // 8 bytes 145 /// definition for MS_BOOL 146 typedef unsigned char MS_BOOL; // 1 byte 147 /// print type MPRI_DEC 148 #define MPRI_DEC "%ld" 149 /// print type MPRI_UDEC 150 #define MPRI_UDEC "%lu" 151 /// print type MPRI_HEX 152 #define MPRI_HEX "%lx" 153 #elif defined(UFO_PUBLIC_HEADER_212) 154 /// data type unsigned char, data length 1 byte 155 typedef unsigned char MS_U8; // 1 byte 156 /// data type unsigned short, data length 2 byte 157 typedef unsigned short MS_U16; // 2 bytes 158 /// data type unsigned int, data length 4 byte 159 typedef unsigned long MS_U32; // 4 bytes 160 /// data type unsigned int, data length 8 byte 161 typedef unsigned long long MS_U64; // 8 bytes 162 /// data type signed char, data length 1 byte 163 typedef signed char MS_S8; // 1 byte 164 /// data type signed short, data length 2 byte 165 typedef signed short MS_S16; // 2 bytes 166 /// data type signed int, data length 4 byte 167 typedef signed long MS_S32; // 4 bytes 168 /// data type signed int, data length 8 byte 169 typedef signed long long MS_S64; // 8 bytes 170 /// data type float, data length 4 byte 171 typedef float MS_FLOAT; // 4 bytes 172 /// data type pointer content 173 typedef MS_U32 MS_VIRT; // 4 bytes 174 /// data type hardware physical address 175 typedef MS_U32 MS_PHYADDR; // 8 bytes 176 /// data type 64bit physical address 177 typedef MS_U32 MS_PHY; // 4 bytes 178 /// data type null pointer 179 /// definition for MS_BOOL 180 typedef unsigned char MS_BOOL; 181 /// data type size_t 182 typedef MS_U32 MS_SIZE; // 4 bytes 183 #else 184 #if defined (__aarch64__) 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 int MS_U32; // 4 bytes 191 /// data type unsigned int, data length 8 byte 192 typedef unsigned 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 int MS_S32; // 4 bytes 199 /// data type signed int, data length 8 byte 200 typedef signed 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 size_t MS_VIRT; // 8 bytes 205 /// data type hardware physical address 206 typedef size_t MS_PHYADDR; // 8 bytes 207 /// data type size_t 208 typedef size_t MS_SIZE; // 8 bytes 209 /// data type 64bit physical address 210 typedef MS_U64 MS_PHY; // 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_VIRT 216 #define MPRI_VIRT "%tx" 217 #elif defined(MSOS_TYPE_NUTTX) 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 long 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 long 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 MS_U32 MS_VIRT; // 8 bytes 238 /// data type hardware physical address 239 typedef MS_U32 MS_PHYADDR; // 8 bytes 240 /// data type 64bit physical address 241 typedef MS_U32 MS_PHY; // 8 bytes 242 /// data type size_t 243 typedef MS_U32 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 #else 251 #if (defined(CONFIG_PURE_SN) || defined(CONFIG_MBOOT)) 252 /// data type unsigned char, data length 1 byte 253 typedef unsigned char MS_U8; // 1 byte 254 /// data type unsigned short, data length 2 byte 255 typedef unsigned short MS_U16; // 2 bytes 256 /// data type unsigned int, data length 4 byte 257 typedef unsigned long MS_U32; // 4 bytes 258 /// data type unsigned int, data length 8 byte 259 typedef unsigned long long MS_U64; // 8 bytes 260 /// data type signed char, data length 1 byte 261 typedef signed char MS_S8; // 1 byte 262 /// data type signed short, data length 2 byte 263 typedef signed short MS_S16; // 2 bytes 264 /// data type signed int, data length 4 byte 265 typedef signed long MS_S32; // 4 bytes 266 /// data type signed int, data length 8 byte 267 typedef signed long long MS_S64; // 8 bytes 268 /// data type float, data length 4 byte 269 typedef float MS_FLOAT; // 4 bytes 270 /// data type pointer content 271 typedef MS_U32 MS_VIRT; // 8 bytes 272 /// data type hardware physical address 273 typedef MS_U32 MS_PHYADDR; // 8 bytes 274 /// data type 64bit physical address 275 typedef MS_U32 MS_PHY; // 8 bytes 276 /// data type size_t 277 typedef MS_U32 MS_SIZE; // 8 bytes 278 /// definition for MS_BOOL 279 typedef unsigned char MS_BOOL; // 1 byte 280 /// print type MPRI_PHY 281 #define MPRI_PHY "%x" 282 /// print type MPRI_PHY 283 #define MPRI_VIRT "%tx" 284 #else 285 /// data type unsigned char, data length 1 byte 286 typedef unsigned char MS_U8; // 1 byte 287 /// data type unsigned short, data length 2 byte 288 typedef unsigned short MS_U16; // 2 bytes 289 /// data type unsigned int, data length 4 byte 290 typedef unsigned int MS_U32; // 4 bytes 291 /// data type unsigned int, data length 8 byte 292 typedef unsigned long long MS_U64; // 8 bytes 293 /// data type signed char, data length 1 byte 294 typedef signed char MS_S8; // 1 byte 295 /// data type signed short, data length 2 byte 296 typedef signed short MS_S16; // 2 bytes 297 /// data type signed int, data length 4 byte 298 typedef signed int MS_S32; // 4 bytes 299 /// data type signed int, data length 8 byte 300 typedef signed long long MS_S64; // 8 bytes 301 /// data type float, data length 4 byte 302 typedef float MS_FLOAT; // 4 bytes 303 /// data type pointer content 304 typedef size_t MS_VIRT; // 8 bytes 305 /// data type hardware physical address 306 typedef size_t MS_PHYADDR; // 8 bytes 307 /// data type 64bit physical address 308 typedef MS_U64 MS_PHY; // 8 bytes 309 /// data type size_t 310 typedef size_t MS_SIZE; // 8 bytes 311 /// definition for MS_BOOL 312 typedef unsigned char MS_BOOL; // 1 byte 313 /// print type MPRI_PHY 314 #define MPRI_PHY "%x" 315 /// print type MPRI_PHY 316 #define MPRI_VIRT "%tx" 317 #endif 318 #endif 319 #endif 320 #ifdef NULL 321 #undef NULL 322 #endif 323 #define NULL 0 324 325 326 327 328 //------------------------------------------------------------------------------------------------- 329 // Software Data Type 330 //------------------------------------------------------------------------------------------------- 331 332 /// definition for VOID 333 typedef void VOID; 334 /// definition for FILEID 335 typedef MS_S32 FILEID; 336 337 //[TODO] use MS_U8, ... instead 338 // data type for 8051 code 339 //typedef MS_U16 WORD; 340 //typedef MS_U8 BYTE; 341 342 #ifndef MSOS_TYPE_LINUX_KERNEL 343 #ifndef true 344 /// definition for true 345 #define true 1 346 /// definition for false 347 #define false 0 348 #endif 349 #endif //End undef MSOS_TYPE_LINUX_KERNEL 350 351 #if !defined(TRUE) && !defined(FALSE) 352 /// definition for TRUE 353 #define TRUE 1 354 /// definition for FALSE 355 #define FALSE 0 356 #endif 357 358 359 #if defined(ENABLE) && (ENABLE!=1) 360 #warning ENALBE is not 1 361 #else 362 #define ENABLE 1 363 #endif 364 365 #if defined(DISABLE) && (DISABLE!=0) 366 #warning DISABLE is not 0 367 #else 368 #define DISABLE 0 369 #endif 370 371 372 ///Define MS FB Format, to share with GE,GOP 373 /// FIXME THE NAME NEED TO BE REFINED, AND MUST REMOVE UNNESSARY FMT 374 typedef enum 375 { 376 /// color format I1 377 E_MS_FMT_I1 = 0x0, 378 /// color format I2 379 E_MS_FMT_I2 = 0x1, 380 /// color format I4 381 E_MS_FMT_I4 = 0x2, 382 /// color format palette 256(I8) 383 E_MS_FMT_I8 = 0x4, 384 /// color format blinking display 385 E_MS_FMT_FaBaFgBg2266 = 0x6, 386 /// color format for blinking display format 387 E_MS_FMT_1ABFgBg12355 = 0x7, 388 /// color format RGB565 389 E_MS_FMT_RGB565 = 0x8, 390 /// color format ARGB1555 391 /// @note <b>[URANUS] <em>ARGB1555 is only RGB555</em></b> 392 E_MS_FMT_ARGB1555 = 0x9, 393 /// color format ARGB4444 394 E_MS_FMT_ARGB4444 = 0xa, 395 /// color format ARGB1555 DST 396 E_MS_FMT_ARGB1555_DST = 0xc, 397 /// color format YUV422 398 E_MS_FMT_YUV422 = 0xe, 399 /// color format ARGB8888 400 E_MS_FMT_ARGB8888 = 0xf, 401 /// color format RGBA5551 402 E_MS_FMT_RGBA5551 = 0x10, 403 /// color format RGBA4444 404 E_MS_FMT_RGBA4444 = 0x11, 405 /// Start of New color define 406 /// color format BGRA5551 407 E_MS_FMT_BGRA5551 = 0x12, 408 /// color format ABGR1555 409 E_MS_FMT_ABGR1555 = 0x13, 410 /// color format ABGR4444 411 E_MS_FMT_ABGR4444 = 0x14, 412 /// color format BGRA4444 413 E_MS_FMT_BGRA4444 = 0x15, 414 /// color format BGR565 415 E_MS_FMT_BGR565 = 0x16, 416 /// color format RGBA8888 417 E_MS_FMT_RGBA8888 = 0x1d, 418 /// color format BGRA8888 419 E_MS_FMT_BGRA8888 = 0x1e, 420 /// color format ABGR8888 421 E_MS_FMT_ABGR8888 = 0x1f, 422 /// color format AYUV8888 423 E_MS_FMT_AYUV8888 = 0x20, 424 425 E_MS_FMT_GENERIC = 0xFFFF, 426 427 } MS_ColorFormat; 428 429 typedef union _MSIF_Version 430 { 431 struct _DDI 432 { 433 MS_U8 tag[4]; 434 MS_U8 type[2]; 435 MS_U16 customer; 436 MS_U16 model; 437 MS_U16 chip; 438 MS_U8 cpu; 439 MS_U8 name[4]; 440 MS_U8 version[2]; 441 MS_U8 build[2]; 442 MS_U8 change[8]; 443 MS_U8 os; 444 } DDI; 445 struct _MW 446 { 447 MS_U8 tag[4]; 448 MS_U8 type[2]; 449 MS_U16 customer; 450 MS_U16 mod; 451 MS_U16 chip; 452 MS_U8 cpu; 453 MS_U8 name[4]; 454 MS_U8 version[2]; 455 MS_U8 build[2]; 456 MS_U8 changelist[8]; 457 MS_U8 os; 458 } MW; 459 struct _APP 460 { 461 MS_U8 tag[4]; 462 MS_U8 type[2]; 463 MS_U8 id[4]; 464 MS_U8 quality; 465 MS_U8 version[4]; 466 MS_U8 time[6]; 467 MS_U8 changelist[8]; 468 MS_U8 reserve[3]; 469 } APP; 470 } MSIF_Version; 471 472 typedef struct _MS_SW_VERSION_INFO 473 { 474 char UtopiaBspVersion[8]; //Utopia BSP Version 475 char MajorVersion[4]; //Major Version Number 476 char MinorVersion[4]; //Minor Version Number 477 char ChangeList_API[16]; //Sync Perforce Change List Number in API Folder 478 char ChangeList_DRV[16]; //Sync Perforce Change List Number in DRV Folder 479 char ChangeList_HAL[16]; //Sync Perforce Change List Number in HAL Folder 480 481 } MS_SW_VERSION_INFO; 482 483 typedef struct _MS_SW_VERSION_NUM 484 { 485 char UtopiaBspVersion[32]; 486 MS_U32 UtopiaVerNum; 487 } MS_SW_VERSION_NUM; 488 489 /* 490 * function pointers 491 */ 492 typedef MS_U32 (*FUtopiaOpen)(void** ppInstance, const void* const pAttribute); 493 typedef MS_U32 (*FUtopiaIOctl)(void* pInstance, 494 MS_U32 u32Cmd, void* const pArgs); 495 typedef MS_U32 (*FUtopiaClose)(void* pInstance); 496 typedef MS_U32 (*FUtopiaSTR)(MS_U32 u32PowerState, void* pModule); 497 typedef MS_U32 (*FUtopiaMdbIoctl)(MS_U32 cmd, const void* const pArgs); 498 499 #define DLL_PACKED 500 501 #endif // _MS_TYPES_H_ 502