mcu/drv/fsl_flash_driver_c90tfs.c
/*FUNCTION**********************************************************************
 *
 * Function Name : FlashInit
 * Description   : Initializes Flash module by clearing status error bit
 * and reporting the memory configuration via SSD configuration structure.
 *
 * Implements    : FlashInit_Activity
 *END**************************************************************************/
FUNCTION

Function Name : FlashInit
Description   : Initializes Flash module by clearing status error bit
and reporting the memory configuration via SSD configuration structure.

Implements    : FlashInit_Activity
END
FUNCTION Function Name : FlashInit Description : Initializes Flash module by clearing status error bit and reporting the memory configuration via SSD configuration structure . Implements : FlashInit_Activity END
flash_drv_status_t FlashInit(const flash_user_config_t * const pUserConf, \
                             flash_ssd_config_t * const pSSDConfig)
{
#ifdef DEV_ERROR_DETECT
    DEV_ASSERT(pUserConf != NULL);
    DEV_ASSERT(pSSDConfig != NULL);
#endif
    flash_drv_status_t ret = FTFx_OK;
#if FSL_FEATURE_FLS_HAS_FLEX_NVM
    uint8_t  DEPartitionCode;    
#endif
    pSSDConfig->PFlashBase = pUserConf->PFlashBase;
    pSSDConfig->PFlashSize = pUserConf->PFlashSize;
    pSSDConfig->DFlashBase = pUserConf->DFlashBase;
    pSSDConfig->EERAMBase = pUserConf->EERAMBase;
    pSSDConfig->CallBack = pUserConf->CallBack;
#if FSL_FEATURE_FLS_HAS_FLEX_NVM
    DEPartitionCode = (SIM->FCFG1 & SIM_FCFG1_DEPART_MASK) >> SIM_FCFG1_DEPART_SHIFT;
    FlashGetDEPartitionCode(pSSDConfig, DEPartitionCode);
    if (pSSDConfig->DFlashSize < FSL_FEATURE_FLS_DF_BLOCK_SIZE)
    {
        pSSDConfig->EEESize = FSL_FEATURE_FLS_FLEX_RAM_SIZE;
    }
    else
    {
        pSSDConfig->EEESize = 0U;
    }
#else 
    pSSDConfig->DFlashSize = 0U;
    pSSDConfig->EEESize = 0U;
#endif 
    return (ret);
}
flash_drv_status_t FlashInit ( const flash_user_config_t * const pUserConf , flash_ssd_config_t * const pSSDConfig ) { #ifdef DEV_ERROR_DETECT DEV_ASSERT ( pUserConf != NULL ) ; DEV_ASSERT ( pSSDConfig != NULL ) ; #endif flash_drv_status_t ret = FTFx_OK ; #if FSL_FEATURE_FLS_HAS_FLEX_NVM uint8_t DEPartitionCode ; #endif pSSDConfig -> PFlashBase = pUserConf -> PFlashBase ; pSSDConfig -> PFlashSize = pUserConf -> PFlashSize ; pSSDConfig -> DFlashBase = pUserConf -> DFlashBase ; pSSDConfig -> EERAMBase = pUserConf -> EERAMBase ; pSSDConfig -> CallBack = pUserConf -> CallBack ; #if FSL_FEATURE_FLS_HAS_FLEX_NVM DEPartitionCode = ( SIM -> FCFG1 & SIM_FCFG1_DEPART_MASK ) >> SIM_FCFG1_DEPART_SHIFT ; FlashGetDEPartitionCode ( pSSDConfig , DEPartitionCode ) ; if ( pSSDConfig -> DFlashSize < FSL_FEATURE_FLS_DF_BLOCK_SIZE ) { pSSDConfig -> EEESize = FSL_FEATURE_FLS_FLEX_RAM_SIZE ; } else { pSSDConfig -> EEESize = 0U ; } #else pSSDConfig -> DFlashSize = 0U ; pSSDConfig -> EEESize = 0U ; #endif return ( ret ) ; }
FUNCTION
FUNCTION
/* store D/E-Flash Partition Code */ /* Temporary solution for FTFC and S32K144 CSEc part */ /* Get DEPART from Flash Configuration Register 1 */ /* Get data flash size */ /* FSL_FEATURE_FLS_HAS_FLEX_NVM == 0 */ /* If size of D/E-Flash = 0 */ /* End of FSL_FEATURE_FLS_HAS_FLEX_NVM */