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

📄 csl_pwrdwnopen.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_pwrdwnOpen.c
 *
 * @brief    File for functional layer of CSL API @a CSL_pwrdwnOpen()
 *
 * PATH \\(CSLPATH)\\ipmodules\\pwrdwn\\src
 *
 * Description
 *    - The @a CSL_pwrdwnOpen() function definition & it's associated functions
 *
 *  Modification 1
 *    - Modified on: 7/16/2004
 *    - Reason: created the sources
 *
 *  @author Ruchika Kharwar.
 * ============================================================================ 
 */

#include <csl_pwrdwn.h>

/** ============================================================================
 *  @b CSL_ pwrdwnOpen
 *  
 *  @b Description
 *  @n This function populates the peripheral data object for the PWRDWN 
 *    instance and returns a handle to the instance.
 *    The open call sets up the data structures for the particular instance
 *    of PWRDWN device. The device can be re-opened anytime after it has been
 *    normally closed if so required. The handle returned by this call is
 *    input as an essential argument for rest of the APIs described
 *    for this module.
 *
 * @b Arguments
 * @verbatim
          pwrdwnObj      Pointer to gptimer object.

          pwrdwnNum      Instance of pwrdwn CSL to be opened.
                         There are three instance of the gptimer
                         available. So, the value for this parameter will be
                         based on the instance.
          pPwrdwnParam   Module specific parameters.
          status         Status of the function call
   @endverbatim
 *
 * <b> Return Value </b>  CSL_pwrdwnHandle
 * @n                     Valid pwrdwn handle will be returned if
 *                        status value is equal to CSL_SOK.
 *
 * <b> Pre Condition </b>
 * @n  CSL_pwrdwnInit(), CSL_pwrdwnOpen()must be opened prior to this call
 *
 * <b> Post Condition </b>
 * @n   1. The status is returned in the status variable. If status
 *         returned is
 * @li     CSL_SOK             Valid pwrdwn handle is returned
 * @li     CSL_ESYS_FAIL       The pwrdwn instance is invalid
 *
 *      2. pwrdwn object structure is populated
 *
 * @b Modifies
 * @n   1. The status variable
 *
 *      2. pwrdwn object structure
 *      
 * @b Example
   @verbatim
       CSL_PwrdwnObj pwrObj;
       CSL_PwrdwnConfig pwrConfig;
       CSL_PwrdwnHandle hPwr;
       // Init Module
       ...
       if (CSL_pwrdwnInit(NULL) != CSL_SOK)
           exit;
       // Opening a handle for the Module	
	   hPwr = CSL_pwrdwnOpen (&pwrObj, CSL_PWRDWN_0, NULL, NULL);
	
	    // Setup the arguments fof the Config structure
    	...
   @endverbatim
 * ============================================================================
 */
#pragma CODE_SECTION (CSL_pwrdwnOpen, ".text:csl_section:pwrdwn");
CSL_PwrdwnHandle CSL_pwrdwnOpen (
	/**  Pointer to the object that holds reference to the instance of PWRDWN
	 *   requested after the call.
	 */    	    
        CSL_PwrdwnObj   *pPwrdwnObj,   
	/** Instance of PWRDWN to which a handle is requested 
	 */ 
        CSL_InstNum     pwrdwnNum,     
	/** Module specific parameters; currently there are no module specific 
	 *  parameters and the user should pass 'NULL'.
	 */   
        CSL_PwrdwnParam *pPwrdwnParam, 
	/** This returns the status (success/error)  of the call. The user may pass 
	 *  'NULL', if status information is not required.
	 */  
        CSL_Status      *pStatus
)
{
    CSL_Status st;
    CSL_PwrdwnHandle hPwrdwn;
    CSL_PwrdwnBaseAddress baseAddress;

    if (CSL_pwrdwnGetBaseAddress(pwrdwnNum, pPwrdwnParam, &baseAddress)
            == CSL_SOK) {
        pPwrdwnObj->pdcRegs = baseAddress.regs;
        pPwrdwnObj->l2pwrdwnRegs = baseAddress.l2pwrdwnRegs;
        pPwrdwnObj->instNum = (CSL_InstNum)pwrdwnNum;
        hPwrdwn = (CSL_PwrdwnHandle)pPwrdwnObj;

        st = CSL_SOK;
    }
    else {
        pPwrdwnObj->pdcRegs = (CSL_PdcRegsOvly)NULL;
        pPwrdwnObj->l2pwrdwnRegs = NULL;
        pPwrdwnObj->instNum = (CSL_InstNum)-1;
        hPwrdwn = (CSL_PwrdwnHandle)NULL;
    
        st = CSL_ESYS_FAIL;
    }

    if (pStatus) {
        *pStatus = st;
    }

    return hPwrdwn;
}

⌨️ 快捷键说明

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