@@ -473,8 +473,8 @@ static int32_t hc32_spi_dma_trans(struct hc32_spi_config *spi_config, const uint
473473 while ((RESET == DMA_GetTransCompleteStatus (DmaInstance , DmaFlag )) &&
474474 (u32TimeoutCnt < spi_config -> timeout ))
475475 {
476- rt_thread_mdelay (1 );
477- u32TimeoutCnt ++ ;
476+ // rt_thread_mdelay(1);
477+ // u32TimeoutCnt++;
478478 }
479479 if (u32TimeoutCnt >= spi_config -> timeout )
480480 {
@@ -544,7 +544,7 @@ static rt_ssize_t hc32_spi_xfer(struct rt_spi_device *device, struct rt_spi_mess
544544 if (message -> send_buf && message -> recv_buf )
545545 {
546546 hc32_spi_set_trans_mode (spi_instance , SPI_FULL_DUPLEX );
547- if ((spi_drv -> spi_dma_flag & RT_DEVICE_FLAG_DMA_TX ) && (spi_drv -> spi_dma_flag & RT_DEVICE_FLAG_DMA_RX ))
547+ if ((spi_drv -> spi_dma_flag & RT_DEVICE_FLAG_DMA_TX ) && (spi_drv -> spi_dma_flag & RT_DEVICE_FLAG_DMA_RX ) && ( send_length > 32 ) )
548548 {
549549 state = hc32_spi_dma_trans (spi_drv -> config , send_buf , recv_buf , send_length );
550550 }
@@ -557,7 +557,7 @@ static rt_ssize_t hc32_spi_xfer(struct rt_spi_device *device, struct rt_spi_mess
557557 else if (message -> send_buf )
558558 {
559559 hc32_spi_set_trans_mode (spi_instance , SPI_SEND_ONLY );
560- if (spi_drv -> spi_dma_flag & RT_DEVICE_FLAG_DMA_TX )
560+ if (( spi_drv -> spi_dma_flag & RT_DEVICE_FLAG_DMA_TX ) && ( send_length > 32 ) )
561561 {
562562 state = hc32_spi_dma_trans (spi_drv -> config , send_buf , RT_NULL , send_length );
563563 }
@@ -601,8 +601,8 @@ static rt_ssize_t hc32_spi_xfer(struct rt_spi_device *device, struct rt_spi_mess
601601 while ((RESET == SPI_GetStatus (spi_instance , SPI_FLAG_IDLE )) &&
602602 (u32TimeoutCnt < spi_drv -> config -> timeout ))
603603 {
604- rt_thread_mdelay (1 );
605- u32TimeoutCnt ++ ;
604+ // rt_thread_mdelay(1);
605+ // u32TimeoutCnt++;
606606 }
607607 if (u32TimeoutCnt >= spi_drv -> config -> timeout )
608608 {
0 commit comments