[H7] Use channel member for H7 DMA request
This commit is contained in:
parent
d486c47bc1
commit
e18c4ec662
|
@ -63,12 +63,9 @@ typedef struct adcDevice_s {
|
||||||
ADC_TypeDef* ADCx;
|
ADC_TypeDef* ADCx;
|
||||||
rccPeriphTag_t rccADC;
|
rccPeriphTag_t rccADC;
|
||||||
#if !defined(USE_DMA_SPEC)
|
#if !defined(USE_DMA_SPEC)
|
||||||
#if defined(STM32F4) || defined(STM32F7)
|
#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7)
|
||||||
DMA_Stream_TypeDef* DMAy_Streamx;
|
DMA_Stream_TypeDef* DMAy_Streamx;
|
||||||
uint32_t channel;
|
uint32_t channel;
|
||||||
#elif defined(STM32H7)
|
|
||||||
DMA_Stream_TypeDef* DMAy_Streamx;
|
|
||||||
uint32_t request;
|
|
||||||
#else
|
#else
|
||||||
DMA_Channel_TypeDef* DMAy_Channelx;
|
DMA_Channel_TypeDef* DMAy_Channelx;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -83,19 +83,19 @@ const adcDevice_t adcHardware[ADCDEV_COUNT] = {
|
||||||
.ADCx = ADC1_INSTANCE,
|
.ADCx = ADC1_INSTANCE,
|
||||||
.rccADC = RCC_AHB1(ADC12),
|
.rccADC = RCC_AHB1(ADC12),
|
||||||
.DMAy_Streamx = ADC1_DMA_STREAM,
|
.DMAy_Streamx = ADC1_DMA_STREAM,
|
||||||
.request = DMA_REQUEST_ADC1,
|
.channel = DMA_REQUEST_ADC1,
|
||||||
},
|
},
|
||||||
{ .ADCx = ADC2_INSTANCE,
|
{ .ADCx = ADC2_INSTANCE,
|
||||||
.rccADC = RCC_AHB1(ADC12),
|
.rccADC = RCC_AHB1(ADC12),
|
||||||
.DMAy_Streamx = ADC2_DMA_STREAM,
|
.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).
|
// ADC3 can be serviced by BDMA also, but we settle for DMA1 or 2 (for now).
|
||||||
{
|
{
|
||||||
.ADCx = ADC3_INSTANCE,
|
.ADCx = ADC3_INSTANCE,
|
||||||
.rccADC = RCC_AHB4(ADC3),
|
.rccADC = RCC_AHB4(ADC3),
|
||||||
.DMAy_Streamx = ADC3_DMA_STREAM,
|
.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));
|
dmaInit(dmaIdentifier, OWNER_ADC, RESOURCE_INDEX(dev));
|
||||||
|
|
||||||
adc->DmaHandle.Instance = adc->DMAy_Streamx;
|
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.Direction = DMA_PERIPH_TO_MEMORY;
|
||||||
adc->DmaHandle.Init.PeriphInc = DMA_PINC_DISABLE;
|
adc->DmaHandle.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||||
adc->DmaHandle.Init.MemInc = DMA_MINC_ENABLE;
|
adc->DmaHandle.Init.MemInc = DMA_MINC_ENABLE;
|
||||||
|
|
|
@ -77,13 +77,8 @@ bool ws2811LedStripHardwareInit(ioTag_t ioTag)
|
||||||
uint32_t dmaChannel = dmaSpec->channel;
|
uint32_t dmaChannel = dmaSpec->channel;
|
||||||
#else
|
#else
|
||||||
dmaStream_t *dmaRef = timerHardware->dmaRef;
|
dmaStream_t *dmaRef = timerHardware->dmaRef;
|
||||||
#ifdef STM32H7
|
|
||||||
uint32_t dmaChannel = timerHardware->dmaRequest;
|
|
||||||
#else
|
|
||||||
uint32_t dmaChannel = timerHardware->dmaChannel;
|
uint32_t dmaChannel = timerHardware->dmaChannel;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if (dmaRef == NULL) {
|
if (dmaRef == NULL) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -380,7 +380,7 @@ P - High - High -
|
||||||
motor->dmaBuffer[DSHOT_DMA_BUFFER_SIZE-1] = 0; // XXX Is this necessary?
|
motor->dmaBuffer[DSHOT_DMA_BUFFER_SIZE-1] = 0; // XXX Is this necessary?
|
||||||
|
|
||||||
motor->hdma_tim.Instance = timerHardware->dmaRef;
|
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) */
|
/* Link hdma_tim to hdma[x] (channelx) */
|
||||||
__HAL_LINKDMA(&motor->TimHandle, hdma[motor->timerDmaIndex], motor->hdma_tim);
|
__HAL_LINKDMA(&motor->TimHandle, hdma[motor->timerDmaIndex], motor->hdma_tim);
|
||||||
|
|
|
@ -121,12 +121,13 @@ typedef struct timerHardware_s {
|
||||||
DMA_Channel_TypeDef *dmaRefConfigured;
|
DMA_Channel_TypeDef *dmaRefConfigured;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#if defined(STM32F4) || defined(STM32F7)
|
#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7)
|
||||||
DMA_Stream_TypeDef *dmaRef;
|
DMA_Stream_TypeDef *dmaRef;
|
||||||
uint32_t dmaChannel;
|
|
||||||
#elif defined(STM32H7)
|
// For F4 and F7, dmaChannel is channel for DMA1 or DMA2.
|
||||||
DMA_Stream_TypeDef *dmaRef;
|
// For H7, dmaChannel is DMA request number for DMAMUX
|
||||||
uint8_t dmaRequest;
|
|
||||||
|
uint32_t dmaChannel; // XXX Can be much smaller (e.g. uint8_t)
|
||||||
#else
|
#else
|
||||||
DMA_Channel_TypeDef *dmaRef;
|
DMA_Channel_TypeDef *dmaRef;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -89,11 +89,7 @@ void transponderIrHardwareInit(ioTag_t ioTag, transponder_t *transponder)
|
||||||
uint32_t dmaChannel = dmaSpec->channel;
|
uint32_t dmaChannel = dmaSpec->channel;
|
||||||
#else
|
#else
|
||||||
dmaStream_t *dmaRef = timerHardware->dmaRef;
|
dmaStream_t *dmaRef = timerHardware->dmaRef;
|
||||||
#ifdef STM32H7
|
|
||||||
uint32_t dmaChannel = timerHardware->dmaRequest;
|
|
||||||
#else
|
|
||||||
uint32_t dmaChannel = timerHardware->dmaChannel;
|
uint32_t dmaChannel = timerHardware->dmaChannel;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (dmaRef == NULL) {
|
if (dmaRef == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue