vmsys_sdk.h 42.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303
/*****************************************************************************
*  Copyright Statement:
*  --------------------
*  This software is protected by Copyright and the information contained
*  herein is confidential. The software may not be copied and the information
*  contained herein may not be used or disclosed except with the written
*  permission of MediaTek Inc. (C) 2006
*
*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
*
*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/

#ifndef VMSYS_SDK_H_
#define VMSYS_SDK_H_

#ifdef __cplusplus
extern "C" {
#endif

#ifndef TRUE
#define TRUE 1
#endif

#ifndef FALSE
#define FALSE 0
#endif

#ifndef NULL
#define NULL 0
#endif


/* start MRE environment normally */
#define VM_NORMAL_START_MRE_ENV 1


typedef unsigned char VMUINT8;
typedef unsigned short VMUINT16;
typedef unsigned int VMUINT;
typedef unsigned long VMUINT32;


typedef  unsigned long long VMUINT64 ;
typedef  long long VMINT64 ;


typedef char VMINT8;
typedef short VMINT16;
typedef int  VMINT;
typedef long  VMINT32;

typedef VMUINT8 VMUCHAR;
typedef VMUINT16 VMUWCHAR;
typedef VMUINT8 * VMUSTR;
typedef VMUINT16 * VMUWSTR;

typedef VMINT8 VMCHAR;
typedef VMINT16 VMWCHAR;
typedef VMINT8 * VMSTR;
typedef VMINT16 * VMWSTR;

typedef unsigned char VMBYTE;
typedef unsigned short VMUSHORT;
typedef short VMSHORT;

typedef VMINT VMFILE;
typedef VMINT VMBOOL;
#define VM_PROF_NORMAL_MODE     0   /* normal mode */
#define VM_PROF_MEETING_MODE    1   /* Meeting mode */
#define VM_PROF_SILENT_MODE     2   /* Silnet mode */
#define VM_PROF_HEADSET_MODE    3   /* Headset mode */
#define VM_PROF_BLUETOOTH_MODE  4   /* Bluetooth profile */

typedef struct vm_time_t {
	VMINT year;		
	VMINT mon;		/* month, begin from 1	*/
	VMINT day;		/* day,begin from  1 */
	VMINT hour;		/* house, 24-hour	*/
	VMINT min;		/* minute	*/
	VMINT sec;		/* second	*/
} vm_time_t;

typedef enum
{
   VM_TOUCH_FEEDBACK_DOWN,
    VM_TOUCH_FEEDBACK_DOWN_VIBRATE,
    VM_TOUCH_FEEDBACK_DOWN_TONE,
    VM_TOUCH_FEEDBACK_HOLD,
    VM_TOUCH_FEEDBACK_SPECIAL,
    VM_TOUCH_FEEDBACK_TOTAL
} vm_touch_feedback_enum;


typedef enum
{
	VM_MAINLCD_BRIGHTNESS_LEVEL0   =0  ,  /* TURN OFF*/
    VM_MAINLCD_BRIGHTNESS_LEVEL1  ,
    VM_MAINLCD_BRIGHTNESS_LEVEL2  ,
    VM_MAINLCD_BRIGHTNESS_LEVEL3  ,
    VM_MAINLCD_BRIGHTNESS_LEVEL4  ,
    VM_MAINLCD_BRIGHTNESS_LEVEL5  ,
	VM_MAINLCD_BRIGHTNESS_LEVEL6	,
    VM_MAINLCD_BRIGHTNESS_LEVEL7  ,
    VM_MAINLCD_BRIGHTNESS_LEVEL8  ,
    VM_MAINLCD_BRIGHTNESS_LEVEL9	,
    VM_MAINLCD_BRIGHTNESS_LEVEL10	,
    VM_MAINLCD_BRIGHTNESS_LEVEL11 ,
    VM_MAINLCD_BRIGHTNESS_LEVEL12 ,
    VM_MAINLCD_BRIGHTNESS_LEVEL13 ,
    VM_MAINLCD_BRIGHTNESS_LEVEL14 ,
    VM_MAINLCD_BRIGHTNESS_LEVEL15 ,
    VM_MAINLCD_BRIGHTNESS_LEVEL16 ,
    VM_MAINLCD_BRIGHTNESS_LEVEL17 ,
    VM_MAINLCD_BRIGHTNESS_LEVEL18 ,
    VM_MAINLCD_BRIGHTNESS_LEVEL19 ,
    VM_MAINLCD_BRIGHTNESS_LEVEL20 ,
    VM_MAINLCD_BRIGHTNESS_20LEVEL_MAX /* DO NOT USE THIS */
} vm_mainlcd_brightness_level_enum;


/*****************************************************************************
 * FUNCTION
 *  vm_get_time
 * DESCRIPTION
 *  get current system time 
 * PARAMETERS
 *  time : [OUT] time structure
 * RETURNS
 *  if succeed, return 0, otherwise return -1
 *****************************************************************************/ 
VMINT vm_get_time(vm_time_t* time);

/*****************************************************************************
 * FUNCTION
 *  vm_get_curr_utc
 * DESCRIPTION
 * Get the time since the Epoch (00:00:00 UTC, January 1, 1970),
 * measured in seconds.
 * PARAMETERS
 *  utc : [OUT] point to the time in seconds.
 * RETURNS
 *  if succeed, return 0, otherwise failure.
 *****************************************************************************/
VMINT vm_get_curr_utc(VMUINT * utc);


