2016年10月16日日曜日

FRESULT

FatFsのFRESULTを文字列に変換する関数。
文字列はff.hの構造体のコメントをそのまま使用。現在の最新版である0.12bを使用しているが、リビジョンが変わった場合はエラーになる。

この間まで動いてたはずなのに別のところ色々いじってたら動かなくなって絶賛デバッグ中。


const char *fresultstr(FRESULT fre) {
#if _FATFS != 68020
#error fatfs revision error
#endif

    switch (fre) {
    case FR_OK:
        return("Succeeded");
    case FR_DISK_ERR:
        return("A hard error occurred in the low level disk I/O layer");
    case FR_INT_ERR:
        return("Assertion failed");
    case FR_NOT_READY:
        return("The physical drive cannot work");
    case FR_NO_FILE:
        return("Could not find the file");
    case FR_NO_PATH:
        return("Could not find the path");
    case FR_INVALID_NAME:
        return("The path name format is invalid");
    case FR_DENIED:
        return("Access denied due to prohibited access or directory full");
    case FR_EXIST:
        return("Access denied due to prohibited access");
    case FR_INVALID_OBJECT:
        return("The file/directory object is invalid");
    case FR_WRITE_PROTECTED:
        return("The physical drive is write protected");
    case FR_INVALID_DRIVE:
        return("The logical drive number is invalid");
    case FR_NOT_ENABLED:
        return("The volume has no work area");
    case FR_NO_FILESYSTEM:
        return("There is no valid FAT volume");
    case FR_MKFS_ABORTED:
        return("The f_mkfs() aborted due to any problem");
    case FR_TIMEOUT:
        return("Could not get a grant to access the volume within defined period");
    case FR_LOCKED:
        return("The operation is rejected according to the file sharing policy");
    case FR_NOT_ENOUGH_CORE:
        return("LFN working buffer could not be allocated");
    case FR_TOO_MANY_OPEN_FILES:
        return("Number of open files > _FS_LOCK");
    case FR_INVALID_PARAMETER:
        return("Given parameter is invalid");
    default:
        return("Unkown status");
    }
}

0 件のコメント:

コメントを投稿