![]() |
xilffs
Vitis Drivers API Documentation
|
This file is the glue layer between file system and driver.
Description related to SD driver:
Process to use file system with SD
Select xilffs in SDK when creating a BSP
In SDK, set "fs_interface" to 1 to select SD interface.
This glue layer can currently be used only with one
SD controller enabled.
In order to use eMMC, in SDK set "Enable MMC" to 1. If not,
SD support is enabled by default.
Description:
This glue layer initializes the host controller and SD card
in disk_initialize. If SD card supports it, 4-bit mode and
high speed mode will be enabled.
The default block size is 512 bytes.
disk_read and disk_write functions are used to read and
write files using ADMA2 in polled mode.
The file system can be used to read from and write to an
SD card that is already formatted as FATFS.
MODIFICATION HISTORY:
Ver Who Date Changes
----- ---- -------- -------------------------------------------------------
1.00a hk 10/17/13 First release
2.0 hk 02/12/14 Corrected status check in disk initialize. CR# 772072.
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.
3.0 sk 12/04/14 Added support for micro SD without
WP/CD. CR# 810655.
Make changes for prototypes of disk_read and
disk_write according to latest version.
12/15/14 Modified the code according to MISRAC 2012 Compliant.
Updated the FatFs to R0.10b
Removed alignment for local buffers as CacheInvalidate
will take care of it.
sg 03/03/15 Added card detection check logic
04/28/15 Card detection only in case of card detection signal
3.1 sk 06/04/15 Added support for SD1.
3.2 sk 11/24/15 Considered the slot type before checking the CD/WP pins.
3.3 sk 04/01/15 Added one second delay for checking CD pin.
3.4 sk 06/09/16 Added support for mkfs.
3.8 mj 07/31/17 Added support for RAM based FATfs.
mn 12/04/17 Resolve errors in XilFFS for ARMCC compiler
3.9 mn 04/18/18 Resolve build warnings for xilffs library
mn 07/06/18 Fix Cppcheck and Doxygen warnings
4.2 mn 08/16/19 Initialize Status variables with failure values
mn 09/25/19 Check if the SD is powered on or not in disk_status()
4.3 mn 02/24/20 Remove unused macro defines
mn 04/08/20 Set IsReady to '0' before calling XSdPs_CfgInitialize
4.5 sk 03/31/21 Maintain discrete global variables for each controller.
4.6 sk 07/20/21 Fixed compilation warning in RAM interface.
4.8 sk 05/05/22 Replace standard lib functions with Xilinx functions.
5.1 ro 06/12/23 Added support for system device-tree flow.
5.2 ap 12/05/23 Add SDT check to fix bug in disk_initialize.
ap 01/11/24 Fix Doxygen warnings.
sk 07/11/24 Add UFS interface support.Macros | |
| #define | XSDPS_NUM_INSTANCES 2 |
| Number of SD instances. More... | |
| #define | XUFSPSXC_START_INDEX 3 |
| Start index of UFS instances. More... | |
Functions | |
| DSTATUS | disk_status (BYTE pdrv) |
| Gets the status of the disk. More... | |
| DSTATUS | disk_initialize (BYTE pdrv) |
| Initializes the drive. More... | |
| DRESULT | disk_read (BYTE pdrv, BYTE *buff, LBA_t sector, UINT count) |
| Reads the drive In case of SD, it reads the SD card using ADMA2 in polled mode. More... | |
| DRESULT | disk_ioctl (BYTE pdrv, BYTE cmd, void *buff) |
| List specific features and do miscellaneous functions on device. More... | |
| DWORD | get_fattime (void) |
| This function is User Provided Timer Function for FatFs module. More... | |
| DRESULT | disk_write (BYTE pdrv, const BYTE *buff, LBA_t sector, UINT count) |
| Reads the drive In case of SD, it reads the SD card using ADMA2 in polled mode. More... | |
| #define XSDPS_NUM_INSTANCES 2 |
Number of SD instances.
Referenced by disk_initialize(), disk_ioctl(), disk_read(), disk_status(), and disk_write().
| #define XUFSPSXC_START_INDEX 3 |
Start index of UFS instances.
Referenced by disk_ioctl(), disk_read(), and disk_write().
| DSTATUS disk_initialize | ( | BYTE | pdrv | ) |
Initializes the drive.
In case of SD, it initializes the host controller and the card. This function also selects additional settings such as bus width, speed and block size.
| pdrv | - Drive number |
References disk_status(), and XSDPS_NUM_INSTANCES.
| DRESULT disk_ioctl | ( | BYTE | pdrv, |
| BYTE | cmd, | ||
| void * | buff | ||
| ) |
List specific features and do miscellaneous functions on device.
In case of SD, it control device specific features and miscellaneous functions other than generic read/write.
| pdrv | - Drive number |
| cmd | - Command code |
| buff | - Pointer to the parameter depends on the command code. |
References disk_status(), XSDPS_NUM_INSTANCES, and XUFSPSXC_START_INDEX.
| DRESULT disk_read | ( | BYTE | pdrv, |
| BYTE * | buff, | ||
| LBA_t | sector, | ||
| UINT | count | ||
| ) |
Reads the drive In case of SD, it reads the SD card using ADMA2 in polled mode.
| pdrv | - Drive number |
| buff | - Pointer to the data buffer to store read data |
| sector | - Start sector number |
| count | - Sector count |
References disk_status(), XSDPS_NUM_INSTANCES, and XUFSPSXC_START_INDEX.
| DSTATUS disk_status | ( | BYTE | pdrv | ) |
Gets the status of the disk.
In case of SD, it checks whether card is present or not.
| pdrv | - Drive number |
References XSDPS_NUM_INSTANCES.
Referenced by disk_initialize(), disk_ioctl(), disk_read(), and disk_write().
| DRESULT disk_write | ( | BYTE | pdrv, |
| const BYTE * | buff, | ||
| LBA_t | sector, | ||
| UINT | count | ||
| ) |
Reads the drive In case of SD, it reads the SD card using ADMA2 in polled mode.
| pdrv | - Drive number |
| buff | - Pointer to the data to be written |
| sector | - Sector address |
| count | - Sector count |
References disk_status(), XSDPS_NUM_INSTANCES, and XUFSPSXC_START_INDEX.
| DWORD get_fattime | ( | void | ) |
This function is User Provided Timer Function for FatFs module.