[H7] Use channel member for H7 DMA request (#8382)

[H7] Use channel member for H7 DMA request
This commit is contained in:
Michael Keller 2019-06-07 09:16:28 +12:00 committed by GitHub
commit 62a815bb10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 23 deletions

View File

@ -63,12 +63,9 @@ typedef struct adcDevice_s {
ADC_TypeDef* ADCx;
rccPeriphTag_t rccADC;
#if !defined(USE_DMA_SPEC)
#if defined(STM32F4) || defined(STM32F7)
#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7)
DMA_Stream_TypeDef* DMAy_Streamx;
uint32_t channel;
#elif defined(STM32H7)
DMA_Stream_TypeDef* DMAy_Streamx;
uint32_t request;
#else
DMA_Channel_TypeDef* DMAy_Channelx;
#endif

View File

@ -83,19 +83,19 @@ const adcDevice_t adcHardware[ADCDEV_COUNT] = {
.ADCx = ADC1_INSTANCE,
.rccADC = RCC_AHB1(ADC12),
.DMAy_Streamx = ADC1_DMA_STREAM,
.request = DMA_REQUEST_ADC1,
.channel = DMA_REQUEST_ADC1,
},
{ .ADCx = ADC2_INSTANCE,
.rccADC = RCC_AHB1(ADC12),
.DMAy_Streamx = ADC2_DMA_STREAM,
.request = DMA_REQUEST_ADC2,
.channel = DMA_REQUEST_ADC2,
},
// ADC3 can be serviced by BDMA also, but we settle for DMA1 or 2 (for now).
{
.ADCx = ADC3_INSTANCE,
.rccADC = RCC_AHB4(ADC3),
.DMAy_Streamx = ADC3_DMA_STREAM,
.request = DMA_REQUEST_ADC3,
.channel = DMA_REQUEST_ADC3,
}
};
@ -361,7 +361,7 @@ void adcInit(const adcConfig_t *config)
dmaInit(dmaIdentifier, OWNER_ADC, RESOURCE_INDEX(dev));
adc->DmaHandle.Instance = adc->DMAy_Streamx;
adc->DmaHandle.Init.Request = adc->request;
adc->DmaHandle.Init.Request = adc->channel;
adc->DmaHandle.Init.Direction = DMA_PERIPH_TO_MEMORY;
adc->DmaHandle.Init.PeriphInc = DMA_PINC_DISABLE;
adc->DmaHandle.Init.MemInc = DMA_MINC_ENABLE;

View File

@ -77,13 +77,8 @@ bool ws2811LedStripHardwareInit(ioTag_t ioTag)
uint32_t dmaChannel = dmaSpec->channel;
#else
dmaStream_t *dmaRef = timerHardware->dmaRef;
#ifdef STM32H7
uint32_t dmaChannel = timerHardware->dmaRequest;
#else
uint32_t dmaChannel = timerHardware->dmaChannel;
#endif
#endif
if (dmaRef == NULL) {
return false;

View File

@ -380,7 +380,7 @@ P - High - High -
motor->dmaBuffer[DSHOT_DMA_BUFFER_SIZE-1] = 0; // XXX Is this necessary?
motor->hdma_tim.Instance = timerHardware->dmaRef;
motor->hdma_tim.Init.Request = timerHardware->dmaRequest;
motor->hdma_tim.Init.Request = timerHardware->dmaChannel;
/* Link hdma_tim to hdma[x] (channelx) */
__HAL_LINKDMA(&motor->TimHandle, hdma[motor->timerDmaIndex], motor->hdma_tim);

View File

@ -121,12 +121,13 @@ typedef struct timerHardware_s {
DMA_Channel_TypeDef *dmaRefConfigured;
#endif
#else
#if defined(STM32F4) || defined(STM32F7)
#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7)
DMA_Stream_TypeDef *dmaRef;
uint32_t dmaChannel;
#elif defined(STM32H7)
DMA_Stream_TypeDef *dmaRef;
uint8_t dmaRequest;
// For F4 and F7, dmaChannel is channel for DMA1 or DMA2.
// For H7, dmaChannel is DMA request number for DMAMUX
uint32_t dmaChannel; // XXX Can be much smaller (e.g. uint8_t)
#else
DMA_Channel_TypeDef *dmaRef;
#endif

View File

@ -89,11 +89,7 @@ void transponderIrHardwareInit(ioTag_t ioTag, transponder_t *transponder)
uint32_t dmaChannel = dmaSpec->channel;
#else
dmaStream_t *dmaRef = timerHardware->dmaRef;
#ifdef STM32H7
uint32_t dmaChannel = timerHardware->dmaRequest;
#else
uint32_t dmaChannel = timerHardware->dmaChannel;
#endif
#endif
if (dmaRef == NULL) {