⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csl_pwmaux.h

📁 TI达芬奇dm644x各硬件模块测试代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/*  ============================================================================
 *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005                 
 *                                                                              
 *   Use of this software is controlled by the terms and conditions found in the
 *   license agreement under which this software has been supplied.             
 *   ===========================================================================
 */ 
 
/** @file csl_pwmAux.h
 *
 * @brief  Header file for functional layer of CSL
 *
 *  Path: \\(CSLPATH)\\ipmodules\\pwm\\src
 *
 * Description
 *    - API header file for the pulse width modulation CSL 
 *
 */
 
/* =============================================================================
 *  Revision History
 *  ===============
 *  02-Aug-2004 brn File Created.
 *  11-Oct_2004 brn File updated with the review comments
 * =============================================================================
 */

#ifndef _CSL_PWMAUX_H_
#define _CSL_PWMAUX_H_

#include <csl_pwm.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 *  Status query functions of the pulse width modulation
 */

/** ============================================================================
 *   @n@b CSL_pwmGetOutputStatus
 *
 *   @b Description
 *   @n Gets the output status of pulse width modulation 
 *
 *   @b Arguments
 *   @verbatim
        hPwm            Handle to the pulse width modulation instance
 *   @endverbatim
 *
 *   <b> Return Value </b>  Uint32
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n Returns the output status of pulse width modulation read register
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_PwmHandle     hPwm;
        Uint32            stat;
      
        ...
        stat = CSL_pwmGetOutputStatus (hPwm);
        ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE
Uint32 CSL_pwmGetOutputStatus (
    CSL_PwmHandle          hPwm
)
{
    Uint32   status;
    status = CSL_FEXT (hPwm->regs->CFG, PWM_CFG_CURLEV);
    return status;
}


/** ============================================================================
 *   @n@b CSL_pwmGetOperStatus
 *
 *   @b Description
 *   @n Gets the operation status of pulse width modulation 
 *
 *   @b Arguments
 *   @verbatim
        hPwm            Handle to the pulse width modulation instance
 *   @endverbatim
 *
 *   <b> Return Value </b>  Uint32
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n Returns operatin status of pulse width modulation 
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_PwmHandle     hPwm;
        Uint32            opStatus;
      
        ...
        opStatus = CSL_pwmGetOperStatus (hPwm);
        ...
     @endverbatim
 * ===========================================================================
 */ 
CSL_IDEF_INLINE
Uint32 CSL_pwmGetOperStatus (
    CSL_PwmHandle  hPwm
)   
{   
    Uint32   opStatus;
    opStatus = CSL_FEXT (hPwm->regs->CFG, PWM_CFG_OPST);
    return opStatus;
}


/** ============================================================================
 *   @n@b CSL_pwmGetPid
 *
 *   @b Description
 *   @n Gets the peripheral id of pulse width modulation 
 *
 *   @b Arguments
 *   @verbatim
        hPwm            Handle to the pulse width modulation instance
 *   @endverbatim
 *
 *   <b> Return Value </b>  Uint32
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n Returns PID of pulse width modulation 
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_PwmHandle     hPwm;
        Uint32            pid;     
        ...
        pid = CSL_pwmGetPid (hPwm);
        ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE
Uint32 CSL_pwmGetPid (
    CSL_PwmHandle   hPwm
)   
{   
    Uint32        pid;
    pid = hPwm->regs->PID ;
    return pid;
}


/**
 *  Control command functions of the pulse width modulation
 */

/** ============================================================================
 *   @n@b CSL_pwmStart
 *
 *   @b Description
 *      Starts the pulse width modulation 
 *
 *   @b Arguments
 *   @verbatim
        hPwm            Handle to the pulse width modulation instance
        
     @endverbatim
 *
 *   <b> Return Value </b> 
 *       None 
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  Pulse width modulation will be startrted
 * 
 *   @b Modifies
 *   @n pulse width modulation load register
 *      Pulse width modulation start register
 *   @b Example
 *   @verbatim
        CSL_PwmHandle     hPwm;
        ...
        CSL_pwmStart ( hPwm );
        ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE
void CSL_pwmStart (
    CSL_PwmHandle    hPwm
)   
{   
    CSL_FINST( hPwm->regs->START, PWM_START_START, START);
}


/** ============================================================================
 *   @n@b CSL_pwmSetPeriod
 *
 *   @b Description
 *      Sets the period value of pulse width modulation with the arguement sent
 *
 *   @b Arguments
 *   @verbatim
        hPwm            Handle to the pulse width modulation instance
        Uint32          period
        
     @endverbatim
 *
 *   <b> Return Value </b> 
 *       None 
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  Pulse width modulation period will be set 
 *       
 *       
 *   @b Modifies
 *   @n Pulse width modulation Period register contents with the period 
        parameter passed
 *
 *   @b Example
 *   @verbatim
        CSL_PwmHandle     hPwm;
        Uint32           period;
        ...
        CSL_pwmSetPeriod ( hPwm, period );
        ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE 
void CSL_pwmSetPeriod (
    CSL_PwmHandle    hPwm,
    Uint32           period
)   
{   
    CSL_FINS (hPwm->regs->PER, PWM_PER_PER, period);
}


/** ============================================================================
 *   @n@b CSL_pwmSetPhase1Duration
 *
 *   @b Description
 *      Sets the first-phase duration of pulse width modulation with the 
 *      arguement passed
 *
 *   @b Arguments
 *   @verbatim
        hPwm            Handle to the pulse width modulation instance
        Uint32          phase1Duration
        
     @endverbatim
 *
 *   <b> Return Value </b> 
 *       None 
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  Pulse width modulation phase1duration will be set 
 *       
 *       
 *   @b Modifies
 *   @n Pulse width modulation firt-phase duration contents with the 
        phase1Duration parameter passed
 *
 *   @b Example
 *   @verbatim
        CSL_PwmHandle     hPwm;
        Uint32           phase1Duration;
        ...
        CSL_pwmSetPhase1Duration ( hPwm, phase1duration );
        ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE 
void CSL_pwmSetPhase1Duration (
    CSL_PwmHandle   hPwm,
    Uint32          phase1Duration
)   
{   
    CSL_FINS (hPwm->regs->PH1D, PWM_PH1D_PH1D, phase1Duration);
}


/** ============================================================================
 *   @n@b CSL_pwmDisableMode
 *
 *   @b Description
 *      Disables the mode bit in the configure register of pulse width 
 *      modulation 
 *       
 *   @b Arguments
 *   @verbatim
        hPwm            Handle to the pulse width modulation instance
                

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -