bdk: mem: rename sdmmc dma buffer

This commit is contained in:
CTCaer
2026-02-12 21:38:56 +02:00
parent 3052df722b
commit 9171fa70c9
2 changed files with 16 additions and 16 deletions

View File

@@ -71,9 +71,9 @@
//#define DRAM_LIB_ADDR 0xE0000000
/* --- Chnldr: 252MB 0xC03C0000 - 0xCFFFFFFF --- */ //! Only used when chainloading.
// SDMMC DMA buffers 1
#define SDMMC_UPPER_BUFFER 0xE5000000
#define SDMMC_UP_BUF_SZ SZ_128M
// SDMMC DMA buffer. Used for unaligned DMA buffer address.
#define SDMMC_ALT_DMA_BUFFER 0xE5000000
#define SDMMC_ALT_DMA_BUF_SZ SZ_128M
// Nyx buffers. !Do not change!
#define NYX_STORAGE_ADDR 0xED000000
@@ -81,10 +81,10 @@
#define NYX_RES_ADDR 0xEE000000
#define NYX_RES_SZ SZ_16M
// SDMMC DMA buffers 2
#define SDXC_BUF_ALIGNED 0xEF000000
#define MIXD_BUF_ALIGNED 0xF0000000
#define EMMC_BUF_ALIGNED MIXD_BUF_ALIGNED
// SDMMC Application DMA aligned buffers.
#define SDXC_BUF_ALIGNED 0xEF000000 // Also used by UMS.
#define EMMC_BUF_ALIGNED 0xF0000000
#define MIXD_BUF_ALIGNED EMMC_BUF_ALIGNED
#define SDMMC_DMA_BUF_SZ SZ_16M // 4MB currently used.
// Nyx LvGL buffers.

View File

@@ -367,13 +367,13 @@ out:
int sdmmc_storage_read(sdmmc_storage_t *storage, u32 sector, u32 num_sectors, void *buf)
{
// Ensure that SDMMC has access to buffer and it's SDMMC DMA aligned.
if (mc_client_has_access(buf) && !((u32)buf % 8))
if (mc_client_has_access(buf) && !((u32)buf % SDMMC_ADMA_ADDR_ALIGN))
return _sdmmc_storage_readwrite(storage, sector, num_sectors, buf, 0);
if (num_sectors > (SDMMC_UP_BUF_SZ / SDMMC_DAT_BLOCKSIZE))
if (num_sectors > (SDMMC_ALT_DMA_BUF_SZ / SDMMC_DAT_BLOCKSIZE))
return 0;
u8 *tmp_buf = (u8 *)SDMMC_UPPER_BUFFER;
u8 *tmp_buf = (u8 *)SDMMC_ALT_DMA_BUFFER;
if (_sdmmc_storage_readwrite(storage, sector, num_sectors, tmp_buf, 0))
{
memcpy(buf, tmp_buf, SDMMC_DAT_BLOCKSIZE * num_sectors);
@@ -385,13 +385,13 @@ int sdmmc_storage_read(sdmmc_storage_t *storage, u32 sector, u32 num_sectors, vo
int sdmmc_storage_write(sdmmc_storage_t *storage, u32 sector, u32 num_sectors, void *buf)
{
// Ensure that SDMMC has access to buffer and it's SDMMC DMA aligned.
if (mc_client_has_access(buf) && !((u32)buf % 8))
if (mc_client_has_access(buf) && !((u32)buf % SDMMC_ADMA_ADDR_ALIGN))
return _sdmmc_storage_readwrite(storage, sector, num_sectors, buf, 1);
if (num_sectors > (SDMMC_UP_BUF_SZ / SDMMC_DAT_BLOCKSIZE))
if (num_sectors > (SDMMC_ALT_DMA_BUF_SZ / SDMMC_DAT_BLOCKSIZE))
return 0;
u8 *tmp_buf = (u8 *)SDMMC_UPPER_BUFFER;
u8 *tmp_buf = (u8 *)SDMMC_ALT_DMA_BUFFER;
memcpy(tmp_buf, buf, SDMMC_DAT_BLOCKSIZE * num_sectors);
return _sdmmc_storage_readwrite(storage, sector, num_sectors, tmp_buf, 1);
}
@@ -780,7 +780,7 @@ int sdmmc_storage_init_mmc(sdmmc_storage_t *storage, sdmmc_t *sdmmc, u32 bus_wid
return 0;
DPRINTF("[MMC] switched buswidth\n");
if (!mmc_storage_get_ext_csd(storage, (u8 *)SDMMC_UPPER_BUFFER))
if (!mmc_storage_get_ext_csd(storage, (u8 *)SDMMC_ALT_DMA_BUFFER))
return 0;
DPRINTF("[MMC] got ext_csd\n");
@@ -1370,7 +1370,7 @@ static int _sd_storage_set_card_bus_speed(sdmmc_storage_t *storage, u32 hs_type,
int sd_storage_get_fmodes(sdmmc_storage_t *storage, u8 *buf, sd_func_modes_t *fmodes)
{
if (!buf)
buf = (u8 *)SDMMC_UPPER_BUFFER;
buf = (u8 *)SDMMC_ALT_DMA_BUFFER;
if (!_sd_storage_switch_get(storage, buf))
return 0;
@@ -1797,7 +1797,7 @@ int sdmmc_storage_init_sd(sdmmc_storage_t *storage, sdmmc_t *sdmmc, u32 bus_widt
{
u32 tmp = 0;
bool is_sdsc = 0;
u8 *buf = (u8 *)SDMMC_UPPER_BUFFER;
u8 *buf = (u8 *)SDMMC_ALT_DMA_BUFFER;
bool bus_uhs_support = _sdmmc_storage_get_bus_uhs_support(bus_width, type);
DPRINTF("[SD]-[init: bus: %d, type: %d]\n", bus_width, type);