X-Git-Url: http://www.codesrc.com/gitweb/index.cgi?p=SCSI2SD-V6.git;a=blobdiff_plain;f=STM32CubeMX%2FSCSI2SD-V6%2FDrivers%2FSTM32F2xx_HAL_Driver%2FSrc%2Fstm32f2xx_hal_sd.c;h=8511aa7be0ad01e04e373ebc889fb1ac8bf5b4b3;hp=418163e46710aaea8c9ba9f59dc210f566b27b74;hb=8e37a27624e4f5d820a9e3482c7969da030fb82e;hpb=88692b1c9bc6303e561246fd1c8859a0484c74c6 diff --git a/STM32CubeMX/SCSI2SD-V6/Drivers/STM32F2xx_HAL_Driver/Src/stm32f2xx_hal_sd.c b/STM32CubeMX/SCSI2SD-V6/Drivers/STM32F2xx_HAL_Driver/Src/stm32f2xx_hal_sd.c index 418163e..8511aa7 100755 --- a/STM32CubeMX/SCSI2SD-V6/Drivers/STM32F2xx_HAL_Driver/Src/stm32f2xx_hal_sd.c +++ b/STM32CubeMX/SCSI2SD-V6/Drivers/STM32F2xx_HAL_Driver/Src/stm32f2xx_hal_sd.c @@ -1048,6 +1048,27 @@ HAL_SD_ErrorTypedef HAL_SD_WriteBlocks_DMA(SD_HandleTypeDef *hsd, uint32_t *pWri } else { + /* MM: Prepare for write */ + /* Set Block Size for Card */ + sdio_cmdinitstructure.Argument = (uint32_t)(hsd->RCA << 16); + sdio_cmdinitstructure.CmdIndex = SD_CMD_APP_CMD; + SDIO_SendCommand(hsd->Instance, &sdio_cmdinitstructure); + errorstate = SD_CmdResp1Error(hsd, SD_CMD_APP_CMD); + if (errorstate != SD_OK) + { + return errorstate; + } + sdio_cmdinitstructure.Argument = (uint32_t)NumberOfBlocks; + sdio_cmdinitstructure.CmdIndex = SD_CMD_SET_BLOCK_COUNT; + SDIO_SendCommand(hsd->Instance, &sdio_cmdinitstructure); + errorstate = SD_CmdResp1Error(hsd, SD_CMD_SET_BLOCK_COUNT); + if (errorstate != SD_OK) + { + return errorstate; + } + + /* /MM */ + /* Send CMD25 WRITE_MULT_BLOCK with argument data address */ sdio_cmdinitstructure.CmdIndex = SD_CMD_WRITE_MULT_BLOCK; }