cueOS  2.4
cueOS - Universal Show Control OS for ARM
sd_diskio.c File Reference

SD Disk I/O driver. More...

#include "ff_gen_drv.h"
#include "sd_diskio.h"
#include <string.h>
#include <stdio.h>
Include dependency graph for sd_diskio.c:

Go to the source code of this file.

Macros

#define QUEUE_SIZE   (uint32_t) 10
 
#define READ_CPLT_MSG   (uint32_t) 1
 
#define WRITE_CPLT_MSG   (uint32_t) 2
 
#define SD_TIMEOUT   30 * 1000
 
#define SD_DEFAULT_BLOCK_SIZE   512
 

Functions

static DSTATUS SD_CheckStatus (BYTE lun)
 
DSTATUS SD_initialize (BYTE lun)
 Initializes a Drive. More...
 
DSTATUS SD_status (BYTE lun)
 Gets Disk Status. More...
 
DRESULT SD_read (BYTE lun, BYTE *buff, DWORD sector, UINT count)
 Reads Sector(s) More...
 
static int SD_CheckStatusWithTimeout (uint32_t timeout)
 
void BSP_SD_WriteCpltCallback (void)
 Writes Sector(s) More...
 
void BSP_SD_ReadCpltCallback (void)
 Rx Transfer completed callbacks. More...
 

Variables

static volatile DSTATUS Stat = STA_NOINIT
 
static osMessageQId SDQueueID = NULL
 
const Diskio_drvTypeDef SD_Driver
 

Detailed Description

SD Disk I/O driver.

Attention

© Copyright (c) 2020 STMicroelectronics. All rights reserved.

This software component is licensed by ST under Ultimate Liberty license SLA0044, the "License"; You may not use this file except in compliance with the License. You may obtain a copy of the License at: www.st.com/SLA0044

Definition in file sd_diskio.c.

Macro Definition Documentation

◆ QUEUE_SIZE

#define QUEUE_SIZE   (uint32_t) 10

Definition at line 38 of file sd_diskio.c.

◆ READ_CPLT_MSG

#define READ_CPLT_MSG   (uint32_t) 1

Definition at line 39 of file sd_diskio.c.

◆ SD_DEFAULT_BLOCK_SIZE

#define SD_DEFAULT_BLOCK_SIZE   512

Definition at line 60 of file sd_diskio.c.

◆ SD_TIMEOUT

#define SD_TIMEOUT   30 * 1000

Definition at line 58 of file sd_diskio.c.

◆ WRITE_CPLT_MSG

#define WRITE_CPLT_MSG   (uint32_t) 2

Definition at line 40 of file sd_diskio.c.

Function Documentation

◆ BSP_SD_ReadCpltCallback()

void BSP_SD_ReadCpltCallback ( void  )

Rx Transfer completed callbacks.

BSP Rx Transfer completed callback.

Parameters
hsdSD handle
Return values
None

Definition at line 654 of file sd_diskio.c.

◆ BSP_SD_WriteCpltCallback()

void BSP_SD_WriteCpltCallback ( void  )

Writes Sector(s)

BSP Tx Transfer completed callback.

Parameters
lun: not used
*buffData to be written
sectorSector address (LBA)
countNumber of sectors to write (1..128)
Return values
DRESULTOperation result

I/O control operation

Parameters
lun: not used
cmdControl code
*buffBuffer to send/receive control data
Return values
DRESULTOperation result

Tx Transfer completed callbacks

Parameters
hsdSD handle
Return values
None

Definition at line 634 of file sd_diskio.c.

◆ SD_CheckStatus()

static DSTATUS SD_CheckStatus ( BYTE  lun)
static

Definition at line 160 of file sd_diskio.c.

◆ SD_CheckStatusWithTimeout()

static int SD_CheckStatusWithTimeout ( uint32_t  timeout)
static

Definition at line 139 of file sd_diskio.c.

◆ SD_initialize()

DSTATUS SD_initialize ( BYTE  lun)

Initializes a Drive.

Parameters
lun: not used
Return values
DSTATUSOperation status

Definition at line 177 of file sd_diskio.c.

◆ SD_read()

DRESULT SD_read ( BYTE  lun,
BYTE *  buff,
DWORD  sector,
UINT  count 
)

Reads Sector(s)

Parameters
lun: not used
*buffData buffer to store read data
sectorSector address (LBA)
countNumber of sectors to read (1..128)
Return values
DRESULTOperation result

Definition at line 251 of file sd_diskio.c.

◆ SD_status()

DSTATUS SD_status ( BYTE  lun)

Gets Disk Status.

Parameters
lun: not used
Return values
DSTATUSOperation status

Definition at line 234 of file sd_diskio.c.

Variable Documentation

◆ SD_Driver

const Diskio_drvTypeDef SD_Driver
Initial value:
=
{
}
DRESULT SD_read(BYTE, BYTE *, DWORD, UINT)
Reads Sector(s)
Definition: sd_diskio.c:251
DSTATUS SD_status(BYTE)
Gets Disk Status.
Definition: sd_diskio.c:234
DSTATUS SD_initialize(BYTE)
Initializes a Drive.
Definition: sd_diskio.c:177

Definition at line 119 of file sd_diskio.c.

◆ SDQueueID

osMessageQId SDQueueID = NULL
static

Definition at line 103 of file sd_diskio.c.

◆ Stat

volatile DSTATUS Stat = STA_NOINIT
static

Definition at line 100 of file sd_diskio.c.