From 93d1085bb68b878b2fad2e04ec39717b3ef57de5 Mon Sep 17 00:00:00 2001 From: cfif Date: Tue, 16 Dec 2025 16:49:05 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Inc/fc7xxx_driver_dma.h | 2 ++ Src/fc7xxx_driver_dma.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Inc/fc7xxx_driver_dma.h b/Inc/fc7xxx_driver_dma.h index bc5243b..6fc1e8f 100644 --- a/Inc/fc7xxx_driver_dma.h +++ b/Inc/fc7xxx_driver_dma.h @@ -305,6 +305,8 @@ extern "C" { DMA_StatusType DMA_ModifyAddress(const DMA_InstanceType eDma_Instance, const DMA_ChannelType eChannel, const volatile void *pSrcBuffer, const volatile void *pDestBuffer); + DMA_StatusType DMA_ModifySize(const DMA_InstanceType eDma_Instance, const DMA_ChannelType eChannel, uint16_t u16LoopCnt); + /** * @brief Start the DMA channel transfer * diff --git a/Src/fc7xxx_driver_dma.c b/Src/fc7xxx_driver_dma.c index df65d5c..76882f4 100644 --- a/Src/fc7xxx_driver_dma.c +++ b/Src/fc7xxx_driver_dma.c @@ -666,6 +666,29 @@ void DMA_ConfigChainedTransfer(const DMA_InstanceType eDma_Instance, const DMA_C DMA_HWA_SetOuterLoopTrigChannel(pDma, (uint8_t)eChannel, pChainTransferCfg->u8ChainedChannel); } + + +DMA_StatusType DMA_ModifySize(const DMA_InstanceType eDma_Instance, const DMA_ChannelType eChannel, uint16_t u16LoopCnt) { + DEV_ASSERT(eDma_Instance < DMA_INSTANCE_MAX); + DEV_ASSERT(eChannel < DMA_CHANNEL_MAX); + + DMA_Type * aDma[] = DMA_BASE_PTRS; + DMA_Type *const pDma = aDma[eDma_Instance]; + DMA_StatusType ret; + + if (DMA_GetChannelStatus(eDma_Instance, eChannel) == DMA_RUNNING_STATUS_IDLE) + { + DMA_HWA_SetLoopCount(pDma, (uint8_t)eChannel, u16LoopCnt); + + ret = DMA_STATUS_SUCCESS; + } + else + { + ret = DMA_STATUS_BUSY; + } + return ret; +} + DMA_StatusType DMA_ModifyAddress(const DMA_InstanceType eDma_Instance, const DMA_ChannelType eChannel, const volatile void *pSrcBuffer, const volatile void *pDestBuffer) {