/*the statistic of memory using status */
typedef struct malloc_stat_t {
	/* the number if the malloc memory API is called, including vm_malloc(),vm_realloc(), * vm_calloc()   */
	VMINT malloc_count;

	/*the number of free memory API is called	 */
	VMINT free_count;

	/*current used memory */
	VMINT current;

	/*peak memory*/
	VMINT peak;

	/*the number of memory malloc fail*/
	VMINT fail_times;

	/* the max size that malloc memory failed */
	VMINT max_fail_size;

	/* current avail heap size  */
	VMINT avail_heap_size;
} malloc_stat_t;

typedef void (*AppASMStopCBPtr) (void );
typedef void (*AppASMSuccessCBPtr) (void);


typedef enum vm_mutex_state
{
    VM_MUTEX_STATE_TAKEN = 0,
    VM_MUTEX_STATE_GIVEN,
} vm_mutex_state;

typedef struct vm_mutex_struct
{
    volatile int state;
} vm_mutex_struct;


/* MRE application memory structure */
typedef struct
{
    VMUINT8* mem_base;
    VMINT   mem_size;
    AppASMStopCBPtr stop_cb;
    VMINT p_handle;
	VMINT index;
    void* adm_id;
    VMUWSTR name_buf[3]; /* support English, SC, and TC, and maxium size of tag is 256 */
	VMUWCHAR p_name[260];
	VMINT multiname;
#ifdef MRE_ENABLE_MEM_DEBUG
    malloc_stat_t mem_stat;
#endif
    VMINT heap_size;
    VMINT user_mem; // the memory is passed to MRE from preload app APP
    vm_mutex_struct mutex;
}vm_app_mem_struct;


typedef VMUINT32      VMCOLOR32;

typedef float         VMFLOAT;

typedef VMINT32       VMMSEC;

typedef VMINT32       VMRESID;

typedef VMINT32       VMID;

#define VM_TRUE       TRUE
#define VM_FALSE      FALSE

#ifdef WIN32
#define VM_ASSERT(__expr__) \
do {                        \
    if (!(__expr__))        \
    {                       \
        _asm {int 3}        \
    }                       \
} while (0)
#else
#define VM_ASSERT(expr)
#endif

#define VM_PI         3.1415926f

/* General color type methods */
#define VM_COLOR32_MAKE(a, r, g, b)      ((VMCOLOR32)((VMUINT32)(a) << 24 | (VMUINT32)(r) << 16 | (VMUINT32)(g) << 8 | (VMUINT32)(b)))
#define VM_COLOR32_GET_A(c)              ((c) >> 24)
#define VM_COLOR32_GET_R(c)              ((c) << 8 >> 24)
#define VM_COLOR32_GET_G(c)              ((c) << 16 >> 24)
#define VM_COLOR32_GET_B(c)              ((c) << 24 >> 24)

/* default colors */
#define VM_COLOR32_BLACK                 VM_COLOR32_MAKE(255, 0, 0, 0)
#define VM_COLOR32_WHITE                 VM_COLOR32_MAKE(255, 255, 255, 255)
#define VM_COLOR32_RED                   VM_COLOR32_MAKE(255, 255, 0, 0)
#define VM_COLOR32_GREEN                 VM_COLOR32_MAKE(255, 0, 255, 0)
#define VM_COLOR32_BLUE                  VM_COLOR32_MAKE(255, 0, 0, 255)
#define VM_COLOR32_AQUA                  VM_COLOR32_MAKE(255, 0, 255, 255)
#define VM_COLOR32_FUCHSIA               VM_COLOR32_MAKE(255, 255, 0, 255)
#define VM_COLOR32_YELLOW                VM_COLOR32_MAKE(255, 255, 255, 0)
#define VM_COLOR32_GREY                  VM_COLOR32_MAKE(255, 128, 128, 128)
#define VM_COLOR32_TEAL                  VM_COLOR32_MAKE(255, 0, 128, 128)
#define VM_COLOR32_PURPLE                VM_COLOR32_MAKE(255, 128, 0, 128)
#define VM_COLOR32_OLIVE                 VM_COLOR32_MAKE(255, 128, 128, 0)
#define VM_COLOR32_SILVER                VM_COLOR32_MAKE(255, 192, 192, 192)
#define VM_COLOR32_TRANSPARENT           VM_COLOR32_MAKE(0, 0, 0, 255)

/* Redian convert macros */
#define VM_DEG_TO_RAD(x)               ((VMFLOAT)((VMFLOAT)(x)) * VM_PI / 180.0f)
#define VM_RAD_TO_DEG(x)               ((VMFLOAT)((VMFLOAT)(x)) * 180.0f / VM_PI)

/* Float, Fixed conversion */
#define VM_X_TO_F(x)                   ((VMFLOAT)x / 65536.0f)
#define VM_F_TO_X(x)                   (VMINT32)((x) * 65536.0f)


