mcu/drv/fsl_flash_driver_c90tfs.c
/*FUNCTION**********************************************************************
 *
 * Function Name : WaitEEWriteToFinish
 * Description   : Write to EEPROM with data was aligned and wait until operation finish.
 *
 * Implements    : WaitEEWriteToFinish_Activity
 *END**************************************************************************/
FUNCTION

Function Name : WaitEEWriteToFinish
Description   : Write to EEPROM with data was aligned and wait until operation finish.

Implements    : WaitEEWriteToFinish_Activity
END
FUNCTION Function Name : WaitEEWriteToFinish Description : Write to EEPROM with data was aligned and wait until operation finish . Implements : WaitEEWriteToFinish_Activity END
static flash_drv_status_t WaitEEWriteToFinish(uint32_t dest, \
                                              const uint8_t* pData, \
                                              uint8_t step)
{
#ifdef DEV_ERROR_DETECT
    DEV_ASSERT(pData != NULL);
#endif
    flash_drv_status_t ret;    
    uint32_t temp;             
    if (0x01U == step)
    {
        *(uint8_t*)dest = *pData;
    }
    if (0x02U == step)
    {
        temp = (uint32_t)(pData[1]) << 8U;
        temp |= (uint32_t)(pData[0]);
        *(volatile uint16_t *)dest = (uint16_t)temp;
    }
    if (0x04U == step)
    {
        temp =  (uint32_t)(pData[3]) << 24U;
        temp |= (uint32_t)(pData[2]) << 16U;
        temp |= (uint32_t)(pData[1]) << 8U;
        temp |= (uint32_t)(pData[0]);
        *(volatile uint32_t *)dest = temp;
    }
    while (0U == (FTFx_FCNFG & FTFx_FCNFG_EEERDY_MASK))
    {
    }
    ret = (flash_drv_status_t)(FTFx_FSTAT & (FTFx_FSTAT_MGSTAT0_MASK | FTFx_FSTAT_FPVIOL_MASK \
                               | FTFx_FSTAT_ACCERR_MASK | FTFx_FSTAT_RDCOLERR_MASK));
    return ret;
}
static flash_drv_status_t WaitEEWriteToFinish ( uint32_t dest , const uint8_t * pData , uint8_t step ) { #ifdef DEV_ERROR_DETECT DEV_ASSERT ( pData != NULL ) ; #endif flash_drv_status_t ret ; uint32_t temp ; if ( 0x01U == step ) { * ( uint8_t * ) dest = * pData ; } if ( 0x02U == step ) { temp = ( uint32_t ) ( pData [ 1 ] ) << 8U ; temp |= ( uint32_t ) ( pData [ 0 ] ) ; * ( volatile uint16_t * ) dest = ( uint16_t ) temp ; } if ( 0x04U == step ) { temp = ( uint32_t ) ( pData [ 3 ] ) << 24U ; temp |= ( uint32_t ) ( pData [ 2 ] ) << 16U ; temp |= ( uint32_t ) ( pData [ 1 ] ) << 8U ; temp |= ( uint32_t ) ( pData [ 0 ] ) ; * ( volatile uint32_t * ) dest = temp ; } while ( 0U == ( FTFx_FCNFG & FTFx_FCNFG_EEERDY_MASK ) ) { } ret = ( flash_drv_status_t ) ( FTFx_FSTAT & ( FTFx_FSTAT_MGSTAT0_MASK | FTFx_FSTAT_FPVIOL_MASK | FTFx_FSTAT_ACCERR_MASK | FTFx_FSTAT_RDCOLERR_MASK ) ) ; return ret ; }
FUNCTION
FUNCTION
/* Return code variable */ /* Temporary variable   */ /* Wait till EEERDY bit is set */ /* Check for protection violation error */