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

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

#include <csl_pwrdwn.h>
#include <csl_pwrdwnAux.h>

/** ===========================================================================
 *   @n@b CSL_pwrdwnHwControl
 *
 *   @b Description
 *   @n This function performs various control operations on the PWRDWN instance,
 *      based on the command passed.
 *
 *   @b Arguments
 *   @verbatim
            hPwrdwn Handle to the timer instance

            cmd     Operation to be performed on the PWRDWN

            cmdArg  Arguement specific to the command
     @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK            - Command execution successful.
 *   @li                    CSL_ESYS_BADHANDLE - Invalid handle
 *   @li                    CSL_ESYS_INVCMD    - Invalid command
 *
 *   <b> Pre Condition </b>
 *   CSL_pwrdwnInit(), CSL_pwrdwnOpen() must be opened prior to this call
 *
 *   <b> Post Condition </b>
 *   @n  Registers of the timer instance are configured according to the command
 *       and the command arguments. The command determines which registers are
 *       modified.
 *
 *   @b Modifies
 *   @n Registers determined by the command
 *
 *   @b Example:
     @verbatim
        CSL_PwrdwnObj pwrObj;
        CSL_PwrdwnHwSetup pwrSetup;
        CSL_PwrdwnHandle hPwr;
        CSL_BitMask32 pageSleep;
        // 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 for the Setup structure
        ...
 	
 	    // Setup
 	    CSL_pwrdwnHwSetup(hPwr,&pwrSetup);
    
        // Hw Control
        pageSleep = 0xFFF00F00;
        CSL_pwrdwnHwControl(hPwr,CSL_PWRDWN_CMD_UMAP0_PAGE_SLEEP,&pageSleep);
	
	    // Close handle
        CSL_pwrdwnClose(hPwr);
     @endverbtim
 * ============================================================================
 */
#pragma CODE_SECTION (CSL_pwrdwnHwControl, ".text:csl_section:pwrdwn");
CSL_Status CSL_pwrdwnHwControl (
    /** Pointer to the object that holds reference to the
     *  instance of PWRDWN requested after the call
	 */
    CSL_PwrdwnHandle       hPwrdwn,
    /** The command to this API indicates the action to be taken
	 */
    CSL_PwrdwnHwControlCmd cmd,
    /** An optional argument @a void* casted
	 */
    void                   *arg
)
{
	CSL_Status status = CSL_SOK;
	
	if (hPwrdwn == NULL) {
    	return CSL_ESYS_BADHANDLE;
    }

	switch (cmd) {
	    case CSL_PWRDWN_CMD_UMAP0_PAGE_SLEEP:
		status = CSL_pwrdwnUmap0pageSleep(hPwrdwn,*((CSL_BitMask32*)arg));
		break;

	    case CSL_PWRDWN_CMD_UMAP1_PAGE_SLEEP:
		status = CSL_pwrdwnUmap1pageSleep(hPwrdwn,*((CSL_BitMask32*)arg));
		break;

	    case CSL_PWRDWN_CMD_UMAP0_PAGE_WAKE:
		status = CSL_pwrdwnUmap0pageWake(hPwrdwn,*((CSL_BitMask32*)arg));
		break;

	    case CSL_PWRDWN_CMD_UMAP1_PAGE_WAKE:
		status = CSL_pwrdwnUmap1pageWake(hPwrdwn,*((CSL_BitMask32*)arg));
		break;

	    case CSL_PWRDWN_CMD_UMAP0_AUTOPAGE_ENABLE:
		status = CSL_pwrdwnUmap0pageAutoEnable(hPwrdwn, ((CSL_PwrdwnAutoPage*)\
                             arg)->pageEn,((CSL_PwrdwnAutoPage*)arg)->periodB);
		break;

	    case CSL_PWRDWN_CMD_UMAP1_AUTOPAGE_ENABLE:
		status = CSL_pwrdwnUmap1pageAutoEnable(hPwrdwn,((CSL_PwrdwnAutoPage*)\
                            arg)->pageEn,((CSL_PwrdwnAutoPage*)arg)->periodB);
		break;
        
    	case CSL_PWRDWN_CMD_UMAP0_AUTOPAGE_DISABLE:
		status = CSL_pwrdwnUmap0pageAutoDisable(hPwrdwn,*((CSL_BitMask32*)arg));
		break;

    	case CSL_PWRDWN_CMD_UMAP1_AUTOPAGE_DISABLE:
		status = CSL_pwrdwnUmap1pageAutoDisable(hPwrdwn,*((CSL_BitMask32*)arg));
		break;
	    
        default:
		status = CSL_ESYS_INVCMD ;
		break;
	}
    
  return status;

}

⌨️ 快捷键说明

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