big refactoring and features added
This commit is contained in:
@ -51,9 +51,11 @@
|
||||
/* #define DISABLE_SD_INIT */
|
||||
/* USER CODE END disableSDInit */
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Disk status */
|
||||
static volatile DSTATUS Stat = STA_NOINIT;
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Disk status */
|
||||
static volatile DSTATUS Stat = STA_NOINIT;
|
||||
static volatile DSTATUS g_last_initialize_status = STA_NOINIT;
|
||||
static volatile DSTATUS g_last_status_result = STA_NOINIT;
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
static DSTATUS SD_CheckStatus(BYTE lun);
|
||||
@ -81,9 +83,18 @@ const Diskio_drvTypeDef SD_Driver =
|
||||
#endif /* _USE_IOCTL == 1 */
|
||||
};
|
||||
|
||||
/* USER CODE BEGIN beforeFunctionSection */
|
||||
/* can be used to modify / undefine following code or add new code */
|
||||
/* USER CODE END beforeFunctionSection */
|
||||
/* USER CODE BEGIN beforeFunctionSection */
|
||||
/* can be used to modify / undefine following code or add new code */
|
||||
DSTATUS sd_diskio_debug_get_last_initialize_status(void)
|
||||
{
|
||||
return g_last_initialize_status;
|
||||
}
|
||||
|
||||
DSTATUS sd_diskio_debug_get_last_status_result(void)
|
||||
{
|
||||
return g_last_status_result;
|
||||
}
|
||||
/* USER CODE END beforeFunctionSection */
|
||||
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
@ -104,9 +115,9 @@ static DSTATUS SD_CheckStatus(BYTE lun)
|
||||
* @param lun : not used
|
||||
* @retval DSTATUS: Operation status
|
||||
*/
|
||||
DSTATUS SD_initialize(BYTE lun)
|
||||
{
|
||||
Stat = STA_NOINIT;
|
||||
DSTATUS SD_initialize(BYTE lun)
|
||||
{
|
||||
Stat = STA_NOINIT;
|
||||
|
||||
#if !defined(DISABLE_SD_INIT)
|
||||
|
||||
@ -115,22 +126,25 @@ Stat = STA_NOINIT;
|
||||
Stat = SD_CheckStatus(lun);
|
||||
}
|
||||
|
||||
#else
|
||||
Stat = SD_CheckStatus(lun);
|
||||
#endif
|
||||
|
||||
return Stat;
|
||||
}
|
||||
#else
|
||||
Stat = SD_CheckStatus(lun);
|
||||
#endif
|
||||
|
||||
g_last_initialize_status = Stat;
|
||||
|
||||
return Stat;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets Disk Status
|
||||
* @param lun : not used
|
||||
* @retval DSTATUS: Operation status
|
||||
*/
|
||||
DSTATUS SD_status(BYTE lun)
|
||||
{
|
||||
return SD_CheckStatus(lun);
|
||||
}
|
||||
DSTATUS SD_status(BYTE lun)
|
||||
{
|
||||
g_last_status_result = SD_CheckStatus(lun);
|
||||
return g_last_status_result;
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN beforeReadSection */
|
||||
/* can be used to modify previous code / undefine following code / add new code */
|
||||
|
||||
Reference in New Issue
Block a user