_csl_pscpdstatecfg.c

来自「TI达芬奇dm644x各硬件模块测试代码」· C语言 代码 · 共 53 行

C
53
字号
#include <csl_pscAux.h>

#pragma CODE_SECTION (CSL_pscPdStateCfg, ".text:csl_section:psc");

CSL_Status  CSL_pscPdStateCfg(
    CSL_PscHandle     hPsc,
    CSL_PscPdCfg      pdCfg    
	){

  CSL_Status status = CSL_SOK;
  Uint16 i;


  /* If numPds is zero, configure no Power Domains and return CSL_SOK */
  if( pdCfg.numPds == 0 ){
    return (CSL_SOK);
  }

  /* If the number of Power Domains parameter is greater than CSL_PSC_NUM_PD then return error code */
  if( pdCfg.numPds > CSL_PSC_NUM_PD ){
    return (CSL_ESYS_INVPARAMS);
  }

  /* Update the Power Domain states */
  for( i = 0; i < pdCfg.numPds; i++ ){
    
    if( pdCfg.pdId[i] == CSL_PSC_PD_ALWAYSON ){
      /* Check if software is attempting to turn-off the ALWAYSON Domain */
      if( pdCfg.pdState[i] == CSL_PSC_PD_STATE_OFF ){
        return CSL_ESYS_INVPARAMS; /* You cannot turn-off the ALWAYSON Power Domain */
      }
    }


    /* Update the DSP Power Domain state */      
    if( pdCfg.pdId[i] == CSL_PSC_PD_DSP ){
          status = CSL_pscPdDspPwrOnOff(hPsc, pdCfg.pdState[i] );
    }
  
    /* Update the PD state record array if not NULL */
    if( pdCfg.pdStateRecord != NULL ){ 
      pdCfg.pdStateRecord[pdCfg.pdId[i]] = pdCfg.pdState[i];
    }
    


  }


  return (status);
}

⌨️ 快捷键说明

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