/* MRE module structure */
typedef struct
{
    VMUINT   mod_core_base       : 1;
    VMUINT   mod_core_sandbox    : 1;
    VMUINT   mod_core_resmgr     : 1;
    VMUINT   mod_core_safety     : 1;
    VMUINT   mod_core_commu      : 1;
    VMUINT   mod_core_sm         : 1;
    VMUINT   mod_core_so         : 1;
    VMUINT   mod_lib_appres      : 1;
    VMUINT   mod_lib_c           : 1;
    VMUINT   mod_lib_chset       : 1;
    VMUINT   mod_lib_defgame     : 1;
    VMUINT   mod_lib_ddraw       : 1;
    VMUINT   mod_lib_gfxold      : 1;
    VMUINT   mod_lib_image       : 1;
    VMUINT   mod_lib_http        : 1;
    VMUINT   mod_lib_ime         : 1;
    VMUINT   mod_lib_ini         : 1;
    VMUINT   mod_lib_log         : 1;
    VMUINT   mod_lib_mullang     : 1;
    VMUINT   mod_lib_network     : 1;
    VMUINT   mod_lib_vip         : 1;
    VMUINT   mod_lib_vip_vg      : 1;
    VMUINT   mod_lib_xml         : 1;
    VMUINT   mod_sal_audio       : 1;
    VMUINT   mod_sal_bitstream   : 1;
    VMUINT   mod_sal_camera      : 1;
    VMUINT   mod_sal_cell        : 1;
    VMUINT   mod_sal_che_des     : 1;
    VMUINT   mod_sal_che_md5     : 1;
    VMUINT   mod_sal_che_sha1    : 1;
    VMUINT   mod_sal_gps         : 1;
    VMUINT   mod_sal_mms         : 1;
    VMUINT   mod_sal_phonebook   : 1;
    VMUINT   mod_sal_sensor      : 1;
    VMUINT   mod_sal_sim         : 1;
    VMUINT   mod_sal_sms         : 1;
    VMUINT   mod_sal_socket      : 1;
    VMUINT   mod_sal_status      : 1;
    VMUINT   mod_sal_tele        : 1;
    VMUINT   mod_sal_timer       : 1;
    VMUINT   mod_sal_video       : 1;
    VMUINT   mod_sal_wallpaper   : 1;
    VMUINT   mod_sal_wps         : 1;
    VMUINT   mod_app_launch      : 1;
    VMUINT   mod_sal_payment     : 1;
}vm_module_struct;

typedef enum
{
    VM_SCREEN_ROTATE_0,   /* Normal screen */
    VM_SCREEN_ROTATE_90,  /* Rotate 90 clockwise */
    VM_SCREEN_ROTATE_180, /* Rotate 180 */
    VM_SCREEN_ROTATE_270, /* Rotate 270 clockwise */

	/*Add new enums above this*/
	VM_SCREEN_ROTATE_END = 0XFFFF
} vm_screen_rotate_enum;

/*****************************************************************************
 * FUNCTION
 *  vm_get_malloc_stat
 * DESCRIPTION
 *  get current memory management data after the memory management is available 
 * PARAMETERS
 *  void
 * RETURNS
 *  the memory status structure pointer
 *****************************************************************************/ 
malloc_stat_t* vm_get_malloc_stat(void);

/*****************************************************************************
* FUNCTION
 *    vm_malloc
 * DESCRIPTION
 *  allocate specified size of memory 
 * PARAMETERS
 *  size : [IN]  size of byte to be allocated.
 * RETURNS
 *  memory pointer allocated, NULL means allocation failed.
*****************************************************************************/
void *vm_malloc(int size);

/*****************************************************************************
* FUNCTION
 *    vm_calloc
 * DESCRIPTION
 *  allocate specified size of memory and clean as zero.
 * PARAMETERS
 *  size : [IN]  size of byte to be allocated.
 * RETURNS
 *  memory pointer allocated, NULL means allocation failed.
*****************************************************************************/
void *vm_calloc(int size);

/*****************************************************************************
* FUNCTION
 *    vm_realloc
 * DESCRIPTION
 *  reallocate specified size of memory for the memory already allocated before.
 * PARAMETERS
 *  p : [IN] memory pointer to be realloced.
 *  size : [IN]  size of byte to be allocated.
 * RETURNS
 *  memory pointer allocated; NULL means allocation failed, but the original pointer will not free.
*****************************************************************************/
void *vm_realloc(void* p, int size);

/*****************************************************************************
* FUNCTION
 *    vm_free
 * DESCRIPTION
 *  free memory allocated by vm_malloc(), vm_calloc(), or vm_realloc().
 * PARAMETERS
 *  ptr : [IN]  memory pointer to be free.
*****************************************************************************/
void vm_free(void* ptr);

/*****************************************************************************
* FUNCTION
 *    vm_global_malloc
 * DESCRIPTION
 *  allocate extra memory excluding the size announced when packing, size must larger than 10KB. 
 * PARAMETERS
 *  size : [IN]  size of byte to be allocated.
 * RETURNS
 *  memory pointer allocated, NULL means allocation failed.
*****************************************************************************/
void *vm_global_malloc(unsigned int size);


/*****************************************************************************
* FUNCTION
 *    vm_free
 * DESCRIPTION
 *  free memory allocated by vm_global_malloc();
 * PARAMETERS
 *  ptr : [IN]  memory pointer to be free.
*****************************************************************************/
void vm_global_free(void* ptr);


/*****************************************************************************
* FUNCTION
 *    vm_global_get_max_alloc_size
 * DESCRIPTION
 *  Get the max possible size of single allocation from app-based ASM. 
 *
 *  Remark: we can use this function to dynamically decide the allocation size 
 *  (for example, use larger image cache when there is more memory)
 *  
 *  However, sometimes we cannot allocate 2 * 10KB blocks if the maximum allocation size 
 *  is 20KB because of the overheads of memory management bookkeeping. 
 *
 *  It is suggested to use "fail-safe" allocation regardless the internal 
 *  implementation of ASM if we want to allocate more memory adaptively according
 *  to the free space
 *  Step 1. Decide the size of free space => e.g. 100KB
 *  Step 2. Allocate 100KB
 *  Step 3. If failed, allocate 95 KB
 *  Step 4. If failed, allocate 90 KB
 *  Step 5. ...
 * PARAMETERS
 *  void
 * RETURNS
 *  memory size
*****************************************************************************/
VMINT vm_global_get_max_alloc_size(void);


/*****************************************************************************
* FUNCTION
*    vm_main
* DESCRIPTION
*  This is entry function of application and application must implement it.
*****************************************************************************/
void vm_main(void);

/**
 * the message of asking for application to repaint screen.
 */
#define VM_MSG_PAINT			1

/**
 * the message of application state from inactive to active.
 */
