This commit is contained in:
pvvx 2017-09-22 10:44:42 +03:00
parent 9ffd9dac1a
commit eac35630e6
31 changed files with 185 additions and 130 deletions

View file

@ -109,7 +109,7 @@ SD_RESULT SD_GetCapacity(uint32_t *sector_count) {
//----- SD_ReadBlocks
SD_RESULT SD_ReadBlocks(u32 sector, u8 *data, u32 count) {
int rd_count;
int rd_count = 0;
unsigned char * buf;
if ((u32) data & 3) {
@ -145,7 +145,7 @@ SD_RESULT SD_ReadBlocks(u32 sector, u8 *data, u32 count) {
//----- SD_WriteBlocks
SD_RESULT SD_WriteBlocks(u32 sector, const u8 *data, u32 count) {
int wr_count;
int wr_count = 0;
unsigned char * buf;
if ((u32) data & 3) {

View file

@ -186,7 +186,7 @@ s8 sdio_write_blocks(uint32_t sector, const uint8_t *buffer, uint32_t count) {
rtl_memset(gAdmaTbls, 0, sizeof(ADMA2_DESC_FMT) * count);
if (1) {
ADMA2_DESC_FMT *p = gAdmaTbls;
u8 * pbuf = buffer;
u8 * pbuf = (u8 *)buffer;
int i = 0;
while (i < count) {
i++;
@ -255,14 +255,14 @@ s8 sdio_sd_setClock(SD_CLK_FREQUENCY SDCLK) {
if (sdio_status <= SDIO_SD_NONE) {
return -1;
}
ADMA2_DESC_FMT * padma = rtw_zmalloc(sizeof(ADMA2_DESC_FMT));
ADMA2_DESC_FMT * padma = (ADMA2_DESC_FMT *) rtw_zmalloc(sizeof(ADMA2_DESC_FMT));
if (!padma) {
DBG_SDIO_ERR("Malloc ADMA2 table fail.\n");
return -1;
}
DBG_SDIO_INFO("SD card set CLK %d Hz\n", PLATFORM_CLOCK/(2 << (SD_CLK_41_6MHZ - SDCLK)));
sta = HalSdioHostOp.HalSdioHostChangeSdClock(&SdioHostAdapter, SDCLK);
rtw_mfree(padma, sizeof(ADMA2_DESC_FMT));
rtw_mfree((u8 *)padma, sizeof(ADMA2_DESC_FMT));
if (sta)
return -1;
return 0;
@ -296,11 +296,10 @@ s8 sdio_sd_setProtection(bool protection) {
}
LABEL_8:
sd_protected = protection;
LABEL_7:
DBG_SDIO_INFO("Set SD card Protection done.\n");
result = 0;
LABEL_17:
rtw_mfree(padma, sizeof(ADMA2_DESC_FMT));
rtw_mfree((u8 *)padma, sizeof(ADMA2_DESC_FMT));
return result;
}
return -1;