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 drvPWM.h 98 /// @brief Pulse Width Modulation driver Interface 99 /// @author MStar Semiconductor Inc. 100 /////////////////////////////////////////////////////////////////////////////////////////////////// 101 102 /*! \defgroup G_PWM PWM interface 103 \ingroup G_PERIPHERAL 104 105 \brief 106 107 Pulse-width modulation (PWM), or pulse-duration modulation (PDM), is a technique used to encode 108 a message into a pulsing signal. It is a type of modulation. Although this modulation technique 109 can be used to encode information for transmission, its main use is to allow the control of the 110 power supplied to electrical devices, especially to inertial loads such as motors. 111 112 <b>Features</b> 113 - PWM Initialize & De-initialize function 114 - PWM Duty Cycle function 115 - PWM Periodic function 116 117 <b> Operation Code Flow: </b> \n 118 -# PWM initialize with configuration. 119 -# PWM channel enable. 120 -# Setup duty cycle and periodic. 121 122 \defgroup G_PWM_INIT Initialization Task relative 123 \ingroup G_PWM 124 \defgroup G_PWM_COMMON Common Task relative 125 \ingroup G_PWM 126 \defgroup G_PWM_CONTROL Control relative 127 \ingroup G_PWM 128 \defgroup G_PWM_OTHER other relative 129 \ingroup G_PWM 130 \defgroup G_PWM_ToBeModified PWM api to be modified 131 \ingroup G_PWM 132 \defgroup G_PWM_ToBeRemove PWM api to be removed 133 \ingroup G_PWM 134 */ 135 136 #ifndef _DRV_TEMP_H_ 137 #define _DRV_TEMP_H_ 138 139 #ifdef __cplusplus 140 extern "C" 141 { 142 #endif 143 144 #include "UFO.h" 145 //////////////////////////////////////////////////////////////////////////////// 146 // Define & data type 147 //////////////////////////////////////////////////////////////////////////////// 148 #define MSIF_PWM_LIB_CODE {'P','W','M','_'} //Lib code 149 #define MSIF_PWM_LIBVER {'0','1'} //LIB version 150 #define MSIF_PWM_BUILDNUM {'0','6'} //Build Number 151 #define MSIF_PWM_CHANGELIST {'0','0','3','4','3','8','2','1'} //P4 ChangeList Number 152 #define MSIF_PWM_OS '0' //OS 153 154 #define PWM_DRV_VERSION /* Character String for DRV/API version */ \ 155 MSIF_TAG, /* 'MSIF' */ \ 156 MSIF_CLASS, /* '00' */ \ 157 MSIF_CUS, /* 0x0000 */ \ 158 MSIF_MOD, /* 0x0000 */ \ 159 MSIF_CHIP, \ 160 MSIF_CPU, \ 161 MSIF_PWM_LIB_CODE, /* IP__ */ \ 162 MSIF_PWM_LIBVER, /* 0.0 ~ Z.Z */ \ 163 MSIF_PWM_BUILDNUM, /* 00 ~ 99 */ \ 164 MSIF_PWM_CHANGELIST, /* CL# */ \ 165 MSIF_OS 166 167 #define PWM_DIV (4) 168 169 typedef enum _PWM_DbgLv 170 { 171 E_PWM_DBGLV_NONE, // no debug message 172 E_PWM_DBGLV_ERR_ONLY, // show error only 173 E_PWM_DBGLV_INFO, // show error & informaiton 174 E_PWM_DBGLV_ALL // show error, information & funciton name 175 }PWM_DbgLv; 176 177 typedef enum _PWM_ChNum 178 { 179 E_PWM_CH0, 180 E_PWM_CH1, 181 E_PWM_CH2, 182 E_PWM_CH3, 183 E_PWM_CH4, 184 E_PWM_CH5, 185 E_PWM_CH6, 186 E_PWM_CH7, 187 E_PWM_CH8, 188 E_PWM_CH9 189 }PWM_ChNum; 190 191 typedef enum _PWM_Property 192 { 193 E_PWM_GetPeriod, 194 E_PWM_GetDutyCycle, 195 E_PWM_GetShift, 196 E_PWM_GetDiv, 197 E_PWM_GetPolarity, 198 E_PWM_GetVdben, 199 E_PWM_GetRsten, 200 E_PWM_GetDben, 201 E_PWM_GetOen 202 }PWM_Property; 203 204 typedef enum _PWM_CntMode 205 { 206 E_PWM_Normal = 0x00, 207 E_PWM_01Mode = 0x10, 208 E_PWM_10Mode = 0x11 209 }PWM_CntMode; 210 211 typedef enum _PWM_Result 212 { 213 E_PWM_OK, 214 E_PWM_FAIL 215 } PWM_Result; 216 217 typedef struct _PWM_Info 218 { 219 MS_U8 u8ChNum; // number of this channel 220 MS_U32 u32IOMap; // base of this channel's registers 221 MS_U32 mck; // base clock rate from mcu 222 }PWM_Info; 223 224 /* This structure is full the same with hal for now. */ 225 typedef struct _PWM_Arg 226 { 227 MS_U16 index; 228 MS_U8 div; 229 MS_U16 period; 230 MS_U16 duty; 231 MS_BOOL polarity; 232 MS_BOOL vdben; 233 MS_BOOL rsten; 234 MS_BOOL dben; 235 } PWM_Arg; 236 237 typedef struct _PWM_DrvStatus 238 { 239 MS_BOOL PWM0; 240 MS_BOOL PWM1; 241 MS_BOOL PWM2; 242 MS_BOOL PWM3; 243 MS_BOOL PWM4; 244 MS_BOOL PWM5; 245 MS_BOOL PWM6; 246 MS_BOOL PWM7; 247 MS_BOOL PWM8; 248 } PWM_DrvStatus; 249 250 typedef struct _PWM_3D_Arg 251 { 252 MS_U32 Shift; 253 MS_U32 Duty; 254 } PWM_3D_Arg; 255 256 typedef enum _N_LR_SYNC_SEL 257 { 258 E_VSYNC = 0, 259 E_LR_RISING = 1, 260 E_LR_FALLING = 2, 261 E_LR_RISING_FALLING = 3 262 } N_LR_SYNC_SEL; 263 264 265 typedef enum _PM_PWM_ChNum 266 { 267 E_PM_PWM_CH0, 268 E_PM_PWM_CH1, 269 E_PM_PWM_CH2, 270 }PM_PWM_ChNum; 271 272 typedef enum _PM_PWM_PAD_CFG 273 { 274 PAD_PM_VID0, 275 PAD_PM_GPIO_1, 276 PAD_PM_VID1, 277 PAD_PM_GPIO_3, 278 PAD_GPIO_2, 279 PAD_GPIO_4, 280 }PM_PWM_PAD_CFG; 281 282 #define NON_INVERSE 0 283 #define INVERSE 1 284 285 //////////////////////////////////////////////////////////////////////////////// 286 // include utopia v2 header files here 287 //////////////////////////////////////////////////////////////////////////////// 288 #include "drvPWM_v2.h" 289 #include "MsDevice.h" 290 //////////////////////////////////////////////////////////////////////////////// 291 // Extern Function 292 //////////////////////////////////////////////////////////////////////////////// 293 //------------------------------------------------------------------------------------------------- 294 /// MOBF Encrypt 295 /// @ingroup G_PWM_ToBeRemove 296 /// @param u32Key \b IN: Key 297 /// @param bEnable \b IN: TRUE/FLASE 298 /// @return DRVAESDMA_OK : Success 299 /// @return Others : Fail 300 //------------------------------------------------------------------------------------------------- 301 #if defined(UFO_PUBLIC_HEADER_500_3) 302 void MDrv_PM_PWM_Enable(PM_PWM_ChNum index, PM_PWM_PAD_CFG Pad_Sel, MS_BOOL b_en); 303 #else 304 void MDrv_PM_PWM_Enable(void); 305 #endif 306 //------------------------------------------------------------------------------------------------- 307 /// MOBF Encrypt 308 /// @ingroup G_PWM_ToBeRemove 309 /// @param u32Key \b IN: Key 310 /// @param bEnable \b IN: TRUE/FLASE 311 /// @return DRVAESDMA_OK : Success 312 /// @return Others : Fail 313 //------------------------------------------------------------------------------------------------- 314 #if defined(UFO_PUBLIC_HEADER_500_3) 315 void MDrv_PM_PWM_Period(PM_PWM_ChNum index,MS_U16 u16PeriodPWM); 316 #else 317 void MDrv_PM_PWM_Period(MS_U16 u16PeriodPWM); 318 #endif 319 //------------------------------------------------------------------------------------------------- 320 /// MOBF Encrypt 321 /// @ingroup G_PWM_ToBeRemove 322 /// @param u32Key \b IN: Key 323 /// @param bEnable \b IN: TRUE/FLASE 324 /// @return DRVAESDMA_OK : Success 325 /// @return Others : Fail 326 //------------------------------------------------------------------------------------------------- 327 #if defined(UFO_PUBLIC_HEADER_500_3) 328 void MDrv_PM_PWM_DutyCycle(PM_PWM_ChNum index,MS_U16 u16DutyPWM); 329 #else 330 void MDrv_PM_PWM_DutyCycle(MS_U16 u16DutyPWM); 331 #endif 332 //------------------------------------------------------------------------------------------------- 333 /// MOBF Encrypt 334 /// @ingroup G_PWM_ToBeRemove 335 /// @param u32Key \b IN: Key 336 /// @param bEnable \b IN: TRUE/FLASE 337 /// @return DRVAESDMA_OK : Success 338 /// @return Others : Fail 339 //------------------------------------------------------------------------------------------------- 340 #if defined(UFO_PUBLIC_HEADER_500_3) 341 void MDrv_PM_PWM_Div(PM_PWM_ChNum index,MS_U8 u8DivPWM); 342 #else 343 void MDrv_PM_PWM_Div(MS_U8 u8DivPWM); 344 #endif 345 //------------------------------------------------------------------------------------------------- 346 /// MOBF Encrypt 347 /// @ingroup G_PWM_ToBeRemove 348 /// @param u32Key \b IN: Key 349 /// @param bEnable \b IN: TRUE/FLASE 350 /// @return DRVAESDMA_OK : Success 351 /// @return Others : Fail 352 //------------------------------------------------------------------------------------------------- 353 #if defined(UFO_PUBLIC_HEADER_500_3) 354 void MDrv_PM_PWM_Polarity(PM_PWM_ChNum index,MS_BOOL bPolPWM); 355 #else 356 void MDrv_PM_PWM_Polarity(MS_BOOL bPolPWM); 357 #endif 358 //------------------------------------------------------------------------------------------------- 359 /// MOBF Encrypt 360 /// @ingroup G_PWM_ToBeRemove 361 /// @param u32Key \b IN: Key 362 /// @param bEnable \b IN: TRUE/FLASE 363 /// @return DRVAESDMA_OK : Success 364 /// @return Others : Fail 365 //------------------------------------------------------------------------------------------------- 366 #if defined(UFO_PUBLIC_HEADER_500_3) 367 void MDrv_PM_PWM_Dben(PM_PWM_ChNum index,MS_BOOL bdbenPWM); 368 #else 369 void MDrv_PM_PWM_Dben(MS_BOOL bDbenPWM); 370 #endif 371 //------------------------------------------------------------------------------------------------- 372 /// MOBF Encrypt 373 /// @ingroup G_PWM_ToBeRemove 374 /// @param u32Key \b IN: Key 375 /// @param bEnable \b IN: TRUE/FLASE 376 /// @return DRVAESDMA_OK : Success 377 /// @return Others : Fail 378 //------------------------------------------------------------------------------------------------- 379 MS_U16 MDrv_PWM_SetPowerState(EN_POWER_MODE u16PowerState); 380 381 //------------------------------------------------------------------------------ 382 /// Description : Show the PWM driver version 383 /// @ingroup G_PWM_COMMON 384 /// @param ppVersion \b OUT: output PWM driver version 385 /// @return E_PWM_OK : succeed 386 /// @return E_PWM_FAIL : fail before timeout or illegal parameters 387 //------------------------------------------------------------------------------ 388 PWM_Result MDrv_PWM_GetLibVer(const MSIF_Version **ppVersion); 389 390 //------------------------------------------------------------------------------ 391 /// Description : Show the PWM_PAD is PWM(True) or GPIO(false) 392 /// @ingroup G_PWM_COMMON 393 /// @param pStatus \b OUT: output PWM driver status 394 /// @return E_PWM_OK : succeed 395 /// @return E_PWM_FAIL : fail before timeout or illegal parameters 396 //------------------------------------------------------------------------------ 397 PWM_Result MDrv_PWM_GetStatus(PWM_DrvStatus *pStatus); 398 399 //------------------------------------------------------------------------------------------------- 400 /// Description: Initial PWM driver 401 /// @ingroup G_PWM_INIT 402 /// @param eLevel \b debug level for PWM driver 403 /// @return E_PWM_OK : succeed 404 /// @return E_PWM_FAIL : fail before timeout or illegal parameters 405 //------------------------------------------------------------------------------------------------- 406 PWM_Result MDrv_PWM_Init(PWM_DbgLv eLevel); 407 //------------------------------------------------------------------------------------------------- 408 /// Description: IOutput enable_bar of PWM pads 409 /// @ingroup G_PWM_CONTROL 410 /// @param u8IndexPWM \b which pwm is setting 411 /// @param bOenPWM \b True/False for enable/disable 412 /// @return E_PWM_OK : succeed 413 /// @return E_PWM_FAIL : fail before timeout or illegal parameters 414 //------------------------------------------------------------------------------------------------- 415 PWM_Result MDrv_PWM_Oen(PWM_ChNum u8IndexPWM, MS_BOOL bOenPWM); 416 //------------------------------------------------------------------------------------------------- 417 /// Description: Set the period of the specific pwm 418 /// @ingroup G_PWM_ToBeRemove 419 /// @param u8IndexPWM \b which pwm is setting 420 /// @param u16PeriodPWM \b the 18-bit period value 421 /// @return E_PWM_OK : succeed 422 /// @return E_PWM_FAIL : fail before timeout or illegal parameters 423 //------------------------------------------------------------------------------------------------- 424 PWM_Result MDrv_PWM_Period(PWM_ChNum u8IndexPWM, MS_U32 u32PeriodPWM); 425 //------------------------------------------------------------------------------------------------- 426 /// Description: Set the period of the specific pwm 427 /// @ingroup G_PWM_CONTROL 428 /// @param u8IndexPWM \b which pwm is setting 429 /// @return u16PeriodPWM 430 //------------------------------------------------------------------------------------------------- 431 PWM_Result MDrv_PWM_GetProperty(PWM_Property eProperty, PWM_ChNum u8IndexPWM, MS_U32 *u32PWMVar); 432 //------------------------------------------------------------------------------------------------- 433 /// Description: Set the Duty of the specific pwm 434 /// @ingroup G_PWM_ToBeRemove 435 /// @param u8IndexPWM \b which pwm is setting 436 /// @param u16DutyPWM \b the 18-bit Duty value 437 /// @return E_PWM_OK : succeed 438 /// @return E_PWM_FAIL : fail before timeout or illegal parameters 439 //------------------------------------------------------------------------------------------------- 440 PWM_Result MDrv_PWM_DutyCycle(PWM_ChNum u8IndexPWM, MS_U32 u32DutyPWM); 441 //------------------------------------------------------------------------------------------------- 442 /// Description: Set the Unit_Div of the pwm 443 /// @ingroup G_PWM_ToBeRemove 444 /// @param u16UnitDivPWM \b the Unit Div value 445 /// @return E_PWM_OK : succeed 446 /// @return E_PWM_FAIL : fail before timeout or illegal parameters 447 //------------------------------------------------------------------------------------------------- 448 PWM_Result MDrv_PWM_UnitDiv(MS_U16 u16UnitDivPWM); 449 //------------------------------------------------------------------------------------------------- 450 /// Description: Set the Div of the specific pwm 451 /// @ingroup G_PWM_ToBeRemove 452 /// @param u8IndexPWM \b which pwm is setting 453 /// @param u16DivPWM \b the 16-bit div value 454 //------------------------------------------------------------------------------------------------- 455 void MDrv_PWM_Div(PWM_ChNum u8IndexPWM, MS_U16 u16DivPWM); 456 //------------------------------------------------------------------------------------------------- 457 /// Description: Set the Polarity of the specific pwm 458 /// @param u8IndexPWM \b which pwm is setting 459 /// @param bPolPWM \b True/False for Inverse/Non-inverse 460 //------------------------------------------------------------------------------------------------- 461 void MDrv_PWM_Polarity(PWM_ChNum u8IndexPWM, MS_BOOL bPolPWM); 462 //------------------------------------------------------------------------------------------------- 463 /// Description: Set the Vsync Double buffer of the specific pwm 464 /// @ingroup G_PWM_ToBeRemove 465 /// @param u8IndexPWM \b which pwm is setting 466 /// @param bVdbenPWM \b True/False for Enable/Disable 467 //------------------------------------------------------------------------------------------------- 468 void MDrv_PWM_Vdben(PWM_ChNum u8IndexPWM, MS_BOOL bVdbenPWM); 469 //------------------------------------------------------------------------------------------------- 470 /// Description: Set the Hsync reset of the specific pwm 471 /// @param u8IndexPWM \b which pwm is setting 472 /// @param bRstPWM \b True/False for Enable/Disable 473 //------------------------------------------------------------------------------------------------- 474 void MDrv_PWM_ResetEn(PWM_ChNum u8IndexPWM, MS_BOOL bRstPWM); 475 //------------------------------------------------------------------------------------------------- 476 /// Description: Set the Double buffer of the specific pwm 477 /// @ingroup G_PWM_ToBeRemove 478 /// @param u8IndexPWM \b which pwm is setting 479 /// @param bDbenPWM \b True/False for Enable/Disable 480 //------------------------------------------------------------------------------------------------- 481 void MDrv_PWM_Dben(PWM_ChNum u8IndexPWM, MS_BOOL bDbenPWM); 482 //------------------------------------------------------------------------------------------------- 483 /// Description: IMPULSE ENABLE 484 /// @ingroup G_PWM_CONTROL 485 /// @param u8IndexPWM \b which pwm is setting 486 /// @param bOenPWM \b True/False for enable/disable 487 /// @return E_PWM_OK : succeed 488 /// @return E_PWM_FAIL : fail before timeout or illegal parameters 489 //------------------------------------------------------------------------------------------------- 490 void MDrv_PWM_IMPULSE_EN(PWM_ChNum index, MS_BOOL bdbenPWM); 491 //------------------------------------------------------------------------------------------------- 492 /// Description: ODDEVEN_SYNC setting 493 /// @ingroup G_PWM_CONTROL 494 /// @param u8IndexPWM \b which pwm is setting 495 /// @param bOenPWM \b True/False for enable/disable 496 /// @return E_PWM_OK : succeed 497 /// @return E_PWM_FAIL : fail before timeout or illegal parameters 498 //------------------------------------------------------------------------------------------------- 499 void MDrv_PWM_ODDEVEN_SYNC(PWM_ChNum index, MS_BOOL bdbenPWM); 500 //------------------------------------------------------------------------------------------------- 501 /// Description: Set the Rst Mux of the specific pwm 502 /// @ingroup G_PWM_CONTROL 503 /// @param u8IndexPWM \b which pwm is setting 504 /// @param bMuxPWM \b True/False for Enable/Disable 505 //------------------------------------------------------------------------------------------------- 506 void MDrv_PWM_RstMux(PWM_ChNum u8IndexPWM, MS_BOOL bMuxPWM); 507 //------------------------------------------------------------------------------------------------- 508 /// Description: Set the Rst_Cnt of the specific pwm 509 /// @ingroup G_PWM_CONTROL 510 /// @param u8IndexPWM \b which pwm is setting 511 /// @param u8RstCntPWM \b the Rst_Cnt value 512 //------------------------------------------------------------------------------------------------- 513 void MDrv_PWM_RstCnt(PWM_ChNum u8IndexPWM, MS_U8 u8RstCntPWM); 514 //------------------------------------------------------------------------------------------------- 515 /// Description: Set the Bypass Unit of the specific pwm 516 /// @ingroup G_PWM_CONTROL 517 /// @param u8IndexPWM \b which pwm is setting 518 /// @param bBypassPWM \b True/False for Enable/Disable 519 //------------------------------------------------------------------------------------------------- 520 void MDrv_PWM_BypassUnit(PWM_ChNum u8IndexPWM, MS_BOOL bBypassPWM); 521 //------------------------------------------------------------------------------------------------- 522 /// Description: Counter mode for PWM0 and PWM1 523 /// @ingroup G_PWM_CONTROL 524 /// @param u8CntModePWM \b Cnt Mode 525 /// @return E_PWM_OK : succeed 526 /// @return E_PWM_FAIL : fail before timeout or illegal parameters 527 /// @note \n 528 /// 11: PWM1 donate internal divider to PWM0 \n 529 /// 10: PWM0 donate internal divider to PWM1 \n 530 /// 0x: Normal mode \n 531 //------------------------------------------------------------------------------------------------- 532 PWM_Result MDrv_PWM01_CntMode(PWM_CntMode u8CntModePWM); 533 //------------------------------------------------------------------------------------------------- 534 /// Description: Counter mode for PWM2 and PWM3 535 /// @ingroup G_PWM_ToBeRemove 536 /// @param u8CntModePWM \b Cnt Mode 537 /// @return E_PWM_OK : succeed 538 /// @return E_PWM_FAIL : fail before timeout or illegal parameters 539 /// @note \n 540 /// 11: PWM3 donate internal divider to PWM2 \n 541 /// 10: PWM2 donate internal divider to PWM3 \n 542 /// 0x: Normal mode \n 543 //------------------------------------------------------------------------------------------------- 544 PWM_Result MDrv_PWM23_CntMode(PWM_CntMode u8CntModePWM); 545 //------------------------------------------------------------------------------------------------- 546 /// Description: Counter mode for PWM6 and PWM7 547 /// @ingroup G_PWM_ToBeRemove 548 /// @param u8CntModePWM \b Cnt Mode 549 /// @return E_PWM_OK : succeed 550 /// @return E_PWM_FAIL : fail before timeout or illegal parameters 551 /// @note \n 552 /// 11: PWM7 donate internal divider to PWM6 \n 553 /// 10: PWM6 donate internal divider to PWM7 \n 554 /// 0x: Normal mode \n 555 //------------------------------------------------------------------------------------------------- 556 PWM_Result MDrv_PWM67_CntMode(PWM_CntMode u8CntModePWM); 557 //------------------------------------------------------------------------------------------------- 558 /// Description: Set the Shift of the specific pwm 559 /// @ingroup G_PWM_ToBeRemove 560 /// @param u8IndexPWM \b which pwm is setting 561 /// @param u16DutyPWM \b the 18-bit Shift value 562 /// @return E_PWM_OK : succeed 563 /// @return E_PWM_FAIL : fail before timeout or illegal parameters 564 //------------------------------------------------------------------------------------------------- 565 PWM_Result MDrv_PWM_Shift(PWM_ChNum u8IndexPWM, MS_U32 u32DutyPWM); 566 //------------------------------------------------------------------------------------------------- 567 /// MOBF Encrypt 568 /// @ingroup G_PWM_CONTROL 569 /// @param u32Key \b IN: Key 570 /// @param bEnable \b IN: TRUE/FLASE 571 /// @return DRVAESDMA_OK : Success 572 /// @return Others : Fail 573 //------------------------------------------------------------------------------------------------- 574 void MDrv_PWM_Nvsync(PWM_ChNum u8IndexPWM, MS_BOOL bNvsPWM); 575 //------------------------------------------------------------------------------------------------- 576 /// MOBF Encrypt 577 /// @ingroup G_PWM_CONTROL 578 /// @param u32Key \b IN: Key 579 /// @param bEnable \b IN: TRUE/FLASE 580 /// @return DRVAESDMA_OK : Success 581 /// @return Others : Fail 582 //------------------------------------------------------------------------------------------------- 583 void MDrv_PWM_Align(PWM_ChNum u8IndexPWM, MS_BOOL bAliPWM); 584 //------------------------------------------------------------------------------------------------- 585 /// MOBF Encrypt 586 /// @ingroup G_PWM_CONTROL 587 /// @param u32Key \b IN: Key 588 /// @param bEnable \b IN: TRUE/FLASE 589 /// @return DRVAESDMA_OK : Success 590 /// @return Others : Fail 591 //------------------------------------------------------------------------------------------------- 592 MS_BOOL MDrv_PWM_Set3DMode(PWM_ChNum u8IndexPWM, PWM_3D_Arg *pArraySeting, MS_U8 u8ArraySize); 593 594 //------------------------------------------------------------------------------------------------- 595 /// Description: Set debug level for debug message 596 /// @param eLevel \b debug level for PWM driver 597 /// @return E_PWM_OK : succeed 598 /// @return E_PWM_FAIL : fail before timeout or illegal parameters 599 //------------------------------------------------------------------------------------------------- 600 PWM_Result MDrv_PWM_SetDbgLevel(PWM_DbgLv eLevel); 601 //------------------------------------------------------------------------------------------------- 602 /// MOBF Encrypt 603 /// @ingroup G_PWM_COMMON 604 /// @param u32Key \b IN: Key 605 /// @param bEnable \b IN: TRUE/FLASE 606 /// @return DRVAESDMA_OK : Success 607 /// @return Others : Fail 608 //------------------------------------------------------------------------------------------------- 609 PWM_Result MDrv_PWM_INV_3D_Flag(MS_BOOL bInvPWM); 610 611 void MDrv_PWM_3D_LR_Sync(PWM_ChNum u8IndexPWM, MS_BOOL bNvsPWM, N_LR_SYNC_SEL LrSyncSel, MS_U8 u8RstCnt); 612 613 #ifdef __cplusplus 614 } 615 #endif 616 617 #endif // _DRV_TEMP_H_ 618 619