Ejemplo n.º 1
0
/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_SetProtectionMode
 * Description   : Config the individual power mode protection setting
 * This function will only configure the power mode protection settings for
 * a specified power mode on the specified chip family. The availabe power modes
 * are defined in smc_power_mode_protection_config_t. Refer to reference manual
 * for details. This register can only write once after power reset.
 * 
 *END**************************************************************************/
void SMC_HAL_SetProtectionMode(uint32_t baseAddr, power_modes_protect_t protect, bool allow)
{
    /* check the setting range */
    assert(protect < kAllowMax);

    /* branch according to mode and write the setting */
    switch (protect)
    {
    case kAllowVlp:
        if (allow) 
        {
            BW_SMC_PMPROT_AVLP(baseAddr, 1);
        }
        else
        {
            BW_SMC_PMPROT_AVLP(baseAddr, 0);
        }
        break;
#if FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE
    case kAllowLls:
        if (allow) 
        {
            BW_SMC_PMPROT_ALLS(baseAddr, 1);
        }
        else
        {
            BW_SMC_PMPROT_ALLS(baseAddr, 0);
        }
        break;
#endif
    case kAllowVlls:
        if (allow) 
        {
            BW_SMC_PMPROT_AVLLS(baseAddr, 1);
        }
        else
        {
            BW_SMC_PMPROT_AVLLS(baseAddr, 0);
        }
        break;
#if FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE
    case kAllowHsrun:
        if (allow) 
        {
            BW_SMC_PMPROT_AHSRUN(baseAddr, 1);
        }
        else
        {
            BW_SMC_PMPROT_AHSRUN(baseAddr, 0);
        }
        break;
#endif
    default:
        break;
    }
}
Ejemplo n.º 2
0
/*FUNCTION**********************************************************************
 *
 * Function Name : smc_hal_set_power_mode_protection
 * Description   : Config the individual power mode protection setting
 * This function will only configure the power mode protection settings for
 * a specified power mode on the specified chip family. The availabe power modes
 * are defined in smc_power_mode_protection_config_t. Refer to reference manual
 * for details. This register can only write once after power reset.
 * 
 *END**************************************************************************/
void smc_hal_set_power_mode_protection(power_modes_protect_t protect, bool allow)
{
    /* check the setting range */
    assert(protect < kAllowMax);

    /* branch according to mode and write the setting */
    switch (protect)
    {
    case kAllowVlp:
        if (allow) 
        {
            BW_SMC_PMPROT_AVLP(1);
        }
        else
        {
            BW_SMC_PMPROT_AVLP(0);
        }
        break;
    case kAllowLls:
        if (allow) 
        {
            BW_SMC_PMPROT_ALLS(1);
        }
        else
        {
            BW_SMC_PMPROT_ALLS(0);
        }
        break;
    case kAllowVlls:
        if (allow) 
        {
            BW_SMC_PMPROT_AVLLS(1);
        }
        else
        {
            BW_SMC_PMPROT_AVLLS(0);
        }
        break;
    default:
        break;
    }
}