diff --git a/lib/sw_services/xilffs/examples/xilffs_polled_example.c b/lib/sw_services/xilffs/examples/xilffs_polled_example.c index f9bb4b09..2fc8d9ba 100755 --- a/lib/sw_services/xilffs/examples/xilffs_polled_example.c +++ b/lib/sw_services/xilffs/examples/xilffs_polled_example.c @@ -48,6 +48,7 @@ * Ver Who Date Changes * ----- --- -------- ----------------------------------------------- * 1.00a hk 10/17/13 First release +* 2.2 hk 07/28/14 Make changes to enable use of data cache. * * * @@ -76,8 +77,17 @@ static FIL fil; /* File object */ static FATFS fatfs; static char FileName[32] = "Test.bin"; static char *SD_File; + +#ifdef __ICCARM__ +#pragma data_alignment = 32 u8 DestinationAddress[10*1024*1024]; u8 SourceAddress[10*1024*1024]; +#pragma data_alignment = 4 +#else +u8 DestinationAddress[10*1024*1024] __attribute__ ((aligned(32))); +u8 SourceAddress[10*1024*1024] __attribute__ ((aligned(32))); +#endif + #define TEST 7 /*****************************************************************************/ @@ -133,9 +143,6 @@ int FfsSdPolledExample(void) u32 BuffCnt; u32 FileSize = (8*1024*1024); - Xil_DCacheFlush(); - Xil_DCacheDisable(); - for(BuffCnt = 0; BuffCnt < FileSize; BuffCnt++){ SourceAddress[BuffCnt] = TEST + BuffCnt; } diff --git a/lib/sw_services/xilffs/src/diskio.c b/lib/sw_services/xilffs/src/diskio.c index 0a418946..ca13d985 100755 --- a/lib/sw_services/xilffs/src/diskio.c +++ b/lib/sw_services/xilffs/src/diskio.c @@ -64,6 +64,7 @@ * 2.1 hk 04/16/14 Move check for ExtCSD high speed bit set inside if * condition for high speed support. * Include xil_types.h irrespective of xsdps.h. CR# 797086. +* 2.2 hk 07/28/14 Make changes to enable use of data cache. * * * diff --git a/lib/sw_services/xilffs/src/include/ff.h b/lib/sw_services/xilffs/src/include/ff.h index a2cf4907..e67495bd 100755 --- a/lib/sw_services/xilffs/src/include/ff.h +++ b/lib/sw_services/xilffs/src/include/ff.h @@ -297,7 +297,13 @@ typedef struct { DWORD dirbase; /* Root directory start sector (FAT32:Cluster#) */ DWORD database; /* Data start sector */ DWORD winsect; /* Current sector appearing in the win[] */ - BYTE win[_MAX_SS]; /* Disk access window for Directory, FAT (and Data on tiny cfg) */ +#ifdef __ICCARM__ +#pragma data_alignment = 32 + BYTE win[_MAX_SS]; +#pragma data_alignment = 4 +#else + BYTE win[_MAX_SS] __attribute__ ((aligned(32))); /* Disk access window for Directory, FAT (and Data on tiny cfg) */ +#endif } FATFS; @@ -325,7 +331,13 @@ typedef struct { UINT lockid; /* File lock ID (index of file semaphore table) */ #endif #if !_FS_TINY +#ifdef __ICCARM__ +#pragma data_alignment = 32 BYTE buf[_MAX_SS]; /* File data read/write buffer */ +#pragma data_alignment = 4 +#else + BYTE buf[_MAX_SS] __attribute__ ((aligned(32))); /* File data read/write buffer */ +#endif #endif } FIL;