feat(radio): static disk cache (#6170)
This commit is contained in:
@@ -29,6 +29,13 @@
|
||||
|
||||
_stext_iram = LOADADDR(.iram);
|
||||
|
||||
/* Disk cache buffers */
|
||||
.disk_cache (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.disk_cache)
|
||||
} > RAM_D1
|
||||
|
||||
/* Extra DMA section */
|
||||
.dram (NOLOAD) :
|
||||
{
|
||||
|
||||
@@ -29,6 +29,13 @@
|
||||
|
||||
_stext_iram = LOADADDR(.iram);
|
||||
|
||||
/* Disk cache buffers */
|
||||
.disk_cache (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.disk_cache)
|
||||
} > PSRAM
|
||||
|
||||
/* Extra DMA section */
|
||||
.dram (NOLOAD) :
|
||||
{
|
||||
|
||||
@@ -38,6 +38,10 @@
|
||||
#define BLOCK_SIZE FF_MAX_SS
|
||||
#define DISK_CACHE_BLOCK_SIZE (DISK_CACHE_BLOCK_SECTORS * BLOCK_SIZE)
|
||||
|
||||
#if !defined(__DISK_CACHE)
|
||||
#define __DISK_CACHE __SDRAM
|
||||
#endif
|
||||
|
||||
DiskCache diskCache;
|
||||
|
||||
class DiskCacheBlock
|
||||
@@ -112,9 +116,11 @@ DiskCache::DiskCache() : lastBlock(0), blocks(nullptr), diskDrv(nullptr)
|
||||
stats.noWrites = 0;
|
||||
}
|
||||
|
||||
static DiskCacheBlock _cache_blocks[DISK_CACHE_BLOCKS_NUM] __DISK_CACHE;
|
||||
|
||||
void DiskCache::initialize(const diskio_driver_t* drv)
|
||||
{
|
||||
blocks = new DiskCacheBlock[DISK_CACHE_BLOCKS_NUM];
|
||||
blocks = _cache_blocks;
|
||||
diskDrv = drv;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,13 @@
|
||||
#include "hal/fatfs_diskio.h"
|
||||
|
||||
// tunable parameters
|
||||
#if !defined(DISK_CACHE_BLOCKS_NUM)
|
||||
#define DISK_CACHE_BLOCKS_NUM 32 // no cache blocks
|
||||
#endif
|
||||
|
||||
#if !defined(DISK_CACHE_BLOCK_SECTORS)
|
||||
#define DISK_CACHE_BLOCK_SECTORS 16 // no sectors
|
||||
#endif
|
||||
|
||||
struct DiskCacheStats
|
||||
{
|
||||
|
||||
@@ -27,5 +27,4 @@
|
||||
#define __IRAM __attribute__((section(".iram")))
|
||||
#define __SDRAM __attribute__((section(".sdram"), aligned(4)))
|
||||
#define __SDRAMFONTS __attribute__((section(".sdram_fonts"), aligned(4)))
|
||||
|
||||
|
||||
#define __DISK_CACHE __attribute__((section(".disk_cache"), aligned(4)))
|
||||
|
||||
Reference in New Issue
Block a user