#define VM_MSG_ACTIVE			2

/**
 * the message of application state from active to inactive.
 */
#define VM_MSG_INACTIVE		3

/**
 * the message of creation of application
 */
#define VM_MSG_CREATE			4

/**
 * the message of quit of application
 */
#define VM_MSG_QUIT			5

/**
 * the message of application state from foreground running to background running.
 */
#define VM_MSG_HIDE			6

/**
 * the message to notify application memory card has been plug out.
 */
#define VM_MSG_CARD_PLUG_OUT		7

/**
 * the message when screen rotate.
 */
#define VM_MSG_SCREEN_ROTATE 8

/**
 * the message of application when foreground running and receive PUSH Message.
 */
#define VM_MSG_PUSH			9

#define VM_MSG_RESTART_PARENT  100


/*****************************************************************************
* FUNCTION
 *    vm_reg_sysevt_callback
 * DESCRIPTION
 *  register system message callback function.
 * PARAMETERS
 *  f : [IN] callback function.
*****************************************************************************/
void vm_reg_sysevt_callback(void (*f)(VMINT message, VMINT param));

/* DOM-NOT_FOR_SDK-BEGIN */

#define VM_MSG_CONFIRM_EXIT     1001
#define VM_MSG_FORCE_FREE     1002

/**
 *  The reason of HIDE or PAINT Event
 */
enum {
	SCREEN_POPUP = 0, 	/* HIDE or PAINT cause of POPUP£¬like incoming call, sms, input method, etc. */
	USER_END_KEY		/* HIDE cause of END key */
};

/**
 * System event structure
 */
typedef struct _vm_sysevt_param_t
{
	VMINT evt_cause; 	/* Reason of the event */
	void * evt_detail; 	/* reserved */
} vm_sysevt_param_t;

/*****************************************************************************
* FUNCTION
 *    vm_malloc
 * DESCRIPTION
 *  allocate non-cacheable  memory 
 * PARAMETERS
 *  size : [IN]  size of byte to be allocated.
 * RETURNS
 *  memory pointer allocated, NULL means allocation failed.
*****************************************************************************/
void *vm_malloc_nc(int size);

/* DOM-NOT_FOR_SDK-END */

/*****************************************************************************
* FUNCTION
*    vm_exit_app
* DESCRIPTION
*  MRE application call this function to quit. 
*****************************************************************************/
void vm_exit_app(void);

/* DOM-NOT_FOR_SDK-BEGIN */
// do not support this function
/*****************************************************************************
* FUNCTION
*    vm_exit_and_update_app
* DESCRIPTION
*  MRE application call this function to quit and update application itself.
*****************************************************************************/
void vm_exit_and_update_app(void);
/* DOM-NOT_FOR_SDK-END */


/*****************************************************************************
 * FUNCTION
 *  vm_get_tick_count
 * DESCRIPTION
 *  get millisecond number from the system power on till now
 * PARAMETERS
 *  void
 * RETURNS
 *  millisecond number from the system power on till now
 *****************************************************************************/ 
VMINT vm_get_tick_count(void);

/*****************************************************************************
* FUNCTION
 *    vm_get_exec_filename
 * DESCRIPTION
 *  get current application file name
 * PARAMETERS
 *  filename: [OUT] output file name string encoding with UCS2 format.
 * RETURNS
 *  if 0, file name will output to the parameter filename, else means there is no application running.
*****************************************************************************/
VMINT vm_get_exec_filename(VMWSTR filename);


/*mre user ID, corresponding to the value : a string with max length 20(unit:VMCHAR)    e.g. 100973*/
#define MRE_SYS_SUBSCRIBER_ID		(1) 

/*mre system user agent, corresponding to the value : a string with max length 20(unit:VMCHAR)    e.g. Gionee-A10*/
#define MRE_SYS_EQUIPMENT_ID		(2)

/*mre version,corresponding to the value : a string with max length 12(unit:VMCHAR) 
 *naming rule :"main version number.sub-version number.release number",e.g. 1.2.6 */
#define MRE_SYS_VERSION				(3)

/*platform version,corresponding to the value :a string with max length 30(unit:VMCHAR). e.g. MT6225_08A_VERSION*/
#define MRE_SYS_HOST_VERSION		(4)

/*Max memory that MRE can get,corresponding to the value :a string with max length 6(unit:VMCHAR), it can be change to
*number by atoi function(unit:KB), the memory is the sum of MRE system memory and app memory. e.g. 800*/
#define MRE_SYS_HOST_MAX_MEM		(5)

/*MRE system home path,corresponding to the value :a string with max length 30(unit:VMCHAR),e.g. C:\MRE*/
#define MRE_SYS_HOME_DIR			(6)

/*platform build date and time :a string with max length 30(unit:VMCHAR). e.g. 2012/02/09 11:47*/
#define MRE_SYS_BUILD_DATE_TIME		(7)

/*platform release branch and info. e.g. 11B NEUTRON52_12864*/
#define MRE_SYS_RELEASE_BRANCH		(8)



/*****************************************************************************
 * FUNCTION
 *  vm_get_sys_property
 * DESCRIPTION
 *  get MRE system property. Property is defined as group of key and value. The property is maintained by MRE internal and APP can not 
 *  modify it or delete it.
 * PARAMETERS
 *  key : [IN] the key to get the system property
 *  value : [OUT] point to continuous memory,store the gotten system property. if value ==NULL, it shows that no data writing operation.
 *  len : [IN] the max length that value storing data. unit: VMCHAR
 *              e.g. if len =12 and actual written length is 10,  value[10] = 0x00
 *                      if len =12 and actual written length is 12,  value string will not include 0x00
 *                      if len =12 and actual need to be written length is 15, only the first 12 character will be written to value region
 * RETURNS
 *  the actual written length, not including 0x00
 * EXAMPLE
 *	VMCHAR value[20] = {0};
 *    VMUINT valueNum = vm_get_sys_property(MRE_SYS_SUBSCRIBER_ID, value, 20);
 *****************************************************************************/ 
