bdk: sdmmc: add defines for max block number

This commit is contained in:
CTCaer
2025-12-17 04:30:12 +02:00
parent 6207a783d7
commit 4797b42e76
3 changed files with 5 additions and 3 deletions

View File

@@ -327,7 +327,7 @@ static int _sdmmc_storage_readwrite(sdmmc_storage_t *storage, u32 sector, u32 nu
do do
{ {
reinit_try: reinit_try:
if (_sdmmc_storage_readwrite_ex(storage, &blkcnt, sct_off, MIN(sct_total, 0xFFFF), bbuf, is_write)) if (_sdmmc_storage_readwrite_ex(storage, &blkcnt, sct_off, MIN(sct_total, SDMMC_AMAX_BLOCKNUM), bbuf, is_write))
goto out; goto out;
else else
retries--; retries--;

View File

@@ -24,6 +24,8 @@
#define SDMMC_CMD_BLOCKSIZE 64 #define SDMMC_CMD_BLOCKSIZE 64
#define SDMMC_DAT_BLOCKSIZE 512 #define SDMMC_DAT_BLOCKSIZE 512
#define SDMMC_HMAX_BLOCKNUM 0xFFFF // HW max.
#define SDMMC_AMAX_BLOCKNUM 0xF000 // Aligned max.
extern u32 sd_power_cycle_time_start; extern u32 sd_power_cycle_time_start;

View File

@@ -1008,8 +1008,8 @@ static int _sdmmc_config_sdma(sdmmc_t *sdmmc, u32 *blkcnt_out, const sdmmc_req_t
return 0; return 0;
u32 blkcnt = req->num_sectors; u32 blkcnt = req->num_sectors;
if (blkcnt >= 0xFFFF) if (blkcnt >= SDMMC_HMAX_BLOCKNUM)
blkcnt = 0xFFFF; blkcnt = SDMMC_HMAX_BLOCKNUM;
u32 admaaddr = (u32)req->buf; u32 admaaddr = (u32)req->buf;
// Check alignment. // Check alignment.