Tidy up commented DMA init code

pull/7/head
Robert Fisk 9 years ago
parent dda307dbe5
commit 431a527e24

@ -87,39 +87,6 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
//Interrupt-based SPI now! //Interrupt-based SPI now!
HAL_NVIC_SetPriority(SPI1_IRQn, INT_PRIORITY_SPI, 0); HAL_NVIC_SetPriority(SPI1_IRQn, INT_PRIORITY_SPI, 0);
HAL_NVIC_EnableIRQ(SPI1_IRQn); HAL_NVIC_EnableIRQ(SPI1_IRQn);
// /* Peripheral DMA init*/
// hdma_spi1_rx.Instance = DMA2_Stream2;
// hdma_spi1_rx.Init.Channel = DMA_CHANNEL_3;
// hdma_spi1_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
// hdma_spi1_rx.Init.PeriphInc = DMA_PINC_DISABLE;
// hdma_spi1_rx.Init.MemInc = DMA_MINC_ENABLE;
// hdma_spi1_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
// hdma_spi1_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
// hdma_spi1_rx.Init.Mode = DMA_NORMAL;
// hdma_spi1_rx.Init.Priority = DMA_PRIORITY_MEDIUM;
// hdma_spi1_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
// HAL_DMA_Init(&hdma_spi1_rx);
// __HAL_LINKDMA(hspi,hdmarx,hdma_spi1_rx);
//
// hdma_spi1_tx.Instance = DMA2_Stream3;
// hdma_spi1_tx.Init.Channel = DMA_CHANNEL_3;
// hdma_spi1_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
// hdma_spi1_tx.Init.PeriphInc = DMA_PINC_DISABLE;
// hdma_spi1_tx.Init.MemInc = DMA_MINC_ENABLE;
// hdma_spi1_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
// hdma_spi1_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
// hdma_spi1_tx.Init.Mode = DMA_NORMAL;
// hdma_spi1_tx.Init.Priority = DMA_PRIORITY_MEDIUM;
// hdma_spi1_tx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
// HAL_DMA_Init(&hdma_spi1_tx);
// __HAL_LINKDMA(hspi,hdmatx,hdma_spi1_tx);
//
// /* DMA interrupt init */
// HAL_NVIC_SetPriority(DMA2_Stream2_IRQn, INT_PRIORITY_SPI_DMA, 0);
// HAL_NVIC_EnableIRQ(DMA2_Stream2_IRQn);
// HAL_NVIC_SetPriority(DMA2_Stream3_IRQn, INT_PRIORITY_SPI_DMA, 0);
// HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn);
} }
} }
@ -137,10 +104,6 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
PA7 ------> SPI1_MOSI PA7 ------> SPI1_MOSI
*/ */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
/* Peripheral DMA DeInit*/
// HAL_DMA_DeInit(hspi->hdmarx);
// HAL_DMA_DeInit(hspi->hdmatx);
} }
} }

