diskio.c File Reference

#include "diskio.h"
#include "xparameters.h"
#include "xil_printf.h"

Functions

DSTATUS disk_status (BYTE drv)
DSTATUS disk_initialize (BYTE drv)
DRESULT disk_read (BYTE drv, BYTE *buff, DWORD sector, BYTE count)
DWORD get_fattime (void)
DRESULT disk_write (BYTE drv, const BYTE *buff, DWORD sector, BYTE count)

Detailed Description

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.

 

Note:

Function Documentation

DSTATUS disk_initialize BYTE  drv  ) 
 

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.

Parameters:
drv - Drive number
Returns:
s - which contains an OR of the following information STA_NODISK Disk is not present STA_NOINIT Drive not initialized STA_PROTECT Drive is write protected 0 or only STA_PROTECT both indicate successful initialization.
Note:

DRESULT disk_read BYTE  drv,
BYTE *  buff,
DWORD  sector,
BYTE  count
 

Reads the drive In case of SD, it reads the SD card using ADMA2 in polled mode.

Parameters:
drv - Drive number
*buff - Pointer to the data buffer to store read data
sector - Start sector number
count - Sector count
Returns:
RES_OK Read successful STA_NOINIT Drive not initialized RES_ERROR Read not successful
Note:

DSTATUS disk_status BYTE  drv  ) 
 

Gets the status of the disk. In case of SD, it checks whether card is present or not.

Parameters:
drv - Drive number
Returns:
0 Status ok STA_NOINIT Drive not initialized STA_NODISK No medium in the drive STA_PROTECT Write protected
Note:
In case Card detect signal is not connected, this function will not be able to check if card is present.

DRESULT disk_write BYTE  drv,
const BYTE *  buff,
DWORD  sector,
BYTE  count
 

Reads the drive In case of SD, it reads the SD card using ADMA2 in polled mode.

Parameters:
drv - Drive number
*buff - Pointer to the data to be written
sector - Sector address
count - Sector count
Returns:
RES_OK Read successful STA_NOINIT Drive not initialized RES_ERROR Read not successful
Note:

DWORD get_fattime void   ) 
 

This function is User Provided Timer Function for FatFs module

Parameters:
None 
Returns:
DWORD
Note:
None


Generated on Thu Feb 13 14:34:38 2014 for 2014.1_doc by  doxygen 1.4.5