Maybe there's something wrong with my description
flash_drive.c has already exist FLASH_DRV_EEEWrite api. I can use this api to write eeprom, but flash_drive.c not provide a read api, like FLASH_DRV_EEERead api.
I have read AN11983 , on page 15
3.5.2 EEE reads When the EEE is read, the data is supplied by the FlexRAM, so no flash operations are triggered. However, EEE reads are not allowed while a EEE write is in progress. Software must wait for CCIF after a write access before allowing software to continue. This way a special function is needed for EEE writes, but a EEE read does not require any special software. Another advantage to this approach is that no additional delay or flag checking is required if you have multiple EEE read accesses with no EEE write cycles in between. A special case for a EEE read that must be considered is the first access to the EEE after a reset. For the first read of the EEE after reset, the EEERDY bit may need to be tested to make sure that the state machine has completed the initial load of data from the E-flash to the FlexRAM. If the system start-up time is long, this guarantees that the initial data load has time to complete before the first EEE read, then a test of the EEERDY flag before the first read may not be required. However, it is safer to explicitly test the EEERDY bit before the first read access to the EEE. Certain CSEc boot options (for example, MAC boot options) might prevent FCNFG[EEERDY] flag to be set until boot process is finished correctly
I bolded two key considerations
- However, EEE reads are not allowed while a EEE write is in progress
- For the first read of the EEE after reset, the EEERDY bit may need to be tested to make sure that the state machine has completed the initial load of data from the E-flash to the FlexRAM
So I wrote the read function based on these two principles in pseudo code
```c
status_t FLASH_DRV_EEERead(const flash_ssd_config_t * pSSDConfig,
uint32_t dest,
uint32_t size,
const uint8_t * pData)
{
/* Check if EEE is enabled */
if ((FTFx_FCNFG & FTFx_FCNFG_EEERDY_MASK) == FTFx_FCNFG_EEERDY_MASK)
{
/*** Determine if it is writing, if it is writing eeprom, wait for completion*/
while( writing_flag == 1);
/** read operation */
}
else
{
ret = STATUS_UNSUPPORTED;
}
return ret
}
```
Is this correct?