fat_fs: Add support for the "win" variable alignment in FATFS struct

This is to support Sypnosys Designware SDMMC controller read and write
operation where the buffer address is needed to be 16bytes and 512bytes
aligned. Adding macro FS_FATFS_WINDOW_ALIGNMENT to align the "win"
variable address in FATFS struct.

Signed-off-by: Boon Khai Ng <boon.khai.ng@intel.com>
This commit is contained in:
Boon Khai Ng 2021-12-10 23:06:24 +08:00 committed by Dominik Ermel
parent 09a9d913c6
commit 9237454a30
2 changed files with 11 additions and 1 deletions

View File

@ -173,7 +173,7 @@ typedef struct {
LBA_t bitbase; /* Allocation bitmap base sector */
#endif
LBA_t winsect; /* Current sector appearing in the win[] */
BYTE win[FF_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */
BYTE win[FF_MAX_SS] __attribute__((aligned(FS_FATFS_WINDOW_ALIGNMENT))); /* Disk access window for Directory, FAT (and file data at tiny cfg) */
} FATFS;

View File

@ -253,6 +253,16 @@
/ disk_ioctl() function. */
#if defined(CONFIG_FS_FATFS_WINDOW_ALIGNMENT)
#define FS_FATFS_WINDOW_ALIGNMENT CONFIG_FS_FATFS_WINDOW_ALIGNMENT
#else
#define FS_FATFS_WINDOW_ALIGNMENT 1
#endif /* defined(CONFIG_FS_FATFS_WINDOW_ALIGNMENT) */
/* This option is to align FATFS->win variable to meet the mmc controller requirement,
* such as designware mmc controller. Aligning the WINDOW variable with 512 will
* drastically increase the size of the FATFS structure*/
/*---------------------------------------------------------------------------/
/ System Configurations