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 // Copyright (c) 2008-2009 MStar Semiconductor, Inc. 81 // All rights reserved. 82 // 83 // Unless otherwise stipulated in writing, any and all information contained 84 // herein regardless in any format shall remain the sole proprietary of 85 // MStar Semiconductor Inc. and be kept in strict confidence 86 // ("MStar Confidential Information") by the recipient. 87 // Any unauthorized act including without limitation unauthorized disclosure, 88 // copying, use, reproduction, sale, distribution, modification, disassembling, 89 // reverse engineering and compiling of the contents of MStar Confidential 90 // Information is unlawful and strictly prohibited. MStar hereby reserves the 91 // rights to any and all damages, losses, costs and expenses resulting therefrom. 92 // 93 //////////////////////////////////////////////////////////////////////////////// 94 95 /////////////////////////////////////////////////////////////////////////////////////////////////// 96 /// 97 /// @file drvPM.h 98 /// @brief PM Driver Interface 99 /// @author MStar Semiconductor Inc. 100 /////////////////////////////////////////////////////////////////////////////////////////////////// 101 102 /*! \defgroup G_PM PM interface 103 * \ingroup G_PERIPHERAL 104 105 \brief 106 107 Power Management 108 109 <b>Features</b> 110 111 - Normal mode:HK is alive 112 - Standby mode:Power down die-domain 113 - Sleep mode:Power down die-domain & turn off 8051 clock,external XTAL is on to provide RTC wake-up 114 - Deep sleep mode:Power down die-domain & turn off 8051 clock & turn off external crystal,Use internal RC (4MHz) only 115 116 <b>Power Domain Diagram</b> \n 117 \image html drvPM_pic.png 118 119 <b>PM Power Down Routine</b> \n 120 -# Clock Switch 121 -# Set Power Down Mode: Standby/Sleep 122 -# Enable Isolation link to GPIO_PM[4] 123 -# Enter Password: Lock/Lock3 124 -# Pull GPIO PM4 down (low) 125 126 <b>PM Power Up Routine</b> \n 127 -# Record wakeup source 128 -# Pull GPIO PM4 Up (high) 129 -# Clear Password: Lock3 130 -# Mask All Wakeup Sources 131 -# Waiting for Power Good 132 -# Clear Passwords: Lock 133 -# Recovery Settings before Power Down 134 135 \defgroup G_PM_INIT Initialization Task relative 136 \ingroup G_PM 137 \defgroup G_PM_COMMON Common Task relative 138 \ingroup G_PM 139 \defgroup G_PM_CONTROL Control relative 140 \ingroup G_PM 141 * \defgroup G_PM_RTC RTC Task relative 142 * \ingroup G_PM 143 \defgroup G_PM_PWM PWM Task relative 144 \ingroup G_PM 145 * \defgroup G_PM_STR STR Task relative 146 * \ingroup G_PM 147 \defgroup G_PM_OTHER other relative 148 \ingroup G_PM 149 * \defgroup G_PM_ToBeModified PM api to be modified 150 * \ingroup G_PM 151 \defgroup G_PM_ToBeRemove PM api to be removed 152 \ingroup G_PM 153 */ 154 155 #ifndef _DRV_PM_H_ 156 #define _DRV_PM_H_ 157 158 #ifdef __cplusplus 159 extern "C" 160 { 161 #endif 162 163 #include "MsTypes.h" 164 165 //------------------------------------------------------------------------------------------------- 166 // Driver Capability 167 //------------------------------------------------------------------------------------------------- 168 169 170 //------------------------------------------------------------------------------------------------- 171 // Macro and Define 172 //------------------------------------------------------------------------------------------------- 173 /// define PM library version 174 #define MSIF_PM_LIB_CODE {'P','M','_','_'} 175 #define MSIF_PM_LIBVER {'0','3'} 176 #define MSIF_PM_BUILDNUM {'0','0'} 177 #define MSIF_PM_CHANGELIST {'0','0','3','5','2','1','6','3'} 178 #define MSIF_PM_OS '0' //OS 179 180 #define PM_DRV_VERSION /* Character String for DRV/API version */ \ 181 MSIF_TAG, /* 'MSIF' */ \ 182 MSIF_CLASS, /* '00' */ \ 183 MSIF_CUS, /* 0x0000 */ \ 184 MSIF_MOD, /* 0x0000 */ \ 185 MSIF_CHIP, \ 186 MSIF_CPU, \ 187 MSIF_PM_LIB_CODE, /* IP__ */ \ 188 MSIF_PM_LIBVER, /* 0.0 ~ Z.Z */ \ 189 MSIF_PM_BUILDNUM, /* 00 ~ 99 */ \ 190 MSIF_PM_CHANGELIST, /* CL# */ \ 191 MSIF_PM_OS 192 193 194 #define PM_MAX_BUF_WAKE_IR (32) //Both IR and Keypad share this pool 195 #define PM_MAX_BUF_WAKE_IR2 (16) //Only 2nd IR share this pool 196 #define PM_MAX_BUF_WAKE_KEYPAD (32) //RESERVED 197 #define PM_MAX_BUF_WAKE_MAC_ADDRESS (6)//For Mac address 198 199 200 201 //------------------------------------------------------------------------------------------------- 202 // Type and Structure 203 //------------------------------------------------------------------------------------------------- 204 205 /// PM_CMD opcode 206 #define WRITE_CMD 0 207 #define READ_CMD 1 208 #define SLEEP_CMD 2 209 #define CTRL_WRITE_CMD 3 210 #define CTRL_READ_CMD 4 211 212 /// select sleep mode 213 #define SLEEP_MODE 0 214 #define DEEP_SLEEP_MODE 1 215 216 /// enable wakeup source 217 #define IR_WAKEUP (1<<0) 218 #define CEC_WAKEUP (1<<1) 219 #define GPIO5_WAKEUP (1<<2) 220 #define GPIO6_WAKEUP (1<<3) 221 #define KEYPAD_WAKEUP (1<<4) 222 #define EASYSYNC_WAKEUP (1<<5) 223 #define SYNC_WAKEUP (1<<6) 224 #define RTC_WAKEUP (1<<7) 225 226 #define DVI_DET_WAKEUP (1<<10) 227 #define DVI_DET2_WAKEUP (1<<11) 228 229 /// power off PM4 polarity 230 #define POWER_OFF_HIGH (1<<15) 231 232 /// IR types 233 #define IR_TYPE_FULLDECODE_MODE 1 234 #define IR_TYPE_RAWDATA_MODE 2 235 #define IR_TYPE_SWDECODE_MODE 3 236 237 /// IRQ 238 #define MDRV_IRQ_BEGIN 0x40 239 #define MDRV_IRQ_END 0x7F 240 #define IRQ_PMSLEEP (MDRV_IRQ_BEGIN + 12) 241 242 /// Enable GPIO 243 #define ENABLE_GPIO0 (1<<0) 244 #define ENABLE_GPIO1 (1<<1) 245 #define ENABLE_GPIO2 (1<<2) 246 #define ENABLE_GPIO3 (1<<3) //GPIO 4&5 are reserved 247 #define ENABLE_GPIO6 (1<<6) 248 #define ENABLE_GPIO7 (1<<7) 249 #define ENABLE_GPIO8 (1<<8) 250 #define ENABLE_GPIO9 (1<<9) 251 #define ENABLE_GPIO10 (1<<10) 252 #define ENABLE_GPIO11 (1<<11) 253 #define ENABLE_GPIO12 (1<<12) 254 255 256 /// MICOM(PM_SLEEP) DDI Layer Command 257 typedef enum 258 { 259 /// write data from host to PM : direction 260 CP_WRITE_HOST_MEM_TO_MICOM = 0xE0UL, 261 262 /// write data from host to PM : start 263 CP_WRITE_HOST_MEM_TO_MICOM_START = 0xE1UL, 264 265 /// write data from host to PM : data content 266 CP_WRITE_HOST_MEM_TO_MICOM_DATA = 0xE2UL, 267 268 /// write keypad boundary parameter 1 to PM 269 CP_WRITE_KEYPAD_BOUND_1 = 0xE6UL, 270 271 /// write keypad boundary parameter 2 to PM 272 CP_WRITE_KEYPAD_BOUND_2 = 0xE7UL, 273 274 /// read data from PM to host : direction 275 CP_READ_MICOM_TO_HOST_MEM = 0xE3UL, 276 277 /// read data from PM to host : start 278 CP_WRITE_MICOM_TO_HOST_MEM_START = 0xE4UL, 279 280 /// read data from PM to host : data content 281 CP_READ_MICOM_TO_HOST_MEM_DATA = 0xE5UL, 282 283 /// no command 284 CP_NO_CMD = 0 285 286 } DDI_MICOM_CMDTYPE; 287 288 /// For PM mailbox command header 289 typedef struct 290 { 291 MS_U8 Preamble : 2; /// two bits for command index 292 MS_U8 Opcode : 6; /// 6 bits for operation codes 293 } PM_Cmd; 294 295 /// For initializing IR timing configuration 296 typedef struct 297 { 298 MS_S16 s16Time; /// time 299 MS_S16 s16UpBnd; /// upper bound 300 MS_S16 s16LowBnd; /// low bound 301 } PM_IrTimeCfg; 302 303 /// For initializing IR registers configuration 304 typedef struct 305 { 306 MS_U8 u8IrModeSel; /// IR mode selection 307 MS_U8 u8IrCtrl; /// IR enable control 308 MS_U8 u8IrHdrCode0; /// IR header code 0 309 MS_U8 u8IrHdrCode1; /// IR header code 1 310 MS_U32 u32IrTimOutCyc; /// IR timerout counter 311 PM_IrTimeCfg tIrHdrCoTim; /// header code time 312 PM_IrTimeCfg tIrOffCoTim; /// off code time 313 PM_IrTimeCfg tIrOffCoRpTim; /// off code repeat time 314 PM_IrTimeCfg tIrLg01HighTim; /// logical 0/1 high time 315 PM_IrTimeCfg tIrLg0Tim; /// logical 0 time 316 PM_IrTimeCfg tIrLg1Tim; /// logical 1 time 317 } PM_IrRegCfg; 318 319 /// For initializing keypad boundary configuration 320 typedef struct 321 { 322 MS_U8 u8UpBnd; /// upper bound 323 MS_U8 u8LowBnd; /// low bound 324 } PM_SarBndCfg; 325 326 /// For initializing keypad boundary configuration 327 typedef struct 328 { 329 PM_SarBndCfg tSarChan1; /// Channel 1 interrupt trigger boundary 330 PM_SarBndCfg tSarChan2; /// Channel 2 interrupt trigger boundary 331 PM_SarBndCfg tSarChan3; /// Channel 3 interrupt trigger boundary 332 PM_SarBndCfg tSarChan4; /// Channel 4 interrupt trigger boundary 333 } PM_SarRegCfg; 334 335 /// For initializing keypad wake-up parameter configuration 336 typedef struct 337 { 338 PM_SarBndCfg tChanMinus; /// parameter for Channel Minus 339 PM_SarBndCfg tChanPlus; /// parameter for Channel Plus 340 PM_SarBndCfg tInput; /// parameter for Input Source 341 PM_SarBndCfg tMenu; /// parameter for Menu 342 PM_SarBndCfg tOk; /// parameter for OK 343 PM_SarBndCfg tPower; /// parameter for Power 344 PM_SarBndCfg tVolumeMinus; /// parameter for Volume Minus 345 PM_SarBndCfg tVolumePlus; /// parameter for Volume Plus 346 } PM_SarParamCfg; 347 348 typedef enum 349 { 350 E_PM_RTC_0=0, 351 E_PM_RTC_2=1, 352 }E_PM_RTC; 353 354 ///Define PM IRQ Type 355 typedef enum 356 { 357 /// IRQ Type for IR 358 E_PM_IRQ_IR = 0, 359 /// IRQ Type for CEC Wake-up 360 E_PM_IRQ_CEC_WAKE = 1, 361 /// IRQ Type for External Interrup 362 E_PM_IRQ_EX_INT = 2, 363 /// IRQ Type for External Interrup 2 364 E_PM_IRQ_EX_INT2 = 3, 365 /// IRQ Type for SAR(Keypad) 366 E_PM_IRQ_SAR = 4, 367 /// IRQ Type for Sync Detection 368 E_PM_IRQ_SYNC_DET = 5, 369 /// IRQ Type for DVI clock Detection 370 E_PM_IRQ_DVICLK_DET = 6, 371 /// IRQ Type for RTC 372 E_PM_IRQ_RTC = 7, 373 /// IRQ Type for WDT 374 E_PM_IRQ_WDT = 8, 375 /// IRQ Type for Mail Box 0 376 E_PM_IRQ_MBOX0 = 9, 377 /// IRQ Type for Mail Box 1 378 E_PM_IRQ_MBOX1 = 10, 379 /// IRQ Type for Mail Box 2 380 E_PM_IRQ_MBOX2 = 11, 381 /// IRQ Type for Mail Box 3 382 E_PM_IRQ_MMOX3 = 12, 383 /// Maximum IRQ Type 384 E_PM_IRQ_MAX = E_PM_IRQ_MMOX3, 385 386 } PM_IRQ_TYPE; 387 388 ///Define PM Saved Registers 389 typedef struct 390 { 391 unsigned long r[32]; /// GPR regs 392 #ifdef __AEONR2__ 393 unsigned long machi2; // Highest 32-bits of new 32x32=64 multiplier 394 #endif 395 unsigned long machi; /// High and low words of 396 unsigned long maclo; /// multiply/accumulate reg 397 398 unsigned long pc; /// Program Counter 399 400 /// Saved only for exceptions, and not restored when continued: 401 /// Effective address of instruction/data access that caused exception 402 unsigned long eear; /// Exception effective address reg 403 /// These are only saved for exceptions and interrupts 404 int vector; /// Vector number 405 int sr; /// Status Reg 406 407 } PM_SavedRegisters; 408 409 typedef void (*PM_IsrCb_Type)(PM_SavedRegisters *regs, MS_U32 vector); 410 411 412 typedef void ( *IRRecord_Callback ) (MS_VIRT virtSrcAddr, MS_U16 u16DataSize); 413 414 ///Define PM IRQ Struct 415 typedef struct 416 { 417 PM_IsrCb_Type isr; /// PM ISR call back type 418 MS_U32 data; /// PM ISR data parameter 419 } PM_IrqStruct; 420 421 422 423 424 425 ///Define PM debug level 426 typedef enum _PM_DbgLv 427 { 428 E_PM_DBGLV_NONE, /// no debug message 429 E_PM_DBGLV_ERR_ONLY, /// show error only 430 E_PM_DBGLV_INFO, /// show error & informaiton 431 E_PM_DBGLV_ALL, /// show error, information & funciton name 432 }PM_DbgLv; 433 434 ///Define PM Return Value 435 typedef enum 436 { 437 /// fail 438 E_PM_FAIL = 0, 439 /// success 440 E_PM_OK = 1, 441 442 } PM_Result; 443 444 ///Define PM return to HK PowerOn Mode 445 typedef enum 446 { 447 E_PM_POWERON_STANBY = 1, 448 E_PM_POWERON_SLEEP = 2, 449 E_PM_POWERON_DEEPSLEEP = 3, 450 E_PM_POWERON_ACON = 0xffUL, 451 452 } PM_PowerOnMode; 453 454 typedef enum 455 { 456 E_PM_WAKEUPSRC_NONE = 0, 457 E_PM_WAKEUPSRC_IR, 458 E_PM_WAKEUPSRC_DVI, 459 E_PM_WAKEUPSRC_DVI2, 460 E_PM_WAKEUPSRC_CEC, 461 E_PM_WAKEUPSRC_SAR, 462 E_PM_WAKEUPSRC_ESYNC, 463 E_PM_WAKEUPSRC_SYNC, 464 E_PM_WAKEUPSRC_RTC, 465 E_PM_WAKEUPSRC_RTC2, 466 E_PM_WAKEUPSRC_AVLINK, 467 E_PM_WAKEUPSRC_UART, 468 E_PM_WAKEUPSRC_GPIO, 469 E_PM_WAKEUPSRC_MHL, 470 E_PM_WAKEUPSRC_WOL, 471 472 } PM_WakeupSource; 473 474 ///Define PM Acknoledge Flags 475 typedef enum 476 { 477 E_PM_ACKFLG_NULL = 0, /// Ack flag for NULL 478 E_PM_ACKFLG_WAIT_INIT = (1<<0), /// Ack flag for Init 479 E_PM_ACKFLG_WAIT_STATUS = (1<<1), /// Ack flag for Status 480 E_PM_ACKFLG_WAIT_LIBVER = (1<<2), /// Ack flag for Library version 481 E_PM_ACKFLG_WAIT_POWERDOWN = (1<<3), /// Ack flag for Power down 482 E_PM_ACKFLG_WAIT_RTCINIT = (1<<4), /// Ack flag for Rtc Init 483 E_PM_ACKFLG_WAIT_RTCSETCOUNTER = (1<<5), /// Ack flag for set rtc counter 484 E_PM_ACKFLG_WAIT_RTCGETCOUNTER = (1<<6), /// Ack flag for get rtc counter 485 E_PM_ACKFLG_WAIT_RTCSETMATCHCOUNTER = (1<<7), /// Ack flag for set match counter 486 E_PM_ACKFLG_WAIT_RTCGETMATCHCOUNTER = (1<<8), /// Ack flag for get match counter 487 E_PM_ACKFLG_WAIT_INFO = (1<<9), /// Ack flag for Get info 488 E_PM_ACKFLG_WAIT_GETMASTERKEY = (1<<10), /// Ack flag for Get master key 489 E_PM_ACKFLG_WAIT_GETDEVICEID = (1<<11), /// Ack flag for Get device ID 490 E_PM_ACKFLG_WAIT_GETCHIPID = (1<<12), /// Ack flag for Get chip ID 491 E_PM_ACKFLG_WAIT_GPIOINIT = (1<<13), /// Ack flag for init GPIO 492 E_PM_ACKFLG_WAIT_PWMINIT = (1<<14), /// Ack flag for PWM init 493 E_PM_ACKFLG_WAIT_PWMCONFIG = (1<<15), /// Ack flag for PWM config 494 E_PM_ACKFLG_WAIT_GETPMMEMADDR = (1<<16), /// Ack flag for Get PM mem addr 495 E_PM_ACKFLG_WAIT_GETEXTRASRAMDATA = (1<<17), /// Ack flag for Get PM extra sram data 496 E_PM_ACKFLG_WAIT_SETEXTRASRAMDATA = (1<<18), /// Ack flag for Set PM extra sram data 497 } PM_AckFlags; 498 499 ///Define PM PWM Acknowledge Flags 500 typedef enum 501 { 502 E_PM_PWM_ACKFLG_NULL = 0, /// Ack flag for NULL 503 E_PM_PWM_ACKFLG_WAIT_INIT = (1<<0), /// Ack flag for Init 504 E_PM_PWM_ACKFLG_WAIT_CONF = (1<<1), /// Ack flag for Init 505 E_PM_PWM_ACKFLG_WAIT_IRRECORD_RECIEVE_REQUIRE = (1<<2), /// Ack flag for ir recored reciecve require 506 E_PM_PWM_ACKFLG_WAIT_IRRECORD_RECIEVE_COMPLETE = (1<<3), /// Ack flag for ir recored reciecve complete 507 E_PM_PWM_ACKFLG_WAIT_IRRECORD_TRANSMIT = (1<<4), /// Ack flag for ir record transmit 508 E_PM_PWM_ACKFLG_WAIT_IRRECORD_SETCALLBACK = (1<<5), /// Ack flag for ir record reciecve set call back 509 E_PM_PWM_ACKFLG_WAIT_IRRECORD_RECIEVE_EXIT = (1<<6), /// Ack flag for ir record reciecve exit 510 } PM_PWM_AckFlags; 511 512 #if defined(MSOS_TYPE_ECOS) 513 typedef enum 514 { 515 E_PM_ST_NULL = 0, /// PM Driver Status is NULL 516 E_PM_ST_BOOTING = 1, /// PM Driver Status is Booting 517 E_PM_ST_READY = 2, /// PM Driver Status is Ready 518 E_PM_ST_STANDBY = 3, /// PM Driver Status is Standby 519 E_PM_ST_PMMODE = 4, /// PM Driver Status is PmMode 520 E_PM_ST_MAX_STATUS = 255 /// Maximum status for PM Driver Status 521 522 } __attribute__ ((aligned (4096))) PM_DrvStatus; 523 524 #else 525 ///Define PM Driver Status 526 typedef enum __attribute__ ((aligned (4096))) 527 { 528 E_PM_ST_NULL = 0, /// PM Driver Status is NULL 529 E_PM_ST_BOOTING = 1, /// PM Driver Status is Booting 530 E_PM_ST_READY = 2, /// PM Driver Status is Ready 531 E_PM_ST_STANDBY = 3, /// PM Driver Status is Standby 532 E_PM_ST_PMMODE = 4, /// PM Driver Status is PmMode 533 E_PM_ST_MAX_STATUS = 255 /// Maximum status for PM Driver Status 534 535 } PM_DrvStatus; 536 #endif 537 538 ///Define PM Power Down Mode 539 #define E_PM_STANDBY 0 /// PM Power Down Mode is Standby 540 #define E_PM_SLEEP 1 /// PM Power Down Mode is Sleep 541 #define E_PM_DEEP_SLEEP 2 /// PM Power Down Mode is Deep Sleep 542 #define E_PM_NORMAL 3 543 544 ///Define PM WakeUp Mode 545 #define E_PM_WAKE_ZERO 0 /// PM Wakeup Mode is zero 546 #define E_PM_WAKE_LAST 1 /// PM Wakeup Mode is last 547 #define E_PM_ZERO_TWOSTAGE_POWERDOWN 2 548 #define E_PM_LAST_TWOSTAGE_POWERDOWN 3 549 550 ///Define PM Command Index 551 typedef enum 552 { 553 //Aeon-->51 Command Index 554 PM_CMDIDX_INIT = 0x01UL, /// PM Command Index is INIT 555 PM_CMDIDX_GET_STATUS = 0x02UL, /// PM Command Index is GET STATUS 556 PM_CMDIDX_GET_LIBVER = 0x03UL, /// PM Command Index is GET LIBVER 557 PM_CMDIDX_POWER_DOWN = 0x04UL, /// PM Command Index is POWER DOWN 558 PM_CMDIDX_RTC_INIT = 0x05UL, /// PM Command Index is RTC INIT 559 PM_CMDIDX_RTC_SETCOUNTER = 0x06UL, /// PM Command Index is SET COUNTER 560 PM_CMDIDX_RTC_GETCOUNTER = 0x07UL, /// PM Command Index is GET COUNTER 561 PM_CMDIDX_RTC_SETMATCHCOUNTER = 0x08UL, /// PM Command Index is SET MATCH COUNTER 562 PM_CMDIDX_RTC_GETMATCHCOUNTER = 0x09UL, /// PM Command Index is GET MATCH COUNTER 563 PM_CMDIDX_GET_INFO = 0x0AUL, /// PM Command Index is GET INFO 564 PM_CMDIDX_GET_MASTERKEY = 0x0BUL, 565 PM_CMDIDX_GET_DEVICEID = 0x0CUL, 566 PM_CMDIDX_GET_CHIPID = 0x0DUL, 567 PM_CMDIDX_GPIO_INIT = 0x0EUL, 568 PM_CMDIDX_PWM_INIT =0x0FUL, 569 PM_CMDIDX_PWM_CONFIG =0x10UL, 570 571 PM_CMDIDX_PWM_IRRECORD_RECEIVED_SETCALLBACK = 0x11UL, 572 PM_CMDIDX_PWM_IRRECORD_RECEIVED_REQUIRE = 0x12UL, 573 PM_CMDIDX_PWM_IRRECORD_RECEIVED_COMPLETE = 0x13UL, 574 PM_CMDIDX_PWM_IRRECORD_TRANSMIT = 0x14UL, 575 PM_CMDIDX_PWM_IRRECORD_RECEIVED_EXIT = 0x15UL, 576 PM_CMDIDX_GETEXTRASRAMDATA = 0x16UL, 577 PM_CMDIDX_SETEXTRASRAMDATA = 0x17UL, 578 PM_CMDIDX_SET_ONBOARD_LED = 0x18UL, // Control On Board LED 579 PM_CMDIDX_SET_POWER_LED_N_PROGRAM_TIMER_LED = 0x19UL, 580 581 PM_CMDIDX_LED_FLASH = 0x20UL, // PM Command Index is LED Start //@@++-- 20110329 Arki 582 PM_CMDIDX_GLOBAL_CHIP_RESET = 0x21UL, 583 PM_CMDIDX_GET_PM_MEMADDR = 0x22UL, 584 PM_CMDIDX_GET_SYSTEM_ALIVE_STATUS = 0x23UL, 585 PM_CMDIDX_WDT_STATUS = 0x24UL, 586 PM_CMDIDX_UPATE_POWER_LED_STATUS = 0x25UL, 587 PM_CMDIDX_LED_FLASH_TOGGLE = 0x28UL, // facory LED toggle 588 PM_CMDIDX_POWER_ON_TIME_RECORD = 0x29UL, // PM Command Index is record AC and DC on time Kenny 589 590 PM_CMDIDX_ACK_51ToAEON = 0x30UL, /// PM Command Index is ACK 51 To AEON 591 PM_CMDIDX_SN_INIT_ACK = 0x50UL, /// to inform PM SN is start up 592 //51->Aeon Command Index 593 PM_CMDIDX_ACK_AEONTo51 = 0xA0UL, /// PM Command Index is ACK AEON To 51 594 595 } PM_CmdIndex; 596 597 typedef enum 598 { 599 E_WDT_NOT_ENABLE, 600 E_WDT_REFRESH, 601 E_WDT_STOP_REFRESH, 602 E_WDT_RESET_SYSTEM_IMMEDIATE, 603 } WDT_STATUS; 604 605 606 607 typedef enum 608 { 609 E_ON_BOARD_LED_OFF= 0, 610 E_ON_BOARD_LED_PATTERN_1 = 1, 611 E_ON_BOARD_LED_PATTERN_2 = 2, 612 E_ON_BOARD_LED_PATTERN_3 = 3, 613 E_ON_BOARD_LED_PATTERN_4 = 4, 614 E_ON_BOARD_LED_PATTERN_5 = 5, 615 E_ON_BOARD_LED_ON= 255, 616 } USB_LED_PATTERN; 617 618 typedef enum 619 { 620 E_ON_BOARD_LED_STAGE_BIST= 0, 621 E_ON_BOARD_LED_STAGE_MBOOT_SUCCESS=1, 622 E_ON_BOARD_LED_STAGE_APL_SUCCESS= 2, 623 E_ON_BOARD_LED_STAGE_UPDATE_SW= 3, 624 } ON_BOARD_LED_STAGE; 625 626 627 typedef enum 628 { 629 E_PROGRAM_TIMER_IS_SET= 0, 630 E_PROGRAM_TIMER_IS_REMINDING= 1, 631 E_PROGRAM_TIMER_IS_RECORDING=2, 632 E_PROGRAM_TIMER_IS_NOT_SET= 3, 633 } PROGRAM_TIMER_LED_STATUS; 634 635 typedef enum 636 { 637 E_SW_UPDATE_NOT_IN_PROGRESS= 0, 638 E_SW_UPDATE_IN_PROGRESS= 1, 639 E_SW_UPDATE_FAILED= 2, 640 E_SW_UPDATE_SUCCESSFUL= 3, 641 E_SW_UPDATE_FAN_ERROR=4, 642 E_SW_UPDATE_FAN_ERROR_RECOVER=5, 643 } SW_UPDATE_STATUS; 644 645 typedef enum 646 { 647 E_POWER_LED_N_PROGRAM_TIMER_LED_MODE1= 1, 648 E_POWER_LED_N_PROGRAM_TIMER_LED_MODE2= 2, 649 E_POWER_LED_N_PROGRAM_TIMER_LED_MODE3= 3, 650 E_POWER_LED_N_PROGRAM_TIMER_LED_MODE4= 4, 651 E_POWER_LED_N_PROGRAM_TIMER_LED_MODE5= 5, 652 E_POWER_LED_N_PROGRAM_TIMER_LED_MODE6= 6, 653 E_POWER_LED_N_PROGRAM_TIMER_LED_MODE7= 7, 654 E_POWER_LED_N_PROGRAM_TIMER_LED_MODE8= 8, 655 E_POWER_LED_N_PROGRAM_TIMER_LED_MODE9= 9, 656 E_POWER_LED_N_PROGRAM_TIMER_LED_MODE10= 10, 657 E_POWER_LED_N_PROGRAM_TIMER_LED_MODE11= 11, 658 E_POWER_LED_N_PROGRAM_TIMER_LED_MODE12= 12, 659 } POWER_LED_N_PROGRAM_TIMER_LED_MODE; 660 661 typedef enum 662 { 663 E_POWER_LED_KEEP= 0, 664 E_POWER_LED_GREEN, 665 E_POWER_LED_RED, 666 E_POWER_LED_ORANGE, 667 } UPATE_POWER_LED_PATTERN; 668 669 670 ///Define PM STR Mode enum 671 typedef enum 672 { 673 E_PM_NON_STR=0, /// non-str dc on 674 E_PM_NON_STR_AC, /// non-str ac on 675 E_PM_STR, /// str 676 E_PM_STR_CRC, /// str and crc 677 }PM_STRMode; 678 679 /// Define PM Wake-up Configuration 680 #define CRC_KERNEL_BUF (3) 681 typedef struct __attribute__ ((aligned (4096))) 682 { 683 MS_U8 bPmWakeEnableIR : 1;/// For PM IR Wake-up 684 MS_U8 bPmWakeEnableSAR : 1;/// For PM SAR Wake-up 685 MS_U8 bPmWakeEnableGPIO0 : 1;/// For PM GPIO0 Wake-up 686 MS_U8 bPmWakeEnableGPIO1 : 1;/// For PM GPIO1 Wake-up 687 MS_U8 bPmWakeEnableUART1 : 1; /// For PM UART1 Wake-up 688 MS_U8 bPmWakeEnableSYNC : 1;/// For PM SYNC Wake-up 689 MS_U8 bPmWakeEnableESYNC : 1;/// For PM EasySYNC Wake-up 690 691 MS_U8 bPmWakeEnableRTC0 : 1;/// For PM RTC0 Wake-up 692 MS_U8 bPmWakeEnableRTC1 : 1;/// For PM RTC1 Wake-up 693 MS_U8 bPmWakeEnableDVI0 : 1;/// For PM DVI0 Wake-up 694 MS_U8 bPmWakeEnableDVI2 : 1;/// For PM DVI1 Wake-up 695 MS_U8 bPmWakeEnableCEC : 1;/// For PM CEC Wake-up 696 MS_U8 bPmWakeEnableAVLINK : 1;/// For PM AVLINK Wake-up 697 MS_U8 bPmWakeEnableMHL : 1;/// For PM MHL Wake-up 698 MS_U8 bPmWakeEnableWOL : 1;/// For PM WOL Wake-up 699 700 MS_U8 u8PmWakeIR[PM_MAX_BUF_WAKE_IR];///For PM IR Wake-up key define 701 MS_U8 u8PmWakeIR2[PM_MAX_BUF_WAKE_IR2];///For PM IR Wake-up key define 702 MS_U8 u8PmWakeMACAddress[PM_MAX_BUF_WAKE_MAC_ADDRESS];///For PM WOL Wake-up Mac define 703 704 MS_U8 u8PmStrMode; 705 MS_BOOL bLxCRCMiu[CRC_KERNEL_BUF]; 706 MS_U32 u32LxCRCAddress[CRC_KERNEL_BUF]; 707 MS_U32 u32LxCRCSize[CRC_KERNEL_BUF]; 708 } PM_WakeCfg; 709 710 /// Define PWM simaulator IR mode 711 typedef struct __attribute__ ((aligned (4096))) 712 { 713 MS_U8 u8IREncodeMode; 714 MS_U8 u8Customercode1; 715 MS_U8 u8Customercode2; 716 MS_U8 u8IRKeycode; 717 MS_U8 u8IRRepeat; 718 MS_U8 u8Reserved0; /// Reserved 719 MS_U8 u8Reserved1; /// Reserved 720 MS_U8 u8Reserved2; /// Reserved 721 } PWMSimIR_CFG; 722 723 typedef struct __attribute__ ((aligned (4096))) 724 { 725 //MS_U32 u32RtcCounter; 726 //MS_U8 u8WakeupSource; 727 MS_U16 u16Offset; 728 MS_U16 u16DataLen; 729 MS_U8 u8ExtraSramData[]; //Max size 512 bytes 730 } PM_ExtraSramData; 731 732 /// Define PM Power Down Modes 733 typedef struct __attribute__ ((aligned (4096))) 734 { 735 MS_U8 u8PowerDownMode; /// Power Down Mode 736 MS_U8 u8WakeAddress; 737 738 } PM_PowerDownCfg; 739 740 /// Define PM RTC Parameters 741 typedef struct __attribute__ ((aligned (4096))) 742 { 743 MS_U32 u32RtcCtrlWord; /// Define PM RTC Control Word 744 MS_U32 u32RtcSetMatchCounter; /// Define PM RTC for Set Match Counter 745 MS_U32 u32RtcGetMatchCounter; /// Define PM RTC for Get Match Counter 746 MS_U32 u32RtcSetCounter; /// Define PM RTC for Set Counter 747 MS_U32 u32RtcGetCounter; /// Define PM RTC for Get Counter 748 MS_U8 u8PmRtcIndex; /// Define PM RTC Index 749 MS_U8 u8Reserved0; /// Reserved 750 MS_U8 u8Reserved1; /// Reserved 751 MS_U8 u8Reserved2; /// Reserved 752 753 } PM_RtcParam; 754 755 /// Define PM Driver Information 756 typedef struct __attribute__ ((aligned (4096))) 757 { 758 MS_U8 u8PmSupSleepMode; /// Spuuort PM Sleep Mode 759 MS_U8 u8PmSupRtcIdxMax; /// Support RTC Index Max 760 761 }PM_DrvInfo; 762 763 typedef struct 764 { 765 MS_U8 u8Reserved[16]; ///Dummy Write for MIU FIFO 766 767 }PM_Dummy; 768 769 770 //------------------------------------------------------------------------------------------------- 771 // Function and Variable 772 //------------------------------------------------------------------------------------------------- 773 //------------------------------------------------------------------------------------------------- 774 /// MOBF Encrypt 775 /// @ingroup G_PM_ToBeRemove 776 /// @param u32Key \b IN: Key 777 /// @param bEnable \b IN: TRUE/FLASE 778 /// @return DRVAESDMA_OK : Success 779 /// @return Others : Fail 780 //------------------------------------------------------------------------------------------------- 781 // MS_BOOL MDrv_PM_isRunning(void); 782 //------------------------------------------------------------------------------------------------- 783 /// MOBF Encrypt 784 /// @ingroup G_PM_ToBeRemove 785 /// @param u32Key \b IN: Key 786 /// @param bEnable \b IN: TRUE/FLASE 787 /// @return DRVAESDMA_OK : Success 788 /// @return Others : Fail 789 //------------------------------------------------------------------------------------------------- 790 // void MDrv_PM_InterruptRequest( void ); 791 void MDrv_PM_LoadFw( MS_U8 *pPmCode, MS_U16 u16Len ); 792 //------------------------------------------------------------------------------------------------- 793 /// MOBF Encrypt 794 /// @ingroup G_PM_ToBeRemove 795 /// @param u32Key \b IN: Key 796 /// @param bEnable \b IN: TRUE/FLASE 797 /// @return DRVAESDMA_OK : Success 798 /// @return Others : Fail 799 //------------------------------------------------------------------------------------------------- 800 MS_BOOL MDrv_PM_RegWrite( MS_U16 u16Addr, MS_U8 u8Data ); 801 //------------------------------------------------------------------------------------------------- 802 /// MOBF Encrypt 803 /// @ingroup G_PM_ToBeRemove 804 /// @param u32Key \b IN: Key 805 /// @param bEnable \b IN: TRUE/FLASE 806 /// @return DRVAESDMA_OK : Success 807 /// @return Others : Fail 808 //------------------------------------------------------------------------------------------------- 809 MS_U8 MDrv_PM_RegRead( MS_U16 u16Addr ); 810 //------------------------------------------------------------------------------------------------- 811 /// MOBF Encrypt 812 /// @ingroup G_PM_ToBeRemove 813 /// @param u32Key \b IN: Key 814 /// @param bEnable \b IN: TRUE/FLASE 815 /// @return DRVAESDMA_OK : Success 816 /// @return Others : Fail 817 //------------------------------------------------------------------------------------------------- 818 // void MDrv_PM_RegWriteBit(MS_U16 u16Addr, MS_U8 bBit, MS_U8 u8BitPos ); 819 //------------------------------------------------------------------------------------------------- 820 /// MOBF Encrypt 821 /// @ingroup G_PM_ToBeRemove 822 /// @param u32Key \b IN: Key 823 /// @param bEnable \b IN: TRUE/FLASE 824 /// @return DRVAESDMA_OK : Success 825 /// @return Others : Fail 826 //------------------------------------------------------------------------------------------------- 827 // MS_U8 MDrv_PM_RegReadBit(MS_U16 u16Addr, MS_U8 u8BitPos); 828 //------------------------------------------------------------------------------------------------- 829 /// MOBF Encrypt 830 /// @ingroup G_PM_ToBeRemove 831 /// @param u32Key \b IN: Key 832 /// @param bEnable \b IN: TRUE/FLASE 833 /// @return DRVAESDMA_OK : Success 834 /// @return Others : Fail 835 //------------------------------------------------------------------------------------------------- 836 // void MDrv_PM_RegWrite2byte( MS_U16 u16RegIndex, MS_U16 u16Value ); 837 //------------------------------------------------------------------------------------------------- 838 /// MOBF Encrypt 839 /// @ingroup G_PM_ToBeRemove 840 /// @param u32Key \b IN: Key 841 /// @param bEnable \b IN: TRUE/FLASE 842 /// @return DRVAESDMA_OK : Success 843 /// @return Others : Fail 844 //------------------------------------------------------------------------------------------------- 845 // void MDrv_PM_RegWrite3byte( MS_U16 u16Regndex, MS_U32 u32Value ); 846 //------------------------------------------------------------------------------------------------- 847 /// MOBF Encrypt 848 /// @ingroup G_PM_CONTROL 849 /// @param u32Key \b IN: Key 850 /// @param bEnable \b IN: TRUE/FLASE 851 /// @return DRVAESDMA_OK : Success 852 /// @return Others : Fail 853 //------------------------------------------------------------------------------------------------- 854 // MS_BOOL MDrv_PM_Control( MS_U8 u8opcode, MS_U8 u8Data, MS_U16 u16Data ); 855 //------------------------------------------------------------------------------------------------- 856 /// MOBF Encrypt 857 /// @ingroup G_PM_CONTROL 858 /// @param u32Key \b IN: Key 859 /// @param bEnable \b IN: TRUE/FLASE 860 /// @return DRVAESDMA_OK : Success 861 /// @return Others : Fail 862 //------------------------------------------------------------------------------------------------- 863 MS_BOOL MDrv_PM_CtrlWrite( MS_U8 u8Opcode, MS_U8 u8CmdType, MS_U8 u8DataNum, MS_U8 *pu8Data ); 864 //------------------------------------------------------------------------------------------------- 865 /// MOBF Encrypt 866 /// @ingroup G_PM_CONTROL 867 /// @param u32Key \b IN: Key 868 /// @param bEnable \b IN: TRUE/FLASE 869 /// @return DRVAESDMA_OK : Success 870 /// @return Others : Fail 871 //------------------------------------------------------------------------------------------------- 872 // MS_BOOL MDrv_PM_CtrlRead( MS_U8 u8Opcode, MS_U8 u8CmdType, MS_U8 u8DataNum, MS_U8 *pu8Data ); 873 //------------------------------------------------------------------------------------------------- 874 /// MOBF Encrypt 875 /// @ingroup G_PM_CONTROL 876 /// @param u32Key \b IN: Key 877 /// @param bEnable \b IN: TRUE/FLASE 878 /// @return DRVAESDMA_OK : Success 879 /// @return Others : Fail 880 //------------------------------------------------------------------------------------------------- 881 // MS_BOOL MDrv_PM_MemoryWrite(MS_U8 *pu8Data, MS_U16 u16MemLen); 882 //------------------------------------------------------------------------------------------------- 883 /// MOBF Encrypt 884 /// @ingroup G_PM_CONTROL 885 /// @param u32Key \b IN: Key 886 /// @param bEnable \b IN: TRUE/FLASE 887 /// @return DRVAESDMA_OK : Success 888 /// @return Others : Fail 889 //------------------------------------------------------------------------------------------------- 890 // MS_BOOL MDrv_PM_MemoryRead(MS_U8 *pu8Data, MS_U16 u16MemLen); 891 //------------------------------------------------------------------------------------------------- 892 /// MOBF Encrypt 893 /// @ingroup G_PM_RTC 894 /// @param u32Key \b IN: Key 895 /// @param bEnable \b IN: TRUE/FLASE 896 /// @return DRVAESDMA_OK : Success 897 /// @return Others : Fail 898 //------------------------------------------------------------------------------------------------- 899 void MDrv_PM_RTCEnableInterrupt(MS_BOOL bEnable); 900 //------------------------------------------------------------------------------------------------- 901 /// MOBF Encrypt 902 /// @ingroup G_PM_RTC 903 /// @param u32Key \b IN: Key 904 /// @param bEnable \b IN: TRUE/FLASE 905 /// @return DRVAESDMA_OK : Success 906 /// @return Others : Fail 907 //------------------------------------------------------------------------------------------------- 908 // void MDrv_PM_RTC2EnableInterrupt(MS_BOOL bEnable); 909 //------------------------------------------------------------------------------------------------- 910 /// MOBF Encrypt 911 /// @ingroup G_PM_RTC 912 /// @param u32Key \b IN: Key 913 /// @param bEnable \b IN: TRUE/FLASE 914 /// @return DRVAESDMA_OK : Success 915 /// @return Others : Fail 916 //------------------------------------------------------------------------------------------------- 917 // void MDrv_PM_RTC2SetMatchTime(MS_U32 u32PmSysTime); 918 /*add by owen.qin end*/ 919 //------------------------------------------------------------------------------------------------- 920 /// MOBF Encrypt 921 /// @ingroup G_PM_RTC 922 /// @param u32Key \b IN: Key 923 /// @param bEnable \b IN: TRUE/FLASE 924 /// @return DRVAESDMA_OK : Success 925 /// @return Others : Fail 926 //------------------------------------------------------------------------------------------------- 927 void MDrv_PM_RTCSetMatchTime(MS_U32 u32PmSysTime); 928 //------------------------------------------------------------------------------------------------- 929 /// MOBF Encrypt 930 /// @ingroup G_PM_RTC 931 /// @param u32Key \b IN: Key 932 /// @param bEnable \b IN: TRUE/FLASE 933 /// @return DRVAESDMA_OK : Success 934 /// @return Others : Fail 935 //------------------------------------------------------------------------------------------------- 936 MS_U32 MDrv_PM_RTCGetMatchTime(void); 937 //------------------------------------------------------------------------------------------------- 938 /// MOBF Encrypt 939 /// @ingroup G_PM_RTC 940 /// @param u32Key \b IN: Key 941 /// @param bEnable \b IN: TRUE/FLASE 942 /// @return DRVAESDMA_OK : Success 943 /// @return Others : Fail 944 //------------------------------------------------------------------------------------------------- 945 void MDrv_PM_RTCSetSystemTime(MS_U32 u32PmSysTime); 946 //------------------------------------------------------------------------------------------------- 947 /// MOBF Encrypt 948 /// @ingroup G_PM_RTC 949 /// @param u32Key \b IN: Key 950 /// @param bEnable \b IN: TRUE/FLASE 951 /// @return DRVAESDMA_OK : Success 952 /// @return Others : Fail 953 //------------------------------------------------------------------------------------------------- 954 MS_U32 MDrv_PM_RTCGetSystemTime(void); 955 //------------------------------------------------------------------------------------------------- 956 /// MOBF Encrypt 957 /// @ingroup G_PM_RTC 958 /// @param u32Key \b IN: Key 959 /// @param bEnable \b IN: TRUE/FLASE 960 /// @return DRVAESDMA_OK : Success 961 /// @return Others : Fail 962 //------------------------------------------------------------------------------------------------- 963 void MDrv_PM_RTCInit(MS_U32 u32CtrlWord); 964 //------------------------------------------------------------------------------------------------- 965 /// MOBF Encrypt 966 /// @ingroup G_PM_CONTROL 967 /// @param u32Key \b IN: Key 968 /// @param bEnable \b IN: TRUE/FLASE 969 /// @return DRVAESDMA_OK : Success 970 /// @return Others : Fail 971 //------------------------------------------------------------------------------------------------- 972 void MDrv_PM_IRInit(MS_U8 irclk_mhz, PM_IrRegCfg *irRegCfg); 973 //------------------------------------------------------------------------------------------------- 974 /// MOBF Encrypt 975 /// @ingroup G_PM_CONTROL 976 /// @param u32Key \b IN: Key 977 /// @param bEnable \b IN: TRUE/FLASE 978 /// @return DRVAESDMA_OK : Success 979 /// @return Others : Fail 980 //------------------------------------------------------------------------------------------------- 981 // void MDrv_PM_KeypadInit(PM_SarRegCfg *sarRegCfg, PM_SarParamCfg *sarParamCfg); 982 //------------------------------------------------------------------------------------------------- 983 /// MOBF Encrypt 984 /// @ingroup G_PM_CONTROL 985 /// @param u32Key \b IN: Key 986 /// @param bEnable \b IN: TRUE/FLASE 987 /// @return DRVAESDMA_OK : Success 988 /// @return Others : Fail 989 //------------------------------------------------------------------------------------------------- 990 // void MDrv_PM_CalibrateRC(void); 991 //------------------------------------------------------------------------------------------------- 992 /// MOBF Encrypt 993 /// @ingroup G_PM_ToBeRemove 994 /// @param u32Key \b IN: Key 995 /// @param bEnable \b IN: TRUE/FLASE 996 /// @return DRVAESDMA_OK : Success 997 /// @return Others : Fail 998 //------------------------------------------------------------------------------------------------- 999 MS_BOOL MDrv_PM_isDownloaded(void); 1000 //------------------------------------------------------------------------------------------------- 1001 /// MOBF Encrypt 1002 /// @ingroup G_PM_ToBeRemove 1003 /// @param u32Key \b IN: Key 1004 /// @param bEnable \b IN: TRUE/FLASE 1005 /// @return DRVAESDMA_OK : Success 1006 /// @return Others : Fail 1007 //------------------------------------------------------------------------------------------------- 1008 void MDrv_PM_Set_Download(void); 1009 //------------------------------------------------------------------------------------------------- 1010 /// MOBF Encrypt 1011 /// @ingroup G_PM_ToBeRemove 1012 /// @param u32Key \b IN: Key 1013 /// @param bEnable \b IN: TRUE/FLASE 1014 /// @return DRVAESDMA_OK : Success 1015 /// @return Others : Fail 1016 //------------------------------------------------------------------------------------------------- 1017 // void MDrv_PM_IrqAttach(PM_IRQ_TYPE irq, PM_IsrCb_Type isr, MS_U32 data); 1018 //------------------------------------------------------------------------------------------------- 1019 /// MOBF Encrypt 1020 /// @ingroup G_PM_ToBeRemove 1021 /// @param u32Key \b IN: Key 1022 /// @param bEnable \b IN: TRUE/FLASE 1023 /// @return DRVAESDMA_OK : Success 1024 /// @return Others : Fail 1025 //------------------------------------------------------------------------------------------------- 1026 // void MDrv_PM_IrqDetach(PM_IRQ_TYPE irq); 1027 //------------------------------------------------------------------------------------------------- 1028 /// MOBF Encrypt 1029 /// @ingroup G_PM_ToBeRemove 1030 /// @param u32Key \b IN: Key 1031 /// @param bEnable \b IN: TRUE/FLASE 1032 /// @return DRVAESDMA_OK : Success 1033 /// @return Others : Fail 1034 //------------------------------------------------------------------------------------------------- 1035 // void MDrv_PM_IrqUnmask(PM_IRQ_TYPE irq); 1036 //------------------------------------------------------------------------------------------------- 1037 /// MOBF Encrypt 1038 /// @ingroup G_PM_ToBeRemove 1039 /// @param u32Key \b IN: Key 1040 /// @param bEnable \b IN: TRUE/FLASE 1041 /// @return DRVAESDMA_OK : Success 1042 /// @return Others : Fail 1043 //------------------------------------------------------------------------------------------------- 1044 // void MDrv_PM_IrqMask(PM_IRQ_TYPE irq); 1045 //------------------------------------------------------------------------------------------------- 1046 /// MOBF Encrypt 1047 /// @ingroup G_PM_ToBeRemove 1048 /// @param u32Key \b IN: Key 1049 /// @param bEnable \b IN: TRUE/FLASE 1050 /// @return DRVAESDMA_OK : Success 1051 /// @return Others : Fail 1052 //------------------------------------------------------------------------------------------------- 1053 // void MDrv_PM_IrqMaskAll(void); 1054 1055 //------------------------------------------------------------------------------------------------- 1056 /// MOBF Encrypt 1057 /// @ingroup G_PM_CONTROL 1058 /// @param u32Key \b IN: Key 1059 /// @param bEnable \b IN: TRUE/FLASE 1060 /// @return DRVAESDMA_OK : Success 1061 /// @return Others : Fail 1062 //------------------------------------------------------------------------------------------------- 1063 PM_Result MDrv_PM_ActiveStandbyMode(MS_BOOL bTrigger); 1064 //------------------------------------------------------------------------------------------------- 1065 /// MOBF Encrypt 1066 /// @ingroup G_PM_CONTROL 1067 /// @param u32Key \b IN: Key 1068 /// @param bEnable \b IN: TRUE/FLASE 1069 /// @return DRVAESDMA_OK : Success 1070 /// @return Others : Fail 1071 //------------------------------------------------------------------------------------------------- 1072 PM_Result MDrv_PM_IsActiveStandbyMode(MS_BOOL *bActive); 1073 1074 //------------------------------------------------------------------------------------------------- 1075 /// MOBF Encrypt 1076 /// @ingroup G_PM_INIT 1077 /// @param u32Key \b IN: Key 1078 /// @param bEnable \b IN: TRUE/FLASE 1079 /// @return DRVAESDMA_OK : Success 1080 /// @return Others : Fail 1081 //------------------------------------------------------------------------------------------------- 1082 PM_Result MDrv_PM_Init(PM_WakeCfg *pPmWakeCfg); 1083 //------------------------------------------------------------------------------------------------- 1084 /// MOBF Encrypt 1085 /// @ingroup G_PM_COMMON 1086 /// @param u32Key \b IN: Key 1087 /// @param bEnable \b IN: TRUE/FLASE 1088 /// @return DRVAESDMA_OK : Success 1089 /// @return Others : Fail 1090 //------------------------------------------------------------------------------------------------- 1091 // PM_Result MDrv_PM_GetStatus(PM_DrvStatus *pDrvStatus); 1092 //------------------------------------------------------------------------------------------------- 1093 /// MOBF Encrypt 1094 /// @ingroup G_PM_COMMON 1095 /// @param u32Key \b IN: Key 1096 /// @param bEnable \b IN: TRUE/FLASE 1097 /// @return DRVAESDMA_OK : Success 1098 /// @return Others : Fail 1099 //------------------------------------------------------------------------------------------------- 1100 PM_Result MDrv_PM_GetLibVer(const MSIF_Version **ppVersion); 1101 //------------------------------------------------------------------------------------------------- 1102 /// MOBF Encrypt 1103 /// @ingroup G_PM_COMMON 1104 /// @param u32Key \b IN: Key 1105 /// @param bEnable \b IN: TRUE/FLASE 1106 /// @return DRVAESDMA_OK : Success 1107 /// @return Others : Fail 1108 //------------------------------------------------------------------------------------------------- 1109 PM_Result MDrv_PM_PowerDown(PM_PowerDownCfg *pPmPowerDownCfg); 1110 //------------------------------------------------------------------------------------------------- 1111 /// MOBF Encrypt 1112 /// @ingroup G_PM_COMMON 1113 /// @param u32Key \b IN: Key 1114 /// @param bEnable \b IN: TRUE/FLASE 1115 /// @return DRVAESDMA_OK : Success 1116 /// @return Others : Fail 1117 //------------------------------------------------------------------------------------------------- 1118 // PM_Result MDrv_PM_GetMasterKey(MS_U8 *pPmPowerDownCfg); 1119 //------------------------------------------------------------------------------------------------- 1120 /// MOBF Encrypt 1121 /// @ingroup G_PM_ToBeRemove 1122 /// @param u32Key \b IN: Key 1123 /// @param bEnable \b IN: TRUE/FLASE 1124 /// @return DRVAESDMA_OK : Success 1125 /// @return Others : Fail 1126 //------------------------------------------------------------------------------------------------- 1127 // PM_Result MDrv_PM_GetDeviceID(MS_U8 *DeviceID); 1128 //------------------------------------------------------------------------------------------------- 1129 /// MOBF Encrypt 1130 /// @ingroup G_PM_ToBeRemove 1131 /// @param u32Key \b IN: Key 1132 /// @param bEnable \b IN: TRUE/FLASE 1133 /// @return DRVAESDMA_OK : Success 1134 /// @return Others : Fail 1135 //------------------------------------------------------------------------------------------------- 1136 // PM_Result MDrv_PM_GetChipID(MS_U8 *ChipParam); 1137 //------------------------------------------------------------------------------------------------- 1138 /// MOBF Encrypt 1139 /// @ingroup G_PM_COMMON 1140 /// @param u32Key \b IN: Key 1141 /// @param bEnable \b IN: TRUE/FLASE 1142 /// @return DRVAESDMA_OK : Success 1143 /// @return Others : Fail 1144 //------------------------------------------------------------------------------------------------- 1145 // PM_Result MDrv_PM_GetPMMemAddr(MS_U8 *PmMemAddr); 1146 //------------------------------------------------------------------------------------------------- 1147 /// MOBF Encrypt 1148 /// @ingroup G_PM_COMMON 1149 /// @param u32Key \b IN: Key 1150 /// @param bEnable \b IN: TRUE/FLASE 1151 /// @return DRVAESDMA_OK : Success 1152 /// @return Others : Fail 1153 //-------------------------------------------------------------------------------------------------- 1154 // const PM_DrvInfo* MDrv_PM_GetInfo(void); 1155 //------------------------------------------------------------------------------------------------- 1156 /// MOBF Encrypt 1157 /// @ingroup G_PM_INIT 1158 /// @param u32Key \b IN: Key 1159 /// @param bEnable \b IN: TRUE/FLASE 1160 /// @return DRVAESDMA_OK : Success 1161 /// @return Others : Fail 1162 //------------------------------------------------------------------------------------------------- 1163 // PM_Result MDrv_PM_GPIOInit(MS_U16 u16GPIOIndex); 1164 //------------------------------------------------------------------------------------------------- 1165 /// MOBF Encrypt 1166 /// @ingroup G_PM_COMMON 1167 /// @param u32Key \b IN: Key 1168 /// @param bEnable \b IN: TRUE/FLASE 1169 /// @return DRVAESDMA_OK : Success 1170 /// @return Others : Fail 1171 //------------------------------------------------------------------------------------------------- 1172 PM_Result MDrv_PM_SetDbgLevel(PM_DbgLv eLevel); 1173 //------------------------------------------------------------------------------------------------- 1174 /// MOBF Encrypt 1175 /// @ingroup G_PM_INIT 1176 /// @param u32Key \b IN: Key 1177 /// @param bEnable \b IN: TRUE/FLASE 1178 /// @return DRVAESDMA_OK : Success 1179 /// @return Others : Fail 1180 //------------------------------------------------------------------------------------------------- 1181 PM_Result MDrv_PM_RtcInit(PM_RtcParam *pPmRtcParam); 1182 //------------------------------------------------------------------------------------------------- 1183 /// MOBF Encrypt 1184 /// @ingroup G_PM_ToBeRemove 1185 /// @param u32Key \b IN: Key 1186 /// @param bEnable \b IN: TRUE/FLASE 1187 /// @return DRVAESDMA_OK : Success 1188 /// @return Others : Fail 1189 //------------------------------------------------------------------------------------------------- 1190 // void MDrv_PM_Rtc_DisableInit(E_PM_RTC eRtc); 1191 //------------------------------------------------------------------------------------------------- 1192 /// MOBF Encrypt 1193 /// @ingroup G_PM_RTC 1194 /// @param u32Key \b IN: Key 1195 /// @param bEnable \b IN: TRUE/FLASE 1196 /// @return DRVAESDMA_OK : Success 1197 /// @return Others : Fail 1198 //------------------------------------------------------------------------------------------------- 1199 PM_Result MDrv_PM_RtcSetCounter(PM_RtcParam *pPmRtcParam); 1200 //------------------------------------------------------------------------------------------------- 1201 /// MOBF Encrypt 1202 /// @ingroup G_PM_RTC 1203 /// @param u32Key \b IN: Key 1204 /// @param bEnable \b IN: TRUE/FLASE 1205 /// @return DRVAESDMA_OK : Success 1206 /// @return Others : Fail 1207 //------------------------------------------------------------------------------------------------- 1208 // PM_Result MDrv_PM_RtcGetCounter(PM_RtcParam *pPmRtcParam); 1209 //------------------------------------------------------------------------------------------------- 1210 /// MOBF Encrypt 1211 /// @ingroup G_PM_RTC 1212 /// @param u32Key \b IN: Key 1213 /// @param bEnable \b IN: TRUE/FLASE 1214 /// @return DRVAESDMA_OK : Success 1215 /// @return Others : Fail 1216 //------------------------------------------------------------------------------------------------- 1217 PM_Result MDrv_PM_RtcSetMatchCounter(PM_RtcParam *pPmRtcParam); 1218 //------------------------------------------------------------------------------------------------- 1219 /// MOBF Encrypt 1220 /// @ingroup G_PM_RTC 1221 /// @param u32Key \b IN: Key 1222 /// @param bEnable \b IN: TRUE/FLASE 1223 /// @return DRVAESDMA_OK : Success 1224 /// @return Others : Fail 1225 //------------------------------------------------------------------------------------------------- 1226 // PM_Result MDrv_PM_RtcGetMatchCounter(PM_RtcParam *pPmRtcParam); 1227 //------------------------------------------------------------------------------------------------- 1228 /// MOBF Encrypt 1229 /// @ingroup G_PM_COMMON 1230 /// @param u32Key \b IN: Key 1231 /// @param bEnable \b IN: TRUE/FLASE 1232 /// @return DRVAESDMA_OK : Success 1233 /// @return Others : Fail 1234 //------------------------------------------------------------------------------------------------- 1235 // PM_Result MDrv_PM_GetExtraSramData(PM_ExtraSramData *pPmExtraSramData); 1236 //------------------------------------------------------------------------------------------------- 1237 /// MOBF Encrypt 1238 /// @ingroup G_PM_COMMON 1239 /// @param u32Key \b IN: Key 1240 /// @param bEnable \b IN: TRUE/FLASE 1241 /// @return DRVAESDMA_OK : Success 1242 /// @return Others : Fail 1243 //------------------------------------------------------------------------------------------------- 1244 // PM_Result MDrv_PM_SetExtraSramData(PM_ExtraSramData *pPmExtraSramData); 1245 1246 //------------------------------------------------------------------------------------------------- 1247 /// MOBF Encrypt 1248 /// @ingroup G_PM_OTHER 1249 /// @param u32Key \b IN: Key 1250 /// @param bEnable \b IN: TRUE/FLASE 1251 /// @return DRVAESDMA_OK : Success 1252 /// @return Others : Fail 1253 //------------------------------------------------------------------------------------------------- 1254 void MDrv_PM_SetSPIOffsetForMCU(MS_U32 BANK); 1255 //------------------------------------------------------------------------------------------------- 1256 /// MOBF Encrypt 1257 /// @ingroup G_PM_OTHER 1258 /// @param u32Key \b IN: Key 1259 /// @param bEnable \b IN: TRUE/FLASE 1260 /// @return DRVAESDMA_OK : Success 1261 /// @return Others : Fail 1262 //------------------------------------------------------------------------------------------------- 1263 void MDrv_PM_SetSRAMOffsetForMCU(void); 1264 //------------------------------------------------------------------------------------------------- 1265 /// MOBF Encrypt 1266 /// @ingroup G_PM_OTHER 1267 /// @param u32Key \b IN: Key 1268 /// @param bEnable \b IN: TRUE/FLASE 1269 /// @return DRVAESDMA_OK : Success 1270 /// @return Others : Fail 1271 //------------------------------------------------------------------------------------------------- 1272 MS_BOOL MDrv_PM_SetDRAMOffsetForMCU(MS_U32 u32Offset); 1273 //------------------------------------------------------------------------------------------------- 1274 /// MOBF Encrypt 1275 /// @ingroup G_PM_COMMON 1276 /// @param u32Key \b IN: Key 1277 /// @param bEnable \b IN: TRUE/FLASE 1278 /// @return DRVAESDMA_OK : Success 1279 /// @return Others : Fail 1280 //------------------------------------------------------------------------------------------------- 1281 PM_PowerOnMode MDrv_PM_PowerOnMode(void); 1282 //------------------------------------------------------------------------------------------------- 1283 /// MOBF Encrypt 1284 /// @ingroup G_PM_COMMON 1285 /// @param u32Key \b IN: Key 1286 /// @param bEnable \b IN: TRUE/FLASE 1287 /// @return DRVAESDMA_OK : Success 1288 /// @return Others : Fail 1289 //------------------------------------------------------------------------------------------------- 1290 PM_WakeupSource MDrv_PM_GetWakeupSource(void); 1291 //------------------------------------------------------------------------------------------------- 1292 /// MOBF Encrypt 1293 /// @ingroup G_PM_COMMON 1294 /// @param u32Key \b IN: Key 1295 /// @param bEnable \b IN: TRUE/FLASE 1296 /// @return DRVAESDMA_OK : Success 1297 /// @return Others : Fail 1298 //------------------------------------------------------------------------------------------------- 1299 // MS_U8 MDrv_PM_GetWakeupKey(void); 1300 //------------------------------------------------------------------------------------------------- 1301 /// MOBF Encrypt 1302 /// @ingroup G_PM_COMMON 1303 /// @param u32Key \b IN: Key 1304 /// @param bEnable \b IN: TRUE/FLASE 1305 /// @return DRVAESDMA_OK : Success 1306 /// @return Others : Fail 1307 //------------------------------------------------------------------------------------------------- 1308 PM_Result MDrv_PM_Disable51(void); 1309 //------------------------------------------------------------------------------------------------- 1310 /// MOBF Encrypt 1311 /// @ingroup G_PM_ToBeRemove 1312 /// @param u32Key \b IN: Key 1313 /// @param bEnable \b IN: TRUE/FLASE 1314 /// @return DRVAESDMA_OK : Success 1315 /// @return Others : Fail 1316 //------------------------------------------------------------------------------------------------- 1317 // PM_Result MDrv_PM_GPIO4_SetPower(MS_BOOL bOn); 1318 //------------------------------------------------------------------------------------------------- 1319 /// MOBF Encrypt 1320 /// @ingroup G_PM_PWM 1321 /// @param u32Key \b IN: Key 1322 /// @param bEnable \b IN: TRUE/FLASE 1323 /// @return DRVAESDMA_OK : Success 1324 /// @return Others : Fail 1325 //------------------------------------------------------------------------------------------------- 1326 PM_Result MDrv_PM_PWM_Init(MS_U8 u8PWM); 1327 //------------------------------------------------------------------------------------------------- 1328 /// MOBF Encrypt 1329 /// @ingroup G_PM_PWM 1330 /// @param u32Key \b IN: Key 1331 /// @param bEnable \b IN: TRUE/FLASE 1332 /// @return DRVAESDMA_OK : Success 1333 /// @return Others : Fail 1334 //------------------------------------------------------------------------------------------------- 1335 PM_Result MDrv_PM_PWM_Config(PWMSimIR_CFG *pPmPWMCfg); 1336 //------------------------------------------------------------------------------------------------- 1337 /// MOBF Encrypt 1338 /// @ingroup G_PM_PWM 1339 /// @param u32Key \b IN: Key 1340 /// @param bEnable \b IN: TRUE/FLASE 1341 /// @return DRVAESDMA_OK : Success 1342 /// @return Others : Fail 1343 //------------------------------------------------------------------------------------------------- 1344 PM_Result MDrv_PM_PWM_IRRecord_Init(void); 1345 //------------------------------------------------------------------------------------------------- 1346 /// MOBF Encrypt 1347 /// @ingroup G_PM_PWM 1348 /// @param u32Key \b IN: Key 1349 /// @param bEnable \b IN: TRUE/FLASE 1350 /// @return DRVAESDMA_OK : Success 1351 /// @return Others : Fail 1352 //------------------------------------------------------------------------------------------------- 1353 // PM_Result MDrv_PM_PWM_IRRecord_Receive_Complete(MS_U32 u32BufferAddr,MS_U16 u16BufferSize); 1354 //------------------------------------------------------------------------------------------------- 1355 /// MOBF Encrypt 1356 /// @ingroup G_PM_PWM 1357 /// @param u32Key \b IN: Key 1358 /// @param bEnable \b IN: TRUE/FLASE 1359 /// @return DRVAESDMA_OK : Success 1360 /// @return Others : Fail 1361 //------------------------------------------------------------------------------------------------- 1362 PM_Result MDrv_PM_PWM_IRRecord_Receive_Require(MS_U32 u32BufferAddr,MS_U16 u16BufferSize); 1363 //------------------------------------------------------------------------------------------------- 1364 /// MOBF Encrypt 1365 /// @ingroup G_PM_PWM 1366 /// @param u32Key \b IN: Key 1367 /// @param bEnable \b IN: TRUE/FLASE 1368 /// @return DRVAESDMA_OK : Success 1369 /// @return Others : Fail 1370 //------------------------------------------------------------------------------------------------- 1371 PM_Result MDrv_PM_PWM_IRRecord_Transmit(MS_U32 u32BufferAddr,MS_U16 u16BufferSize); 1372 //------------------------------------------------------------------------------------------------- 1373 /// MOBF Encrypt 1374 /// @ingroup G_PM_PWM 1375 /// @param u32Key \b IN: Key 1376 /// @param bEnable \b IN: TRUE/FLASE 1377 /// @return DRVAESDMA_OK : Success 1378 /// @return Others : Fail 1379 //------------------------------------------------------------------------------------------------- 1380 PM_Result MDrv_PM_PWM_IRRecord_SetCallBackFunction(IRRecord_Callback pCallback); 1381 //------------------------------------------------------------------------------------------------- 1382 /// MOBF Encrypt 1383 /// @ingroup G_PM_PWM 1384 /// @param u32Key \b IN: Key 1385 /// @param bEnable \b IN: TRUE/FLASE 1386 /// @return DRVAESDMA_OK : Success 1387 /// @return Others : Fail 1388 //------------------------------------------------------------------------------------------------- 1389 PM_Result MDrv_PM_PWM_IRRecord_Receive_Exit(void); 1390 //------------------------------------------------------------------------------------------------- 1391 /// MOBF Encrypt 1392 /// @ingroup G_PM_RTPM 1393 /// @param u32Key \b IN: Key 1394 /// @param bEnable \b IN: TRUE/FLASE 1395 /// @return DRVAESDMA_OK : Success 1396 /// @return Others : Fail 1397 //------------------------------------------------------------------------------------------------- 1398 void MDrv_PM_RunTimePM_Disable_PassWord(void); 1399 //------------------------------------------------------------------------------------------------- 1400 /// MOBF Encrypt 1401 /// @ingroup G_PM_STR 1402 /// @param u32Key \b IN: Key 1403 /// @param bEnable \b IN: TRUE/FLASE 1404 /// @return DRVAESDMA_OK : Success 1405 /// @return Others : Fail 1406 //------------------------------------------------------------------------------------------------- 1407 // void MDrv_PM_STR_CheckFactoryPowerOnModePassword(void); 1408 //------------------------------------------------------------------------------------------------- 1409 /// MOBF Encrypt 1410 /// @ingroup G_PM_STR 1411 /// @param u32Key \b IN: Key 1412 /// @param bEnable \b IN: TRUE/FLASE 1413 /// @return DRVAESDMA_OK : Success 1414 /// @return Others : Fail 1415 //------------------------------------------------------------------------------------------------- 1416 // PM_Result MDrv_PM_STR_CheckFactoryPowerOnMode_Second(MS_BOOL bCheck); 1417 //------------------------------------------------------------------------------------------------- 1418 /// MOBF Encrypt 1419 /// @ingroup G_PM_COMMON 1420 /// @param u32Key \b IN: Key 1421 /// @param bEnable \b IN: TRUE/FLASE 1422 /// @return DRVAESDMA_OK : Success 1423 /// @return Others : Fail 1424 //------------------------------------------------------------------------------------------------- 1425 PM_Result MDrv_PM_Check_Version(MS_BOOL bCheck); 1426 //------------------------------------------------------------------------------------------------- 1427 /// MOBF Encrypt 1428 /// @ingroup G_PM_COMMON 1429 /// @param u32Key \b IN: Key 1430 /// @param bEnable \b IN: TRUE/FLASE 1431 /// @return DRVAESDMA_OK : Success 1432 /// @return Others : Fail 1433 //------------------------------------------------------------------------------------------------- 1434 MS_U16 MDrv_PM_GetSRAMSize(void); 1435 //------------------------------------------------------------------------------------------------- 1436 /// MOBF Encrypt 1437 /// @ingroup G_PM_COMMON 1438 /// @param u32Key \b IN: Key 1439 /// @param bEnable \b IN: TRUE/FLASE 1440 /// @return DRVAESDMA_OK : Success 1441 /// @return Others : Fail 1442 //------------------------------------------------------------------------------------------------- 1443 MS_U8 MDrv_PM_GetIRPowerOnKey(void); 1444 1445 #ifdef __cplusplus 1446 } 1447 #endif 1448 1449 #endif // _DRV_PM_H_ 1450 1451