xref: /utopia/UTPA2-700.0.x/projects/tmplib/include/drvPWM.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 //    Software and any modification/derivatives thereof.
18 //    No right, ownership, or interest to MStar Software and any
19 //    modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 //    supplied together with third party`s software and the use of MStar
23 //    Software may require additional licenses from third parties.
24 //    Therefore, you hereby agree it is your sole responsibility to separately
25 //    obtain any and all third party right and license necessary for your use of
26 //    such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 //    MStar`s confidential information and you agree to keep MStar`s
30 //    confidential information in strictest confidence and not disclose to any
31 //    third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 //    kind. Any warranties are hereby expressly disclaimed by MStar, including
35 //    without limitation, any warranties of merchantability, non-infringement of
36 //    intellectual property rights, fitness for a particular purpose, error free
37 //    and in conformity with any international standard.  You agree to waive any
38 //    claim against MStar for any loss, damage, cost or expense that you may
39 //    incur related to your use of MStar Software.
40 //    In no event shall MStar be liable for any direct, indirect, incidental or
41 //    consequential damages, including without limitation, lost of profit or
42 //    revenues, lost or damage of data, and unauthorized system use.
43 //    You agree that this Section 4 shall still apply without being affected
44 //    even if MStar Software has been modified by MStar in accordance with your
45 //    request or instruction for your use, except otherwise agreed by both
46 //    parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 //    services in relation with MStar Software to you for your use of
50 //    MStar Software in conjunction with your or your customer`s product
51 //    ("Services").
52 //    You understand and agree that, except otherwise agreed by both parties in
53 //    writing, Services are provided on an "AS IS" basis and the warranty
54 //    disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 //    or otherwise:
58 //    (a) conferring any license or right to use MStar name, trademark, service
59 //        mark, symbol or any other identification;
60 //    (b) obligating MStar or any of its affiliates to furnish any person,
61 //        including without limitation, you and your customers, any assistance
62 //        of any kind whatsoever, or any information; or
63 //    (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 //    of Taiwan, R.O.C., excluding its conflict of law rules.
67 //    Any and all dispute arising out hereof or related hereto shall be finally
68 //    settled by arbitration referred to the Chinese Arbitration Association,
69 //    Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 //    Rules of the Association by three (3) arbitrators appointed in accordance
71 //    with the said Rules.
72 //    The place of arbitration shall be in Taipei, Taiwan and the language shall
73 //    be English.
74 //    The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 ////////////////////////////////////////////////////////////////////////////////
79 //
80 // 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 ////////////////////////////////////////////////////////////////////////////////
145 // Define & data type
146 ////////////////////////////////////////////////////////////////////////////////
147 #define MSIF_PWM_LIB_CODE                     {'P','W','M','_'}    //Lib code
148 #define MSIF_PWM_LIBVER                       {'0','1'}            //LIB version
149 #define MSIF_PWM_BUILDNUM                     {'0','6'}            //Build Number
150 #define MSIF_PWM_CHANGELIST                   {'0','0','3','4','3','8','2','1'} //P4 ChangeList Number
151 #define MSIF_PWM_OS                           '0'                  //OS
152 
153 #define          PWM_DRV_VERSION                  /* Character String for DRV/API version             */  \
154             MSIF_TAG,                         /* 'MSIF'                                           */  \
155             MSIF_CLASS,                       /* '00'                                             */  \
156             MSIF_CUS,                         /* 0x0000                                           */  \
157             MSIF_MOD,                         /* 0x0000                                           */  \
158             MSIF_CHIP,                                                                              \
159             MSIF_CPU,                                                                               \
160             MSIF_PWM_LIB_CODE,                    /* IP__                                             */  \
161             MSIF_PWM_LIBVER,                      /* 0.0 ~ Z.Z                                        */  \
162             MSIF_PWM_BUILDNUM,                    /* 00 ~ 99                                          */  \
163             MSIF_PWM_CHANGELIST,                  /* CL#                                              */  \
164             MSIF_OS
165 
166 #define PWM_DIV (4)
167 
168 typedef enum _PWM_DbgLv
169 {
170     E_PWM_DBGLV_NONE,          // no debug message
171     E_PWM_DBGLV_ERR_ONLY,      // show error only
172     E_PWM_DBGLV_INFO,          // show error & informaiton
173     E_PWM_DBGLV_ALL            // show error, information & funciton name
174 }PWM_DbgLv;
175 
176 typedef enum _PWM_ChNum
177 {
178     E_PWM_CH0,
179     E_PWM_CH1,
180     E_PWM_CH2,
181     E_PWM_CH3,
182     E_PWM_CH4,
183     E_PWM_CH5,
184     E_PWM_CH6,
185     E_PWM_CH7,
186     E_PWM_CH8,
187     E_PWM_CH9
188 }PWM_ChNum;
189 
190 typedef enum _PWM_Property
191 {
192     E_PWM_GetPeriod,
193     E_PWM_GetDutyCycle
194 }PWM_Property;
195 
196 typedef enum _PWM_CntMode
197 {
198     E_PWM_Normal = 0x00,
199     E_PWM_01Mode = 0x10,
200     E_PWM_10Mode = 0x11
201 }PWM_CntMode;
202 
203 typedef enum _PWM_Result
204 {
205     E_PWM_OK,
206     E_PWM_FAIL
207 } PWM_Result;
208 
209 typedef struct _PWM_Info
210 {
211     MS_U8   u8ChNum;           // number of this channel
212     MS_U32  u32IOMap;          // base of this channel's registers
213     MS_U32  mck;               // base clock rate from mcu
214 }PWM_Info;
215 
216 /* This structure is full the same with hal for now. */
217 typedef struct _PWM_Arg
218 {
219     MS_U16  index;
220     MS_U8   div;
221     MS_U16  period;
222     MS_U16  duty;
223     MS_BOOL polarity;
224     MS_BOOL vdben;
225     MS_BOOL rsten;
226     MS_BOOL dben;
227 } PWM_Arg;
228 
229 typedef struct _PWM_DrvStatus
230 {
231     MS_BOOL PWM0;
232     MS_BOOL PWM1;
233     MS_BOOL PWM2;
234     MS_BOOL PWM3;
235     MS_BOOL PWM4;
236     MS_BOOL PWM5;
237     MS_BOOL PWM6;
238     MS_BOOL PWM7;
239     MS_BOOL PWM8;
240 } PWM_DrvStatus;
241 
242 typedef struct _PWM_3D_Arg
243 {
244     MS_U32 Shift;
245     MS_U32 Duty;
246 } PWM_3D_Arg;
247 
248 typedef enum _N_LR_SYNC_SEL
249 {
250     E_VSYNC             = 0,
251     E_LR_RISING         = 1,
252     E_LR_FALLING        = 2,
253     E_LR_RISING_FALLING = 3
254 } N_LR_SYNC_SEL;
255 
256 #define NON_INVERSE     0
257 #define INVERSE         1
258 
259 ////////////////////////////////////////////////////////////////////////////////
260 // include utopia v2  header files here
261 ////////////////////////////////////////////////////////////////////////////////
262 #include "drvPWM_v2.h"
263 #include "MsDevice.h"
264 ////////////////////////////////////////////////////////////////////////////////
265 // Extern Function
266 ////////////////////////////////////////////////////////////////////////////////
267 //-------------------------------------------------------------------------------------------------
268 /// MOBF Encrypt
269 /// @ingroup G_PWM_ToBeRemove
270 /// @param u32Key \b IN: Key
271 /// @param bEnable \b IN: TRUE/FLASE
272 /// @return DRVAESDMA_OK : Success
273 /// @return Others : Fail
274 //-------------------------------------------------------------------------------------------------
275 // void MDrv_PM_PWM_Enable(void);
276 //-------------------------------------------------------------------------------------------------
277 /// MOBF Encrypt
278 /// @ingroup G_PWM_ToBeRemove
279 /// @param u32Key \b IN: Key
280 /// @param bEnable \b IN: TRUE/FLASE
281 /// @return DRVAESDMA_OK : Success
282 /// @return Others : Fail
283 //-------------------------------------------------------------------------------------------------
284 void MDrv_PM_PWM_Period(MS_U16 u16PeriodPWM);
285 //-------------------------------------------------------------------------------------------------
286 /// MOBF Encrypt
287 /// @ingroup G_PWM_ToBeRemove
288 /// @param u32Key \b IN: Key
289 /// @param bEnable \b IN: TRUE/FLASE
290 /// @return DRVAESDMA_OK : Success
291 /// @return Others : Fail
292 //-------------------------------------------------------------------------------------------------
293 void MDrv_PM_PWM_DutyCycle(MS_U16 u16DutyPWM);
294 //-------------------------------------------------------------------------------------------------
295 /// MOBF Encrypt
296 /// @ingroup G_PWM_ToBeRemove
297 /// @param u32Key \b IN: Key
298 /// @param bEnable \b IN: TRUE/FLASE
299 /// @return DRVAESDMA_OK : Success
300 /// @return Others : Fail
301 //-------------------------------------------------------------------------------------------------
302 void MDrv_PM_PWM_Div(MS_U8 u8DivPWM);
303 //-------------------------------------------------------------------------------------------------
304 /// MOBF Encrypt
305 /// @ingroup G_PWM_ToBeRemove
306 /// @param u32Key \b IN: Key
307 /// @param bEnable \b IN: TRUE/FLASE
308 /// @return DRVAESDMA_OK : Success
309 /// @return Others : Fail
310 //-------------------------------------------------------------------------------------------------
311 // void MDrv_PM_PWM_Polarity(MS_BOOL bPolPWM);
312 //-------------------------------------------------------------------------------------------------
313 /// MOBF Encrypt
314 /// @ingroup G_PWM_ToBeRemove
315 /// @param u32Key \b IN: Key
316 /// @param bEnable \b IN: TRUE/FLASE
317 /// @return DRVAESDMA_OK : Success
318 /// @return Others : Fail
319 //-------------------------------------------------------------------------------------------------
320 // void MDrv_PM_PWM_Dben(MS_BOOL bDbenPWM);
321 //-------------------------------------------------------------------------------------------------
322 /// MOBF Encrypt
323 /// @ingroup G_PWM_ToBeRemove
324 /// @param u32Key \b IN: Key
325 /// @param bEnable \b IN: TRUE/FLASE
326 /// @return DRVAESDMA_OK : Success
327 /// @return Others : Fail
328 //-------------------------------------------------------------------------------------------------
329 MS_U16 MDrv_PWM_SetPowerState(EN_POWER_MODE u16PowerState);
330 
331 //------------------------------------------------------------------------------
332 /// Description : Show the PWM driver version
333 /// @ingroup G_PWM_COMMON
334 /// @param  ppVersion \b OUT: output PWM driver version
335 /// @return E_PWM_OK : succeed
336 /// @return E_PWM_FAIL : fail before timeout or illegal parameters
337 //------------------------------------------------------------------------------
338 // PWM_Result MDrv_PWM_GetLibVer(const MSIF_Version **ppVersion);
339 
340 //------------------------------------------------------------------------------
341 /// Description : Show the PWM_PAD is PWM(True) or GPIO(false)
342 /// @ingroup G_PWM_COMMON
343 /// @param  pStatus \b OUT: output PWM driver status
344 /// @return E_PWM_OK : succeed
345 /// @return E_PWM_FAIL : fail before timeout or illegal parameters
346 //------------------------------------------------------------------------------
347 PWM_Result MDrv_PWM_GetStatus(PWM_DrvStatus *pStatus);
348 
349 //-------------------------------------------------------------------------------------------------
350 /// Description: Initial PWM driver
351 /// @ingroup G_PWM_INIT
352 /// @param eLevel    \b debug level for PWM driver
353 /// @return E_PWM_OK : succeed
354 /// @return E_PWM_FAIL : fail before timeout or illegal parameters
355 //-------------------------------------------------------------------------------------------------
356 PWM_Result MDrv_PWM_Init(PWM_DbgLv eLevel);
357 //-------------------------------------------------------------------------------------------------
358 /// Description: IOutput enable_bar of PWM pads
359 /// @ingroup G_PWM_CONTROL
360 /// @param u8IndexPWM    \b which pwm is setting
361 /// @param bOenPWM    \b True/False for enable/disable
362 /// @return E_PWM_OK : succeed
363 /// @return E_PWM_FAIL : fail before timeout or illegal parameters
364 //-------------------------------------------------------------------------------------------------
365 PWM_Result MDrv_PWM_Oen(PWM_ChNum u8IndexPWM, MS_BOOL bOenPWM);
366 //-------------------------------------------------------------------------------------------------
367 /// Description: Set the period of the specific pwm
368 /// @ingroup G_PWM_ToBeRemove
369 /// @param u8IndexPWM    \b which pwm is setting
370 /// @param u16PeriodPWM    \b the 18-bit period value
371 /// @return E_PWM_OK : succeed
372 /// @return E_PWM_FAIL : fail before timeout or illegal parameters
373 //-------------------------------------------------------------------------------------------------
374 PWM_Result MDrv_PWM_Period(PWM_ChNum u8IndexPWM, MS_U32 u32PeriodPWM);
375 //-------------------------------------------------------------------------------------------------
376 /// Description: Set the period of the specific pwm
377 /// @ingroup G_PWM_CONTROL
378 /// @param u8IndexPWM    \b which pwm is setting
379 /// @return u16PeriodPWM
380 //-------------------------------------------------------------------------------------------------
381 PWM_Result MDrv_PWM_GetProperty(PWM_Property eProperty, PWM_ChNum u8IndexPWM, MS_U32 *u32PWMVar);
382 //-------------------------------------------------------------------------------------------------
383 /// Description: Set the Duty of the specific pwm
384 /// @ingroup G_PWM_ToBeRemove
385 /// @param u8IndexPWM    \b which pwm is setting
386 /// @param u16DutyPWM    \b the 18-bit Duty value
387 /// @return E_PWM_OK : succeed
388 /// @return E_PWM_FAIL : fail before timeout or illegal parameters
389 //-------------------------------------------------------------------------------------------------
390 PWM_Result MDrv_PWM_DutyCycle(PWM_ChNum u8IndexPWM, MS_U32 u32DutyPWM);
391 //-------------------------------------------------------------------------------------------------
392 /// Description: Set the Unit_Div of the pwm
393 /// @ingroup G_PWM_ToBeRemove
394 /// @param u16UnitDivPWM    \b the Unit Div value
395 /// @return E_PWM_OK : succeed
396 /// @return E_PWM_FAIL : fail before timeout or illegal parameters
397 //-------------------------------------------------------------------------------------------------
398 PWM_Result MDrv_PWM_UnitDiv(MS_U16 u16UnitDivPWM);
399 //-------------------------------------------------------------------------------------------------
400 /// Description: Set the Div of the specific pwm
401 /// @ingroup G_PWM_ToBeRemove
402 /// @param u8IndexPWM    \b which pwm is setting
403 /// @param u16DivPWM    \b the 16-bit div value
404 //-------------------------------------------------------------------------------------------------
405 void MDrv_PWM_Div(PWM_ChNum u8IndexPWM, MS_U16 u16DivPWM);
406 //-------------------------------------------------------------------------------------------------
407 /// Description:  Set the Polarity of the specific pwm
408 /// @param u8IndexPWM    \b which pwm is setting
409 /// @param bPolPWM    \b True/False for Inverse/Non-inverse
410 //-------------------------------------------------------------------------------------------------
411 void MDrv_PWM_Polarity(PWM_ChNum u8IndexPWM, MS_BOOL bPolPWM);
412 //-------------------------------------------------------------------------------------------------
413 /// Description: Set the Vsync Double buffer of the specific pwm
414 /// @ingroup G_PWM_ToBeRemove
415 /// @param u8IndexPWM    \b which pwm is setting
416 /// @param bVdbenPWM    \b True/False for Enable/Disable
417 //-------------------------------------------------------------------------------------------------
418 void MDrv_PWM_Vdben(PWM_ChNum u8IndexPWM, MS_BOOL bVdbenPWM);
419 //-------------------------------------------------------------------------------------------------
420 /// Description: Set the Hsync reset of the specific pwm
421 /// @param u8IndexPWM    \b which pwm is setting
422 /// @param bRstPWM    \b True/False for Enable/Disable
423 //-------------------------------------------------------------------------------------------------
424 void MDrv_PWM_ResetEn(PWM_ChNum u8IndexPWM, MS_BOOL bRstPWM);
425 //-------------------------------------------------------------------------------------------------
426 /// Description:  Set the Double buffer of the specific pwm
427 /// @ingroup G_PWM_ToBeRemove
428 /// @param u8IndexPWM    \b which pwm is setting
429 /// @param bDbenPWM    \b True/False for Enable/Disable
430 //-------------------------------------------------------------------------------------------------
431 void MDrv_PWM_Dben(PWM_ChNum u8IndexPWM, MS_BOOL bDbenPWM);
432 //-------------------------------------------------------------------------------------------------
433 /// Description: IMPULSE ENABLE
434 /// @ingroup G_PWM_CONTROL
435 /// @param u8IndexPWM    \b which pwm is setting
436 /// @param bOenPWM    \b True/False for enable/disable
437 /// @return E_PWM_OK : succeed
438 /// @return E_PWM_FAIL : fail before timeout or illegal parameters
439 //-------------------------------------------------------------------------------------------------
440 void MDrv_PWM_IMPULSE_EN(PWM_ChNum index, MS_BOOL bdbenPWM);
441 //-------------------------------------------------------------------------------------------------
442 /// Description: ODDEVEN_SYNC setting
443 /// @ingroup G_PWM_CONTROL
444 /// @param u8IndexPWM    \b which pwm is setting
445 /// @param bOenPWM    \b True/False for enable/disable
446 /// @return E_PWM_OK : succeed
447 /// @return E_PWM_FAIL : fail before timeout or illegal parameters
448 //-------------------------------------------------------------------------------------------------
449 void MDrv_PWM_ODDEVEN_SYNC(PWM_ChNum index, MS_BOOL bdbenPWM);
450 //-------------------------------------------------------------------------------------------------
451 /// Description:  Set the Rst Mux of the specific pwm
452 /// @ingroup G_PWM_CONTROL
453 /// @param u8IndexPWM    \b which pwm is setting
454 /// @param bMuxPWM    \b True/False for Enable/Disable
455 //-------------------------------------------------------------------------------------------------
456 void MDrv_PWM_RstMux(PWM_ChNum u8IndexPWM, MS_BOOL bMuxPWM);
457 //-------------------------------------------------------------------------------------------------
458 /// Description: Set the Rst_Cnt of the specific pwm
459 /// @ingroup G_PWM_CONTROL
460 /// @param u8IndexPWM    \b which pwm is setting
461 /// @param u8RstCntPWM    \b the Rst_Cnt value
462 //-------------------------------------------------------------------------------------------------
463 void MDrv_PWM_RstCnt(PWM_ChNum u8IndexPWM, MS_U8 u8RstCntPWM);
464 //-------------------------------------------------------------------------------------------------
465 /// Description: Set the Bypass Unit of the specific pwm
466 /// @ingroup G_PWM_CONTROL
467 /// @param u8IndexPWM    \b which pwm is setting
468 /// @param bBypassPWM    \b True/False for Enable/Disable
469 //-------------------------------------------------------------------------------------------------
470 // void MDrv_PWM_BypassUnit(PWM_ChNum u8IndexPWM, MS_BOOL bBypassPWM);
471 //-------------------------------------------------------------------------------------------------
472 /// Description: Counter mode for PWM0 and PWM1
473 /// @ingroup G_PWM_CONTROL
474 /// @param u8CntModePWM    \b Cnt Mode
475 /// @return E_PWM_OK : succeed
476 /// @return E_PWM_FAIL : fail before timeout or illegal parameters
477 /// @note    \n
478 ///     11: PWM1 donate internal divider to PWM0    \n
479 ///     10: PWM0 donate internal divider to PWM1    \n
480 ///     0x: Normal mode    \n
481 //-------------------------------------------------------------------------------------------------
482 // PWM_Result MDrv_PWM01_CntMode(PWM_CntMode u8CntModePWM);
483 //-------------------------------------------------------------------------------------------------
484 /// Description: Counter mode for PWM2 and PWM3
485 /// @ingroup G_PWM_ToBeRemove
486 /// @param u8CntModePWM    \b Cnt Mode
487 /// @return E_PWM_OK : succeed
488 /// @return E_PWM_FAIL : fail before timeout or illegal parameters
489 /// @note    \n
490 ///     11: PWM3 donate internal divider to PWM2    \n
491 ///     10: PWM2 donate internal divider to PWM3    \n
492 ///     0x: Normal mode    \n
493 //-------------------------------------------------------------------------------------------------
494 // PWM_Result MDrv_PWM23_CntMode(PWM_CntMode u8CntModePWM);
495 //-------------------------------------------------------------------------------------------------
496 /// Description: Counter mode for PWM6 and PWM7
497 /// @ingroup G_PWM_ToBeRemove
498 /// @param u8CntModePWM    \b Cnt Mode
499 /// @return E_PWM_OK : succeed
500 /// @return E_PWM_FAIL : fail before timeout or illegal parameters
501 /// @note    \n
502 ///     11: PWM7 donate internal divider to PWM6    \n
503 ///     10: PWM6 donate internal divider to PWM7    \n
504 ///     0x: Normal mode    \n
505 //-------------------------------------------------------------------------------------------------
506 // PWM_Result MDrv_PWM67_CntMode(PWM_CntMode u8CntModePWM);
507 //-------------------------------------------------------------------------------------------------
508 /// Description: Set the Shift of the specific pwm
509 /// @ingroup G_PWM_ToBeRemove
510 /// @param u8IndexPWM    \b which pwm is setting
511 /// @param u16DutyPWM    \b the 18-bit Shift value
512 /// @return E_PWM_OK : succeed
513 /// @return E_PWM_FAIL : fail before timeout or illegal parameters
514 //-------------------------------------------------------------------------------------------------
515 PWM_Result MDrv_PWM_Shift(PWM_ChNum u8IndexPWM, MS_U32 u32DutyPWM);
516 //-------------------------------------------------------------------------------------------------
517 /// MOBF Encrypt
518 /// @ingroup G_PWM_CONTROL
519 /// @param u32Key \b IN: Key
520 /// @param bEnable \b IN: TRUE/FLASE
521 /// @return DRVAESDMA_OK : Success
522 /// @return Others : Fail
523 //-------------------------------------------------------------------------------------------------
524 // void MDrv_PWM_Nvsync(PWM_ChNum u8IndexPWM, MS_BOOL bNvsPWM);
525 //-------------------------------------------------------------------------------------------------
526 /// MOBF Encrypt
527 /// @ingroup G_PWM_CONTROL
528 /// @param u32Key \b IN: Key
529 /// @param bEnable \b IN: TRUE/FLASE
530 /// @return DRVAESDMA_OK : Success
531 /// @return Others : Fail
532 //-------------------------------------------------------------------------------------------------
533 // void MDrv_PWM_Align(PWM_ChNum u8IndexPWM, MS_BOOL bAliPWM);
534 //-------------------------------------------------------------------------------------------------
535 /// MOBF Encrypt
536 /// @ingroup G_PWM_CONTROL
537 /// @param u32Key \b IN: Key
538 /// @param bEnable \b IN: TRUE/FLASE
539 /// @return DRVAESDMA_OK : Success
540 /// @return Others : Fail
541 //-------------------------------------------------------------------------------------------------
542 // MS_BOOL MDrv_PWM_Set3DMode(PWM_ChNum u8IndexPWM, PWM_3D_Arg *pArraySeting, MS_U8 u8ArraySize);
543 
544 //-------------------------------------------------------------------------------------------------
545 /// Description: Set debug level for debug message
546 /// @param eLevel    \b debug level for PWM driver
547 /// @return E_PWM_OK : succeed
548 /// @return E_PWM_FAIL : fail before timeout or illegal parameters
549 //-------------------------------------------------------------------------------------------------
550 PWM_Result MDrv_PWM_SetDbgLevel(PWM_DbgLv eLevel);
551 //-------------------------------------------------------------------------------------------------
552 /// MOBF Encrypt
553 /// @ingroup G_PWM_COMMON
554 /// @param u32Key \b IN: Key
555 /// @param bEnable \b IN: TRUE/FLASE
556 /// @return DRVAESDMA_OK : Success
557 /// @return Others : Fail
558 //-------------------------------------------------------------------------------------------------
559 // PWM_Result MDrv_PWM_INV_3D_Flag(MS_BOOL bInvPWM);
560 
561 void MDrv_PWM_3D_LR_Sync(PWM_ChNum u8IndexPWM, MS_BOOL bNvsPWM, N_LR_SYNC_SEL LrSyncSel, MS_U8 u8RstCnt);
562 
563 #ifdef __cplusplus
564 }
565 #endif
566 
567 #endif // _DRV_TEMP_H_
568 
569