/*------------------------------------------------------------------------*/1/* Sample Code of OS Dependent Functions for FatFs */2/* (C) ChaN, 2018 */3/* (C) CTCaer, 2018-2024 */4/*------------------------------------------------------------------------*/56#include <bdk.h>78#include <libs/fatfs/ff.h>910#if FF_USE_LFN == 3 /* Dynamic memory allocation */1112/*------------------------------------------------------------------------*/13/* Allocate a memory block */14/*------------------------------------------------------------------------*/1516void* ff_memalloc ( /* Returns pointer to the allocated memory block (null if not enough core) */17UINT msize /* Number of bytes to allocate */18)19{20// Ensure size is aligned to SDMMC block size.21return malloc(ALIGN(msize, SDMMC_DAT_BLOCKSIZE)); /* Allocate a new memory block with POSIX API */22}232425/*------------------------------------------------------------------------*/26/* Free a memory block */27/*------------------------------------------------------------------------*/2829void ff_memfree (30void* mblock /* Pointer to the memory block to free (nothing to do if null) */31)32{33free(mblock); /* Free the memory block with POSIX API */34}3536#endif3738#if FF_FS_NORTC == 03940/*------------------------------------------------------------------------*/41/* Get real time clock */42/*------------------------------------------------------------------------*/4344DWORD get_fattime (45void46)47{48rtc_time_t time;4950max77620_rtc_get_time_adjusted(&time);5152return (((DWORD)(time.year - 1980) << 25) | ((DWORD)time.month << 21) | ((DWORD)time.day << 16) |53((DWORD)time.hour << 11) | ((DWORD)time.min << 5) | (time.sec >> 1));54}5556#endif575859