5 #define SD_MMC_SPI_MEM 1
\r
7 #include "ff_headers.h"
\r
10 #include "secCache.h"
\r
12 #include "ff_flush.h"
\r
14 extern BaseType_t FF_SemaphoreTaken( void *pxSemaphore );
\r
16 FF_Error_t FF_FlushWrites( FF_IOManager_t *pxIOManager, BaseType_t xForced )
\r
18 FF_Error_t xRetValue;
\r
20 if( ( pxIOManager == NULL ) || ( cache_dirt_count() == 0 ) )
\r
22 xRetValue = FF_ERR_NONE;
\r
24 else if( ( pxIOManager->ucPreventFlush != pdFALSE ) && ( xForced == pdFALSE ) )
\r
26 xRetValue = FF_ERR_IOMAN_PARTITION_MOUNTED | FF_ERRFLAG;
\r
31 if( xForced != pdFALSE )
\r
33 FF_FlushCache( pxIOManager );
\r
36 // if( FF_TrySemaphore( pxIOManager->pvSemaphore, xForced ? 5000 : 0 ) != pdFALSE )
\r
37 if( ( xForced != pdFALSE ) || ( FF_SemaphoreTaken( pxIOManager->pvSemaphore ) == pdFALSE ) )
\r
39 rc = cache_flush( xForced );
\r
40 // FF_ReleaseSemaphore( pxIOManager->pvSemaphore );
\r
47 FF_Error_t FF_StopFlush( FF_IOManager_t *pxIOManager, BaseType_t xFlag )
\r
49 FF_Error_t xRetValue;
\r
51 if( pxIOManager == NULL )
\r
59 xRetValue = pxIOManager->ucPreventFlush;
\r
60 if( xFlag != FLUSH_ENABLE )
\r
64 else if ( xRetValue > 0 )
\r
68 pxIOManager->ucPreventFlush = xRetValue;
\r