diff --git a/Libraries/SDHC/Include/sdhc_lib.h b/Libraries/SDHC/Include/sdhc_lib.h index 4b942341166..492bbd97faa 100644 --- a/Libraries/SDHC/Include/sdhc_lib.h +++ b/Libraries/SDHC/Include/sdhc_lib.h @@ -102,7 +102,7 @@ int MXC_SDHC_Lib_SetRCA(void); int MXC_SDHC_Lib_GetCSD(mxc_sdhc_csd_regs_t *csd); /* ************************************************************************** */ -unsigned int MXC_SDHC_Lib_GetCapacity(mxc_sdhc_csd_regs_t* csd); +unsigned long long MXC_SDHC_Lib_GetCapacity(mxc_sdhc_csd_regs_t* csd); /* ************************************************************************** */ unsigned int MXC_SDHC_Lib_GetSectors(mxc_sdhc_csd_regs_t* csd); diff --git a/Libraries/SDHC/Source/sdhc_lib.c b/Libraries/SDHC/Source/sdhc_lib.c index 1e3a8823aec..d1791de2dbd 100644 --- a/Libraries/SDHC/Source/sdhc_lib.c +++ b/Libraries/SDHC/Source/sdhc_lib.c @@ -176,11 +176,17 @@ int MXC_SDHC_Lib_GetCSD(mxc_sdhc_csd_regs_t *csd) } /* ************************************************************************** */ -unsigned int MXC_SDHC_Lib_GetCapacity(mxc_sdhc_csd_regs_t* csd) +unsigned long long MXC_SDHC_Lib_GetCapacity(mxc_sdhc_csd_regs_t* csd) { unsigned int size = csd->csd.c_size; - return (size*(512*1024)); + return ((unsigned long long)(size+1))*((unsigned long long)512*1024); +} + +/* ************************************************************************** */ +unsigned int MXC_SDHC_Lib_GetSectors(mxc_sdhc_csd_regs_t* csd) +{ + return csd->csd.c_size; } /* ************************************************************************** */