The non-active MxAR is determined by reading the CT bit of the CR.
A macro to read the CT bit could be added in os\hal\ports\STM32\LLD\DMAv2\stm32_dma.h and become part of the standard Chibios DMA macro set.
Suggested implementation...
Code: Select all
/**
* @brief DMA stream current target.
* @note This function can be invoked in both ISR or thread context.
* @pre The stream must have been allocated using @p dmaStreamAllocate().
* @post After use the stream can be released using @p dmaStreamRelease().
*
* @param[in] dmastp pointer to a stm32_dma_stream_t structure
* @return Current memory target index
*
* @special
*/
#define dmaStreamGetCurrentTarget(dmastp) \
((uint8_t)(((dmastp)->stream->CR >> DMA_SxCR_CT_Pos) & 1U))