STM32 Bootloader
Customizable Bootloader for STM32 microcontrollers
SdDiskIo

Functions

const Diskio_drvTypeDef * SdDiskIoGetDriver (void)
 Get a pointer to the SD card disk I/O driver structure containing the initialize, status, read, write, and ioctl callbacks used by the FatFs middleware. More...
 
static void SdReadCompleteCallback (void)
 Callback for the SD DMA read transfer complete.
 
static void SdWriteCompleteCallback (void)
 Callback for the SD DMA write transfer complete.
 
static DSTATUS SdDiskIoInit (BYTE pdrv)
 Initialize the SD card disk I/O driver and register DMA callbacks. More...
 
static DSTATUS SdDiskIoStatus (BYTE pdrv)
 Return the current status of the SD card. More...
 
static DRESULT SdDiskIoRead (BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
 Read one or more sectors from the SD card. More...
 
static DRESULT SdDiskIoWrite (BYTE pdrv, const BYTE *buff, DWORD sector, UINT count)
 Write one or more sectors to the SD card. More...
 
static DRESULT SdDiskIoIoctl (BYTE pdrv, BYTE cmd, void *buff)
 Perform miscellaneous disk I/O control operations on the SD card. More...
 

Variables

static volatile bool isReadComplete = false
 
static volatile bool isWriteComplete = false
 

Detailed Description

Function Documentation

◆ SdDiskIoGetDriver()

const Diskio_drvTypeDef * SdDiskIoGetDriver ( void  )

Get a pointer to the SD card disk I/O driver structure containing the initialize, status, read, write, and ioctl callbacks used by the FatFs middleware.

Returns
Pointer to the SD card disk I/O driver structure.

Definition at line 103 of file sd_diskio.c.

◆ SdDiskIoInit()

static DSTATUS SdDiskIoInit ( BYTE  pdrv)
static

Initialize the SD card disk I/O driver and register DMA callbacks.

Parameters
pdrvPhysical drive number.
Returns
Disk status flags.

Definition at line 113 of file sd_diskio.c.

◆ SdDiskIoIoctl()

static DRESULT SdDiskIoIoctl ( BYTE  pdrv,
BYTE  cmd,
void *  buff 
)
static

Perform miscellaneous disk I/O control operations on the SD card.

Parameters
pdrvPhysical drive number.
cmdControl command code (CTRL_SYNC, GET_SECTOR_COUNT, etc.).
buffPointer to the parameter buffer.
Returns
RES_OK on success, RES_PARERR on unknown command, RES_NOTRDY if the card is not ready.

Definition at line 237 of file sd_diskio.c.

◆ SdDiskIoRead()

static DRESULT SdDiskIoRead ( BYTE  pdrv,
BYTE *  buff,
DWORD  sector,
UINT  count 
)
static

Read one or more sectors from the SD card.

Parameters
pdrvPhysical drive number.
buffPointer to the buffer to store the read data.
sectorStart sector number.
countNumber of sectors to read.
Returns
RES_OK on success, RES_ERROR on failure.

Definition at line 137 of file sd_diskio.c.

◆ SdDiskIoStatus()

static DSTATUS SdDiskIoStatus ( BYTE  pdrv)
static

Return the current status of the SD card.

Parameters
pdrvPhysical drive number.
Returns
Disk status flags.

Definition at line 124 of file sd_diskio.c.

◆ SdDiskIoWrite()

static DRESULT SdDiskIoWrite ( BYTE  pdrv,
const BYTE *  buff,
DWORD  sector,
UINT  count 
)
static

Write one or more sectors to the SD card.

Parameters
pdrvPhysical drive number.
buffPointer to the data to be written.
sectorStart sector number.
countNumber of sectors to write.
Returns
RES_OK on success, RES_ERROR on failure.

Definition at line 185 of file sd_diskio.c.

Variable Documentation

◆ isReadComplete

volatile bool isReadComplete = false
static

Flag indicating that a DMA read transfer has completed.

Definition at line 97 of file sd_diskio.c.

◆ isWriteComplete

volatile bool isWriteComplete = false
static

Flag indicating that a DMA write transfer has completed.

Definition at line 100 of file sd_diskio.c.