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

📄 csl_pwmhwsetupraw.c

📁 TI达芬奇dm644x各硬件模块测试代码
💻 C
字号:
/*  ============================================================================
 *   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_pwmHwSetupRaw.c                                                 
 *                                                                              
 *                                                                              
 *   @brief  Pulse width modulation CSL implementation on ARM side               
 *
 *  Path: \\(CSLPATH)\\ipmodules\\pwm\\src        
 *                                                                              
 */                                                                             
                                                                            
                                                                                
/* =============================================================================
 *  Revision History                                                            
 *  ===============                                                             
 *  02-09-2004  BRN File Created.                                                
 *  11-Oct_2004 brn File updated with the review comments                                                                           
 * =============================================================================
 */                                                                             
                                                                                
#include <csl_pwm.h>                                                            
                                                                                
/** ============================================================================
 *   @n@b CSL_pwmHwSetupRaw                                                     
 *                                                                              
 *   @b Description                                                             
 *   @n This function initializes the device registers with the register-values 
 *      provided through the config data structure.                                
 *                                                                              
 *   @b Arguments                                                               
 *   @verbatim                                                                  
            hPwm            Handle to the pulse width modulation instance               
                                                                                
            config          Pointer to the config structure containing the      
                            device register values                              
     @endverbatim                                                               
 *                                                                              
 *   <b> Return Value </b>  CSL_Status                                          
 *   @li                    CSL_SOK             - Configuration successful      
 *   @li                    CSL_ESYS_BADHANDLE  - Invalid handle                
 *   @li                    CSL_ESYS_INVPARAMS  - Configuration structure       
 *                                                pointer is not properly       
 *                                                 initialized                  
 *                                                                              
 *   <b> Pre Condition </b>                                                     
 *   @n  None                                                                   
 *                                                                              
 *   <b> Post Condition </b>                                                    
 *   @n  The registers of the specified pulse width modulation instance will be setup   
 *       according to the values passed through the config structure            
 *                                                                              
 *   @b Modifies                                                                
 *   @n Hardware registers of the specified pulse width modulation instance             
 *                                                                              
 *   @b Example                                                                 
 *   @verbatim                                                                  
        CSL_PwmHandle           hPwm;                                           
        CSL_PwmConfig           config = CSL_PWM_CONFIG_DEFAULTS;               
        CSL_Status              status;                                         
                                                                                
        ...                                                                     
                                                                                
        status = CSL_pwmHwSetupRaw (hPwm, &config);                             
                                                                                
        ...                                                                     
                                                                                
     @endverbatim                                                               
 * ===========================================================================  
 */                                                                             
#pragma CODE_SECTION (CSL_pwmHwSetupRaw, ".text:csl_section:pwm");              
CSL_Status  CSL_pwmHwSetupRaw (                                                 
    CSL_PwmHandle        hPwm,                                                  
    CSL_PwmConfig        *config                                                
)                                                                                
{                                                                                
    if (hPwm == NULL)                                                           
        return CSL_ESYS_BADHANDLE;                                              
                                                                                
    if (config == NULL)                                                        
        return CSL_ESYS_INVPARAMS; 
     
    /* Pulse width modulation peripheral control register */  
    hPwm->regs->PCR = config->PCR;
     
    /* Pulse width modulation configuration register */
    hPwm->regs->CFG = config->CFG;
     
    /* Pulse width modulation start register */
    hPwm->regs->START = config->START;
     
    /* Pulse width modulation repeat count register */
    hPwm->regs->RPT = config->RPT;
     
    /* Pulse width modulation period register */
    hPwm->regs->PER = config->PER;
     
    /* Pulse width modulation first-phase duration register */
    hPwm->regs->PH1D = config->PH1D;
                                                                 
    return CSL_SOK;
}

⌨️ 快捷键说明

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