VMUINT vm_get_sys_property(const VMINT key, VMCHAR* value, VMUINT len);



/*****************************************************************************
 * FUNCTION
 *  vm_get_sys_time_zone
 * DESCRIPTION
 *  get system time zone 
 * PARAMETERS
 *  void
 * RETURNS
 *  GMT value
 *****************************************************************************/ 
float vm_get_sys_time_zone(void);



/*****************************************************************************
 * FUNCTION
 *  vm_get_sys_scene
 * DESCRIPTION
 *  get system setting profile
 * PARAMETERS
 *  void
 * RETURNS
 *  0 : standard mode
 *  1: meeting mode
 *  2: outside mode
 *  3: indoor mode
 *  4: earphone mode
 *  5: silent mode
 *  6: bluetooth mode
 *****************************************************************************/ 
VMINT vm_get_sys_scene(void);



/*****************************************************************************
 * FUNCTION
 *  vm_get_battery_level
 * DESCRIPTION
 *  get handset battery level 
 * PARAMETERS
 *  void
 * RETURNS
 *  battery level  .depend on the target config, return value maybe one of 0,25,50,75,100
 * or one of 0,33,66,100
 *****************************************************************************/ 
VMINT vm_get_battery_level(void) ;


/*****************************************************************************
 * FUNCTION
 *  vm_set_mainlcd_brightness
 * DESCRIPTION
 *  set handset main LCD brightness 
 * PARAMETERS
 *  vm_mainlcd_brightness_level_enum 
 * RETURNS
 * NO 
 *****************************************************************************/ 
void vm_set_mainlcd_brightness(vm_mainlcd_brightness_level_enum brighness_level);

/*****************************************************************************
 * FUNCTION
 *  vm_get_mainlcd_brightness
 * DESCRIPTION
 *  get handset main LCD brightness 
 * PARAMETERS
 *  NULL 
 * RETURNS
 * an unsigned int value
 *****************************************************************************/ 
VMINT vm_get_mainlcd_brightness(void);


typedef enum {
	turn_on_mode = 0, 				/*turn on saving mode */
	turn_off_mode					/*turn off saving mode*/
} power_saving_mode_enum;


/* builtin sm struct */
typedef struct _vm_sm_builtin_struct
{
    VMINT8 file_name[32]; /* sm file name */
    VMUINT address;        /* sm memory address */
} vm_sm_builtin_struct;


/*****************************************************************************
 * FUNCTION
 *  vm_switch_power_saving_mode
 * DESCRIPTION
 *  settign saving mode.
 *	MRE default value is turn_on_mode, when app is set to background running or 
 *	exit, or receives INACTIVE message, the mode also should be set as turn_on_mode.
 *  turn_on_mode: LCD will off when no action occurs in a period time.
 *  turn_off_mode: LCD will keep on,only when app is on fore-ground running, can 
 *					it set the mode. 
 * PARAMETERS
 *  mode : whether open the saving mode
 * RETURNS
 *  if succeed ,return 0, otherwise,return error code
 *****************************************************************************/ 
VMINT vm_switch_power_saving_mode(power_saving_mode_enum mode);

void vm_set_touch_feedback ( vm_touch_feedback_enum type);


/*****************************************************************************
 * FUNCTION
 *  vm_get_mre_modules
 * DESCRIPTION
 *  get mre modules information 
 * PARAMETERS
 *  modules : module structure
 *  size : module structure's size
 * RETURNS
 *  if succeed ,return 0, otherwise,return error code
 *****************************************************************************/
VMINT vm_get_mre_modules(vm_module_struct *modules, VMUINT size);

/*****************************************************************************
 * FUNCTION
 *  vm_get_mre_version
 * DESCRIPTION
 *  get mre version  
 * PARAMETERS
 *  
 * RETURNS
 *  version
 *****************************************************************************/
VMUINT vm_get_mre_version(void);

/*****************************************************************************
 * FUNCTION
 *  vm_get_mre_total_mem_size
 * DESCRIPTION
 *  get mre total memory size  
 * PARAMETERS
 *  
 * RETURNS
 *  memory size
 *****************************************************************************/
VMUINT vm_get_mre_total_mem_size(void);



#define VM_UPDATE_OK_ALREADY_DOWNLOADED         1
#define VM_UPDATE_OK                            0
#define VM_UPDATE_ERROR                         -2
#define VM_UPDATE_ERROR_GET_VERSION_FAIL        -3
#define VM_UPDATE_ERROR_GET_APP_ID_FAIL         -4
#define VM_UPDATE_ERROR_GET_SC_FAIL             -5
#define VM_UPDATE_ERROR_PATH_NOT_EXIST          -6
#define VM_UPDATE_ERROR_NO_MEMORY               -7
#define VM_UPDATE_ERROR_NO_UPDATE_FILE          -8
#define VM_UPDATE_ERROR_INTER                   -9

typedef void (*vm_update_mre_app_callback)(VMINT hdl, void * para);

/*****************************************************************************
 * FUNCTION
 *  vm_update_check_version
 * DESCRIPTION
 *  check new version is avaliable or not through service.  
 * PARAMETERS
 *  
 * RETURNS
 *  error code, VM_UPDATE_OK means success, can get result from callback
 *                   VM_UPDATE_OK_ALREADY_DOWNLOADED means new version already downloaded   
 *****************************************************************************/
VMINT vm_update_check_version(VMSTR URL, VMINT port, VMINT apn, vm_update_mre_app_callback callback, void* user_data);

/*****************************************************************************
 * FUNCTION
 *  vm_update_download
 * DESCRIPTION
 *  after check version, can use this to download new version app
 * PARAMETERS
 *  
 * RETURNS
 *  error code, VM_UPDATE_OK means success, can get result from callback
 *****************************************************************************/
VMINT vm_update_download(VMINT handle, VMINT bOnCard, vm_update_mre_app_callback callback, void* user_data);


/*****************************************************************************
 * FUNCTION
 *  vm_update_update_file
 * DESCRIPTION
 *  if downloaded, can use this to update to new version app. This will exit the running app.
 * PARAMETERS
 *  
 * RETURNS
 *****************************************************************************/
VMINT vm_update_update_file(void);

/*****************************************************************************
 * FUNCTION
 *  vm_update_cancel
 * DESCRIPTION
 *  cancel the downloading process
 * PARAMETERS
 *  
 * RETURNS
 *****************************************************************************/
VMINT vm_update_cancel(VMINT handle);

VMINT vm_update_check_launch(VMWSTR path, VMWSTR new_path);

#define VM_INSTALL_ID_LEN 60
#define VM_APPMGR_DEVELOPER_NAME_LEN    30
#define VM_APPMGR_TEL_NUM_LEN   20
#define VM_APPMGR_APP_NAME_LEN  15
#define VM_APPMGR_FILEPATH_LEN  260

#define VM_APPMGR_MRE_ALL_FLAG              0x0001
#define VM_APPMGR_MRE_INSTALLED_FLAG        0x0002
#define VM_APPMGR_MRE_SHORTCUT_FLAG         0x0004

#define VM_APPMGR_WIDGET_PACKAGE_FLAG       (0x8001) /* mre widget app */
#define VM_APPMGR_WALLPAPER_PACKAGE_FLAG       (0x8002) /* mre wallpaper app */
#define VM_APPMGR_LAUNCHER_PACKAGE_FLAG       (0x8004) /* mre launcher app */
#define VM_APPMGR_SCRLOCK_PACKAGE_FLAG       (0x8008) /* mre screen lock app */

#define VM_APPMGR_VPP_PACKAGE_FLAG \
                (VM_APPMGR_WIDGET_PACKAGE_FLAG |\
                 VM_APPMGR_WALLPAPER_PACKAGE_FLAG |\
                 VM_APPMGR_LAUNCHER_PACKAGE_FLAG |\
                 VM_APPMGR_SCRLOCK_PACKAGE_FLAG)


typedef VMCHAR vm_install_id[VM_INSTALL_ID_LEN];

typedef enum
{
    VM_APPMGR_INSTALL_TYPE_UNKNOWN = 0,    /* UNKNOWN */
    VM_APPMGR_INSTALL_TYPE_DOWNLOAD,       /* dwonload from server */
    VM_APPMGR_INSTALL_TYPE_ROM,            /* build-in app */
    VM_APPMGR_INSTALL_TYPE_LOCAL_INSTALL,  /* install from local */
    VM_APPMGR_INSTALL_TYPE_SHORTCUT,       /* shortcut app */
    VM_APPMGR_INSTALL_TYPE_END_OF_ENUM
}vm_appmgr_install_type;

/* Application storage position type */
typedef enum
{
    VM_APPMGR_APP_POSITION_UNKNOWN = 0,    /* UNKNOWN */
    VM_APPMGR_APP_POSITION_PHONE,          /* Phone */
    VM_APPMGR_APP_POSITION_CARD,           /* Memory card */
    VM_APPMGR_APP_POSITION_ROM,            /* build-in app */
    VM_APPMGR_APP_POSITION_END_OF_ENUM
} vm_appmgr_app_storage_position;

typedef struct
{
    VMUINT app_id;
    VMUINT app_size;
    vm_appmgr_install_type install_type; 
    vm_appmgr_app_storage_position store_pos;
    vm_time_t installed_time; 
    VMUINT16 developer[VM_APPMGR_DEVELOPER_NAME_LEN];  
    VMUINT16 tel[VM_APPMGR_TEL_NUM_LEN]; 
    VMUINT16 app_name[VM_APPMGR_APP_NAME_LEN]; 
    VMUINT16 app_path[VM_APPMGR_FILEPATH_LEN]; 
}vm_install_info;


typedef enum 
{
   VM_SLA_STOP,
   VM_SLA_START,
   VM_SLA_LABEL
} vm_sla_action_type;

typedef enum 
{
   VM_WALLPAPER_SRC_HOME_SCREEN,
   VM_WALLPAPER_SRC_LOCK_SCREEN
} vm_app_mgr_wallpaper_src_enum;

/*****************************************************************************
 * FUNCTION
 *  vm_appmgr_install
 * DESCRIPTION
 *  install mre app 
 * PARAMETERS
 *  path : [IN] path of app
 *  flag : [IN] reserved, please fill 0
 *  install_id : [OUT] identification of installed app
 * RETURNS
 *  error code 0 means success
 *****************************************************************************/
VMINT vm_appmgr_install(VMWSTR path, VMINT flag, vm_install_id install_id);

/*****************************************************************************
 * FUNCTION
 *  vm_appmgr_uninstall
 * DESCRIPTION
 *  uninstall mre app 
 * PARAMETERS
 *  install_id : [IN] identification of installed app, can get 
 *                            by using vm_appmgr_get_installed_list or vm_appmgr_is_installed
 * RETURNS
 *  error code 0 means success
 *****************************************************************************/
VMINT vm_appmgr_uninstall(vm_install_id install_id);