@ -68,22 +68,6 @@ void SysTick_Handler(void)
/* please refer to the startup file (startup_stm32f4xx.s). */ /* please refer to the startup file (startup_stm32f4xx.s). */
/******************************************************************************/ /******************************************************************************/
///**
//* @brief This function handles DMA2 Stream2 global interrupt.
//*/
//void DMA2_Stream2_IRQHandler(void)
//{
// HAL_DMA_IRQHandler(&hdma_spi1_rx);
//}
//
///**
//* @brief This function handles DMA2 Stream3 global interrupt.
//*/
//void DMA2_Stream3_IRQHandler(void)
//{
// HAL_DMA_IRQHandler(&hdma_spi1_tx);
//}
void SPI1_IRQHandler(void) void SPI1_IRQHandler(void)
{ {
@ -93,9 +77,6 @@ void SPI1_IRQHandler(void)
} }
/**
* @brief This function handles USB On The Go FS global interrupt.
*/
void OTG_FS_IRQHandler(void) void OTG_FS_IRQHandler(void)
{ {
HAL_HCD_IRQHandler(&hhcd_USB_OTG_FS); HAL_HCD_IRQHandler(&hhcd_USB_OTG_FS);

@ -99,40 +99,6 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
//Interrupt-based SPI now! //Interrupt-based SPI now!
HAL_NVIC_SetPriority(SPI1_IRQn, INT_PRIORITY_SPI, 0); HAL_NVIC_SetPriority(SPI1_IRQn, INT_PRIORITY_SPI, 0);
HAL_NVIC_EnableIRQ(SPI1_IRQn); HAL_NVIC_EnableIRQ(SPI1_IRQn);
// //Prepare Tx DMA stream
// hspi->hdmatx = &spiTxDmaHandle;
// spiTxDmaHandle.Instance = DMA2_Stream3;
// spiTxDmaHandle.Parent = hspi;
// spiTxDmaHandle.Init.Channel = DMA_CHANNEL_3;
// spiTxDmaHandle.Init.Direction = DMA_MEMORY_TO_PERIPH;
// spiTxDmaHandle.Init.PeriphInc = DMA_PINC_DISABLE;
// spiTxDmaHandle.Init.MemInc = DMA_MINC_ENABLE;
// spiTxDmaHandle.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; //DMA_PDATAALIGN_BYTE;
// spiTxDmaHandle.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD; //DMA_MDATAALIGN_BYTE;
// spiTxDmaHandle.Init.Mode = DMA_NORMAL;
// spiTxDmaHandle.Init.Priority = DMA_PRIORITY_MEDIUM;
// spiTxDmaHandle.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
// HAL_DMA_Init(&spiTxDmaHandle);
// HAL_NVIC_SetPriority(DMA2_Stream3_IRQn, INT_PRIORITY_SPI_DMA, 0);
// HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn);
//
// //Prepare Rx DMA stream
// hspi->hdmarx = &spiRxDmaHandle;
// spiRxDmaHandle.Instance = DMA2_Stream2;
// spiRxDmaHandle.Parent = hspi;
// spiRxDmaHandle.Init.Channel = DMA_CHANNEL_3;
// spiRxDmaHandle.Init.Direction = DMA_PERIPH_TO_MEMORY;
// spiRxDmaHandle.Init.PeriphInc = DMA_PINC_DISABLE;
// spiRxDmaHandle.Init.MemInc = DMA_MINC_ENABLE;
// spiRxDmaHandle.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; //DMA_PDATAALIGN_BYTE;
// spiRxDmaHandle.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD; //DMA_MDATAALIGN_BYTE;
// spiRxDmaHandle.Init.Mode = DMA_NORMAL;
// spiRxDmaHandle.Init.Priority = DMA_PRIORITY_MEDIUM;
// spiRxDmaHandle.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
// HAL_DMA_Init(&spiRxDmaHandle);
// HAL_NVIC_SetPriority(DMA2_Stream2_IRQn, INT_PRIORITY_SPI_DMA, 0);
// HAL_NVIC_EnableIRQ(DMA2_Stream2_IRQn);
} }
} }
@ -152,11 +118,6 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
PA7 ------> SPI1_MOSI PA7 ------> SPI1_MOSI
*/ */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
// HAL_DMA_DeInit(&spiTxDmaHandle);
// HAL_DMA_DeInit(&spiRxDmaHandle);
//
// HAL_NVIC_DisableIRQ(DMA2_Stream3_IRQn);
// HAL_NVIC_DisableIRQ(DMA2_Stream2_IRQn);
} }
} }

@ -74,20 +74,6 @@ void OTG_FS_IRQHandler(void)
HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS); HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS);
} }
//void DMA2_Stream2_IRQHandler(void)
//{
// //SPI_DMA_ACTIVE_ON;
// HAL_DMA_IRQHandler(&spiRxDmaHandle);
// //SPI_DMA_ACTIVE_OFF;
//}
//
//void DMA2_Stream3_IRQHandler(void)
//{
// //SPI_DMA_ACTIVE_ON;
// HAL_DMA_IRQHandler(&spiTxDmaHandle);
// //SPI_DMA_ACTIVE_OFF;
//}
void EXTI3_IRQHandler(void) void EXTI3_IRQHandler(void)
{ {
__HAL_GPIO_EXTI_CLEAR_IT(DOWNSTREAM_TX_OK_PIN); __HAL_GPIO_EXTI_CLEAR_IT(DOWNSTREAM_TX_OK_PIN);
@ -97,6 +83,8 @@ void EXTI3_IRQHandler(void)
///////////////////////// /////////////////////////
//As SPI DMA doesn't work when the USB peripheral is active,
//we are forced to use interrupts. This must be higher priority than USB.
void SPI1_IRQHandler(void) void SPI1_IRQHandler(void)
{ {
SPI_INT_ACTIVE_ON; SPI_INT_ACTIVE_ON;

Loading…
Cancel
Save