/* mount sd card */ status = fx_media_open(&sdio_disk, "STM32_SDIO_DISK", fx_stm32_sd_driver, 0, media_memory, sizeof(media_memory)); if (status != FX_SUCCESS) { printf("mount sd card fail -- %d\r\n", status); return; } printf("attributes | size | file short name | file long name\r\n"); for(int index = sdio_disk.fx_media_number_of_FATs;index!=0;index--) { for (cnt = 0; ;cnt++) { /* read all entry */ status = fx_directory_next_full_entry_find(&sdio_disk, entry_name, &attributes, &size, &year, &month, &day, &hour, &minute, &second); if (status != FX_SUCCESS || entry_name[0] == 0) { break; } if (entry_name[0] == '.') { continue; } /* list attributes*/ if (attributes & FX_VOLUME) { printf("volume "); } else if (attributes & FX_DIRECTORY) { printf("directory "); } else { printf("file "); } /* print file size, max 4G */ printf(" %10d", (int)size); printf(" %s\r\n", (char *)entry_name); /* print file name */ } /* space volume available */ status = fx_media_extended_space_available(&sdio_disk, &available_bytes); } if (status == FX_SUCCESS) { printf("SD card available size -- %lldMB\r\n", available_bytes/1024/1024); } /* unmount sd card*/ status = fx_media_close(&sdio_disk); if (status != FX_SUCCESS) { printf("unmount sd card failed -- %d\r\n", status); }