/*****************************************************************************
 * FUNCTION
 *  vm_appmgr_is_installed
 * DESCRIPTION
 *  check the mre app is intalled or not
 * PARAMETERS
 *  path : [IN] path of app
 *  install_id : [OUT] identification of installed app
 * RETURNS
 *  error code 0 means success
 *****************************************************************************/
VMBOOL vm_appmgr_is_installed(VMWSTR path, vm_install_id install_id);

/*****************************************************************************
 * FUNCTION
 *  vm_appmgr_get_installed_list
 * DESCRIPTION
 *  get installed app list. set install_id_list to NULL to get number of installed app.
 * PARAMETERS
 *  flag : [IN] 
 *  install_id_list : [OUT] identifications of installed app
 *  num :[IN/OUT] number of installed app
 * RETURNS
 *  error code 0 means success
 *****************************************************************************/
VMINT vm_appmgr_get_installed_list(VMINT flag ,vm_install_id* install_id_list, VMUINT* num);

/*****************************************************************************
 * FUNCTION
 *  vm_appmgr_get_install_info
 * DESCRIPTION
 *  get installed app detail information
 * PARAMETERS
 *  vm_install_id : [IN] identification of installed app
 *  vm_install_info : [OUT] detail information
 * RETURNS
 *  error code 0 means success
 *****************************************************************************/
VMINT vm_appmgr_get_install_info(vm_install_id install_id, vm_install_info* install_info);

/*****************************************************************************
 * FUNCTION
 *  vm_appmgr_activate_launcher
 * DESCRIPTION
 *  Active launcher plug-in
 * PARAMETERS
 *  install_id : [IN] identification of installed app, can get 
 *                            by using vm_appmgr_get_installed_list or vm_appmgr_is_installed
 * RETURNS
 *  error code 0 means success
 *****************************************************************************/
VMINT vm_appmgr_activate_launcher(vm_install_id install_id);

/*****************************************************************************
 * FUNCTION
 *  vm_appmgr_activate_screen_lock
 * DESCRIPTION
 *  Active Screen-Lock plug-in 
 * PARAMETERS
 *  install_id : [IN] identification of installed app, can get 
 *                            by using vm_appmgr_get_installed_list or vm_appmgr_is_installed
 * RETURNS
 *  error code 0 means success
 *****************************************************************************/
VMINT vm_appmgr_activate_screen_lock(vm_install_id install_id);

/*****************************************************************************
 * FUNCTION
 *  vm_appmgr_activate_wallpaper
 * DESCRIPTION
 *  Active wallpaper plug-in
 * PARAMETERS
 *  install_id : [IN] identification of installed app, can get 
 *                            by using vm_appmgr_get_installed_list or vm_appmgr_is_installed
 * RETURNS
 *  error code 0 means success
 *****************************************************************************/
VMINT vm_appmgr_activate_wallpaper(vm_install_id install_id, vm_app_mgr_wallpaper_src_enum src);

/******************************************************************************
 * FUNCTION
 *  vm_appmgr_get_mem_size
 * DESCRIPTION
 *  Get Memory size of DLUI components
 * PARAMETERS
 *  Package  :   [IN]       VM_APPMGR_WIDGET_PACKAGE_FLAG
 *                          VM_APPMGR_LAUNCHER_PACKAGE_FLAG
 *                          VM_APPMGR_WALLPAPER_PACKAGE_FLAG
 *                          VM_APPMGR_SCRLOCK_PACKAGE_FLAG
 * RETURNS
 *  Memory Size requirement, -1 means not support.
 ******************************************************************************/
VMINT vm_appmgr_get_mem_size(VMUINT32 package);



/*****************************************************************************
* FUNCTION
 *    vm_reg_func_callback
 * DESCRIPTION
 *  register get function pointer callback.
 * PARAMETERS
 *  f : [IN] callback function.
*****************************************************************************/
void vm_reg_func_callback(VMINT (*f)(VMSTR symbol));

/*****************************************************************************
* FUNCTION
 *    vm_sla_custom_logging
 * DESCRIPTION
 *  SWLA custom logging function
 * PARAMETERS
 *  custom_label : [IN] the custom label.
 *  action       : [IN] the logging action
*****************************************************************************/
void vm_sla_custom_logging(VMSTR custom_label, vm_sla_action_type action);

/* DOM-NOT_FOR_SDK-BEGIN */

/******************************************************************************
 * FUNCTION
 *	vm_get_customer_name
 * DESCRIPTION
 *	get customer name
 * PARAMETERS
 *	value : [OUT] string to store customer name.
 *	len : [IN] length of value.
 * RETURNS
 *	length of customer name.
 ******************************************************************************/
VMUINT vm_get_customer_name(VMCHAR *value, VMUINT len);

/******************************************************************************
 * FUNCTION
 *	vm_get_origin_release_verno
 * DESCRIPTION
 *	get origin release verno.
 * PARAMETERS
 *	value : [OUT] string to store origin release verno.
 *	len : [IN] length of value.
 * RETURNS
 *	length of origin release verno.
 ******************************************************************************/
VMUINT vm_get_origin_release_verno(VMCHAR *value, VMUINT len);

/* DOM-NOT_FOR_SDK-END */

/******************************************************************************
 * FUNCTION
 *  vm_is_support_downloadable_app_icon
 * DESCRIPTION
 *  check whether downloadable app icon is supported.
 * PARAMETERS
 *  void
 * RETURNS
 *  TRUE means support, FALSE means NOT support.
 ******************************************************************************/
VMINT vm_is_support_downloadable_app_icon(void);

/******************************************************************************
 * FUNCTION
 *  vm_appmgr_is_launcher_activated
 * DESCRIPTION
 *  check whether launcher is activated.
 * PARAMETERS
 *  install_id  :   [IN]    identification of installed app, can get by using
 *                          vm_appmgr_get_installed_list or vm_appmgr_is_installed.
 * RETURNS
 *  TRUE means activated, FALSE means NOT activated.
 ******************************************************************************/
