Skip to content

Commit ee8fc85

Browse files
committed
mmc card: export getFatFsErrorDescription()
1 parent 2292073 commit ee8fc85

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

firmware/hw_layer/mmc_card.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,12 @@ static const char *fatErrors[] = {
276276
"FR_INVALID_PARAMETER: Given parameter is invalid"
277277
};
278278

279+
const char *getFatFsErrorDescription(FRESULT f_error) {
280+
if (f_error <= FR_INVALID_PARAMETER)
281+
return fatErrors[f_error];
282+
return "unknown";
283+
}
284+
279285
// print FAT error function
280286
void printFatFsError(const char *str, FRESULT f_error) {
281287
static int fatFsErrors = 0;
@@ -285,7 +291,7 @@ void printFatFsError(const char *str, FRESULT f_error) {
285291
return;
286292
}
287293

288-
efiPrintf("%s FATfs Error %d %s", str, f_error, f_error <= FR_INVALID_PARAMETER ? fatErrors[f_error] : "unknown");
294+
efiPrintf("%s FATfs Error %d %s", str, f_error, getFatFsErrorDescription(f_error));
289295
}
290296

291297
// format, file access and MSD are used exclusively, we can union.

firmware/hw_layer/mmc_card_util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
#pragma once
44

55
void incLogFileName(FIL *fd);
6+
const char *getFatFsErrorDescription(FRESULT f_error);
67
void printFatFsError(const char *str, FRESULT f_error);
78
void writeErrorReportFile();

0 commit comments

Comments
 (0)