Ignore:
Timestamp:
Jan 29, 2025, 1:36:43 PM (3 months ago)
Author:
Zed
Message:

FatFs? with DMA were implemented.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ctrl/firmware/Main/SES/Core/Src/main_task.cpp

    r73 r74  
    55#include "task.h"
    66
     7#include "ff.h"
     8#include "fatfs.h"
    79#include "main_task.h"
    810#include "utils.h"
     
    1719//UINT ret;
    1820
     21static FATFS fs;     // Filesystem object
     22
     23
    1924//------------------------------------------------------------------------------
    2025
    2126[[noreturn]] void mainTaskStart(void *argument)
    2227{
    23 /*      ret = fx_media_volume_get(sdio_disk, volumeName, FX_DIRECTORY_SECTOR);
    24         if (ret == FX_SUCCESS)
    25         {
    26                 printf("Volume label: %s\n", volumeName);
     28    FRESULT  r = f_mount(&fs, (const TCHAR*)"", 1);            // Mount the default drive
     29        if (r != FR_OK) printf("Cannot mount SD-card!\n");
     30        else printf("SD-card was mounted.\n");
    2731
    28                 ULONG64 available_bytes = 0;
    29                 ret = fx_media_extended_space_available(sdio_disk, &available_bytes);
    30                 if (ret == FX_SUCCESS)
    31                 {
    32                         printf("Free space: ");
    33                         [available_bytes]
    34                         {
    35                                 constexpr unsigned EXT_NUM = 5U;
    36                                 char ext[EXT_NUM][6] { "bytes", "KB", "MB", "GB", "TB"};
    37                                 char fmt[] {"%llu %s\n"};
    38 
    39                                 for (auto i = 0U; i < EXT_NUM; i++)
    40                                 {
    41                                         uint64_t limit = 1ULL << (10U * (i + 1U));
    42                                         if (available_bytes < limit)
    43                                         {
    44                                                 printf(fmt, available_bytes / (limit >> 10U) , ext[i]);
    45                                                 return;
    46                                         }
    47                                 }
    48                                 printf(fmt,  available_bytes/ (1ULL << (10U * 5U)));
    49                         }();
    50 
    51                         ret = fx_directory_first_entry_find(sdio_disk, entry);
    52                         while(ret == FX_SUCCESS)
    53                         {
    54                                 ret = fx_directory_name_test(sdio_disk, entry);
    55                                 if (ret == FX_SUCCESS)
    56                                 {
    57                                         printf("Found folder: %s\n", entry);
    58                                 }
    59                                 ret = fx_directory_next_entry_find(sdio_disk, entry);
    60                         }
    61                 }
    62         }
    63         else
    64         {
    65                 printf("Disk name cannot be obtained!\n");
    66         }
    67 
    68 */
    6932        while(1)
    7033        {
    71                 vTaskDelay(delay_ms);
     34                vTaskDelay(pdMS_TO_TICKS(delay_ms));
    7235
    7336                //printThreadStackInfo(TAG);
Note: See TracChangeset for help on using the changeset viewer.