VMINT vm_appmgr_is_launcher_activated(vm_install_id install_id);

/******************************************************************************
 * FUNCTION
 *  vm_appmgr_is_wallpaper_activated
 * DESCRIPTION
 *  check whether wallpaper is activated.
 * PARAMETERS
 *  install_id  :   [IN]    identification of installed app, can get by using
 *                          vm_appmgr_get_installed_list or vm_appmgr_is_installed.
 *  src :   [IN]    wallpaper src.
 * RETURNS
 *  TRUE means activated, FALSE means NOT activated.
 ******************************************************************************/
VMINT vm_appmgr_is_wallpaper_activated(
            vm_install_id install_id,
            VMINT src);

/******************************************************************************
 * FUNCTION
 *  vm_appmgr_is_screen_lock_activated
 * DESCRIPTION
 *  check whether screen lock is activated.
 * PARAMETERS
 *  install_id  :   [IN]    identification of installed app, can get by using
 *                          vm_appmgr_get_installed_list or vm_appmgr_is_installed.
 * RETURNS
 *  TRUE means activated, FALSE means NOT activated.
 ******************************************************************************/
VMINT vm_appmgr_is_screen_lock_activated(vm_install_id install_id);

/******************************************************************************
 * FUNCTION
 *	vm_appmgr_is_support_launcher
 * DESCRIPTION
 *	check whether launcher is supported.
 * PARAMETERS
 *	void.
 * RETURNS
 *	TRUE means support, FALSE means NOT support.
 ******************************************************************************/
VMINT vm_appmgr_is_support_launcher(void);

/******************************************************************************
 * FUNCTION
 *	vm_appmgr_is_support_wallpaper
 * DESCRIPTION
 *	check whether wallpaper is supported.
 * PARAMETERS
 *	void.
 * RETURNS
 *	TRUE means support, FALSE means NOT support.
 ******************************************************************************/
VMINT vm_appmgr_is_support_wallpaper(void);

/******************************************************************************
 * FUNCTION
 *	vm_appmgr_is_support_screen_lock
 * DESCRIPTION
 *	check whether screen_lock is supported.
 * PARAMETERS
 *	void.
 * RETURNS
 *	TRUE means support, FALSE means NOT support.
 ******************************************************************************/
VMINT vm_appmgr_is_support_screen_lock(void);

/******************************************************************************
 * FUNCTION
 *	vm_appmgr_is_support_widget
 * DESCRIPTION
 *	check whether widget is supported.
 * PARAMETERS
 *	void.
 * RETURNS
 *	TRUE means support, FALSE means NOT support.
 ******************************************************************************/
VMINT vm_appmgr_is_support_widget(void);

/*****************************************************************************
 * FUNCTION
 *  vm_clipboard_is_available
 * DESCRIPTION
 *  Check whether the current project support clipboard
 * PARAMETERS
 *  NULL
 * RETURNS
 *  TRUE : Support clipboard
 *  FALSE: Not support clipboard
 *****************************************************************************/
VMBOOL vm_clipboard_is_available(void);

/*****************************************************************************
 * FUNCTION
 *  vm_clipboard_text_set_data
 * DESCRIPTION
 *  Set text data to clipboard.
 *  The text encoded type should be unicode.
 *  Clipboard only could stores 2048 wchars at most.
 *  The memory is provided by system.
 * PARAMETERS
 *  str     : [IN] unicode string pointer
 *  str_len : [IN] string length (could be less than the total length, in other words, a part of string)
 * RETURNS
 *  TRUE : 1. Operation success
 *         2. str == NULL (clear the clipboard)
 *  FALSE: 1. memory not enough
 *         2. memory overlapped
 *         3. str_len <= 0
 *****************************************************************************/
VMBOOL vm_clipboard_text_set_data(const VMWSTR str, VMUINT str_len);

/*****************************************************************************
 * FUNCTION
 *  vm_clipboard_text_get_data
 * DESCRIPTION
 *  Get text data from clipboard.
 *  This is a blobal string pointer saved in system memory.
 * PARAMETERS
 *  void
 * RETURNS
 *  Valid pointer: unicode string pointer
 *  NULL: clipboard is empty
 *****************************************************************************/
VMWSTR vm_clipboard_text_get_data(void);

/*****************************************************************************
* FUNCTION
 *    vm_malloc_nc_topmost
 * DESCRIPTION
 *  allocate specified size of non-cachable memory from topmost address
 * PARAMETERS
 *  size : [IN]  size of byte to be allocated.
 * RETURNS
 *  memory pointer allocated, NULL means allocation failed.
*****************************************************************************/
void *vm_malloc_nc_topmost(int size);

/*****************************************************************************
* FUNCTION
 *    vm_malloc_nc_topmost
 * DESCRIPTION
 *  allocate specified size of  memory from topmost address
 * PARAMETERS
 *  size : [IN]  size of byte to be allocated.
 * RETURNS
 *  memory pointer allocated, NULL means allocation failed.
*****************************************************************************/
void *vm_malloc_topmost(int size);

/*****************************************************************************
* FUNCTION
 *    vm_malloc_nc_topmost
 * DESCRIPTION
 *  re-allocate specified size of  memory from topmost address
 * PARAMETERS
 *  size : [IN]  size of byte to be allocated.
 * RETURNS
 *  memory pointer allocated, NULL means allocation failed.
*****************************************************************************/
void *vm_realloc_topmost(void * p,int size);

#ifdef __cplusplus
}
#endif 

#endif /* VMSYS_SDK_H_ */