@@ -363,8 +363,20 @@ static void sdio_write_task(void const* pvParameters)
363
363
do {
364
364
len_to_send = data_left ;
365
365
366
+ #if H_SDIO_TX_BLOCK_ONLY_XFER
367
+ /* Extend the transfer length to do block only transfers.
368
+ * This is safe as slave only reads up to data_left, which
369
+ * is not changed here. Rest of data is discarded by
370
+ * slave.
371
+ */
372
+ uint32_t block_send_len = ((len_to_send + ESP_BLOCK_SIZE - 1 ) / ESP_BLOCK_SIZE ) * ESP_BLOCK_SIZE ;
373
+
374
+ ret = g_h .funcs -> _h_sdio_write_block (ESP_SLAVE_CMD53_END_ADDR - data_left ,
375
+ pos , block_send_len , ACQUIRE_LOCK );
376
+ #else
366
377
ret = g_h .funcs -> _h_sdio_write_block (ESP_SLAVE_CMD53_END_ADDR - data_left ,
367
378
pos , len_to_send , ACQUIRE_LOCK );
379
+ #endif
368
380
if (ret ) {
369
381
ESP_LOGE (TAG , "%s: %d: Failed to send data: %d %ld %ld" , __func__ ,
370
382
retries , ret , len_to_send , data_left );
@@ -535,6 +547,11 @@ static esp_err_t sdio_push_data_to_queue(uint8_t * buf, uint32_t buf_len)
535
547
// return a buffer big enough to contain the data
536
548
static uint8_t * sdio_rx_get_buffer (uint32_t len )
537
549
{
550
+ #if H_SDIO_RX_BLOCK_ONLY_XFER
551
+ // we need to allocate enough memory to hold the padded data
552
+ len = ((len + ESP_BLOCK_SIZE - 1 ) / ESP_BLOCK_SIZE ) * ESP_BLOCK_SIZE ;
553
+ #endif
554
+
538
555
// (re)allocate a buffer big enough to contain the data stream
539
556
if (len > recv_buf_size ) {
540
557
if (recv_buf ) {
@@ -703,9 +720,20 @@ static void sdio_read_task(void const* pvParameters)
703
720
do {
704
721
len_to_read = data_left ;
705
722
723
+ #if H_SDIO_RX_BLOCK_ONLY_XFER
724
+ /* Extend the transfer length to do block only transfers.
725
+ * This is safe as slave will pad data with 0, which we
726
+ * will ignore.
727
+ */
728
+ uint32_t block_read_len = ((len_to_read + ESP_BLOCK_SIZE - 1 ) / ESP_BLOCK_SIZE ) * ESP_BLOCK_SIZE ;
729
+ ret = g_h .funcs -> _h_sdio_read_block (
730
+ ESP_SLAVE_CMD53_END_ADDR - data_left ,
731
+ pos , block_read_len , ACQUIRE_LOCK );
732
+ #else
706
733
ret = g_h .funcs -> _h_sdio_read_block (
707
734
ESP_SLAVE_CMD53_END_ADDR - data_left ,
708
735
pos , len_to_read , ACQUIRE_LOCK );
736
+ #endif
709
737
if (ret ) {
710
738
ESP_LOGE (TAG , "%s: Failed to read data - %d %ld %ld" ,
711
739
__func__ , ret , len_to_read , data_left );
0 commit comments