/*FUNCTION********************************************************************** * * Function Name : SMC_HAL_SetProtection * Description : Config all power mode protection settings * This function will configure the power mode protection settings for * supported power mode on the specified chip family. The availabe power modes * are defined in smc_power_mode_protection_config_t. Application should provide * the protect settings for all supported power mode on the chip and aslo this * should be done at early system level init stage. Refer to reference manual * for details. This register can only write once after power reset. So either * use this function or use the individual set function if you only have single * option to set. * *END**************************************************************************/ void SMC_HAL_SetProtection(uint32_t baseAddr, smc_power_mode_protection_config_t *protectConfig) { /* initialize the setting */ uint8_t regValue = 0; /* check configurations for each mode and combine the seting together */ if (protectConfig->vlpProt) { regValue |= BF_SMC_PMPROT_AVLP(1); } #if FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE if (protectConfig->llsProt) { regValue |= BF_SMC_PMPROT_ALLS(1); } #endif if (protectConfig->vllsProt) { regValue |= BF_SMC_PMPROT_AVLLS(1); } #if FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE if (protectConfig->hsrunProt) { regValue |= BF_SMC_PMPROT_AHSRUN(1); } #endif /* write once into pmprot register*/ HW_SMC_PMPROT_SET(baseAddr, regValue); }
/*FUNCTION********************************************************************** * * Function Name : smc_hal_config_power_mode_protection * Description : Config all power mode protection settings * This function will configure the power mode protection settings for * supported power mode on the specified chip family. The availabe power modes * are defined in smc_power_mode_protection_config_t. Application should provide * the protect settings for all supported power mode on the chip and aslo this * should be done at early system level init stage. Refer to reference manual * for details. This register can only write once after power reset. So either * use this function or use the individual set function if you only have single * option to set. * *END**************************************************************************/ void smc_hal_config_power_mode_protection(smc_power_mode_protection_config_t *protectConfig) { /* initialize the setting */ uint8_t regValue = 0; /* check configurations for each mode and combine the seting together */ if (protectConfig->vlpProt) { regValue |= BF_SMC_PMPROT_AVLP(1); } if (protectConfig->llsProt) { regValue |= BF_SMC_PMPROT_ALLS(1); } if (protectConfig->vllsProt) { regValue |= BF_SMC_PMPROT_AVLLS(1); } /* write once into pmprot register*/ HW_SMC_PMPROT_SET(regValue); }