From f6818cce54b99eecfc0d67437095d5adb955ee2c Mon Sep 17 00:00:00 2001 From: Fredrik Thulin Date: Sun, 28 Jun 2015 16:12:46 +0200 Subject: Remove trailing whitespace and DOS line endings. --- src/entropy/stm32f4xx_hal_msp.c | 194 ++++++++++++++++++++-------------------- 1 file changed, 97 insertions(+), 97 deletions(-) (limited to 'src/entropy/stm32f4xx_hal_msp.c') diff --git a/src/entropy/stm32f4xx_hal_msp.c b/src/entropy/stm32f4xx_hal_msp.c index cf59a07..fc27e04 100644 --- a/src/entropy/stm32f4xx_hal_msp.c +++ b/src/entropy/stm32f4xx_hal_msp.c @@ -1,97 +1,97 @@ -#include "stm_init.h" -#include "stm32f4xx_hal.h" - -static void Error_Handler(void); -extern void HAL_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma); - -void HAL_TIM_IC_MspInit(TIM_HandleTypeDef* htim) -{ - if (htim->Instance == TIM2) { - /* Configure DMA input capturing. - * - * Amplified avalanche noise is present at pin PA1, - * which has Alternate Function TIM2_CH2. - * - * TIM2_CH2 is DMA1 stream 6, channel 3 according to Table 28 - * (DMA1 request mapping) in the reference manual (RM0368). - */ - __DMA1_CLK_ENABLE(); - __TIM2_CLK_ENABLE(); - __GPIOA_CLK_ENABLE(); - - hdma_tim.Instance = DMA1_Stream6; - - hdma_tim.Init.Channel = DMA_CHANNEL_3; - hdma_tim.Init.Direction = DMA_PERIPH_TO_MEMORY; - hdma_tim.Init.PeriphInc = DMA_PINC_DISABLE; - hdma_tim.Init.MemInc = DMA_MINC_ENABLE; - hdma_tim.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD; - hdma_tim.Init.MemDataAlignment = DMA_MDATAALIGN_WORD; - hdma_tim.Init.Mode = DMA_NORMAL; - hdma_tim.Init.Priority = DMA_PRIORITY_HIGH; - hdma_tim.Init.FIFOMode = DMA_FIFOMODE_DISABLE; - hdma_tim.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL; - hdma_tim.Init.MemBurst = DMA_MBURST_SINGLE; - hdma_tim.Init.PeriphBurst = DMA_PBURST_SINGLE; - - /* Link hdma_tim to hdma[2] (channel3) */ - __HAL_LINKDMA(htim, hdma[TIM_DMA_ID_CC2], hdma_tim); - - /* Initialize TIMx DMA handle */ - if (HAL_DMA_Init(&hdma_tim) != HAL_OK) { - Error_Handler(); - } - } -} - -void HAL_UART_MspInit(UART_HandleTypeDef* huart) -{ - GPIO_InitTypeDef GPIO_InitStruct; - - if (huart->Instance == USART1) { - /* Peripheral clock enable */ - __USART1_CLK_ENABLE(); - - /**USART1 GPIO Configuration - PA9 ------> USART1_TX - PA10 ------> USART1_RX - */ - GPIO_InitStruct.Pin = GPIO_PIN_9 | GPIO_PIN_10; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_PULLUP; - GPIO_InitStruct.Speed = GPIO_SPEED_FAST; - GPIO_InitStruct.Alternate = GPIO_AF7_USART1; - HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); - - /* NVIC for interrupt mode */ - HAL_NVIC_SetPriority(USART1_IRQn, 0, 1); - HAL_NVIC_EnableIRQ(USART1_IRQn); - } -} - -void HAL_UART_MspDeInit(UART_HandleTypeDef* huart) -{ - if (huart->Instance == USART1) { - /* Peripheral clock disable */ - __USART1_CLK_DISABLE(); - - /**USART1 GPIO Configuration - PA9 ------> USART1_TX - PA10 ------> USART1_RX - */ - HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9 | GPIO_PIN_10); - } -} - -/** - * @brief This function is executed in case of error occurrence. - * @param None - * @retval None - */ -static void Error_Handler(void) -{ - /* Turn on RED LED and then loop indefinitely */ - HAL_GPIO_WritePin(LED_PORT, LED_RED, GPIO_PIN_SET); - - while (1) { ; } -} +#include "stm_init.h" +#include "stm32f4xx_hal.h" + +static void Error_Handler(void); +extern void HAL_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma); + +void HAL_TIM_IC_MspInit(TIM_HandleTypeDef* htim) +{ + if (htim->Instance == TIM2) { + /* Configure DMA input capturing. + * + * Amplified avalanche noise is present at pin PA1, + * which has Alternate Function TIM2_CH2. + * + * TIM2_CH2 is DMA1 stream 6, channel 3 according to Table 28 + * (DMA1 request mapping) in the reference manual (RM0368). + */ + __DMA1_CLK_ENABLE(); + __TIM2_CLK_ENABLE(); + __GPIOA_CLK_ENABLE(); + + hdma_tim.Instance = DMA1_Stream6; + + hdma_tim.Init.Channel = DMA_CHANNEL_3; + hdma_tim.Init.Direction = DMA_PERIPH_TO_MEMORY; + hdma_tim.Init.PeriphInc = DMA_PINC_DISABLE; + hdma_tim.Init.MemInc = DMA_MINC_ENABLE; + hdma_tim.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD; + hdma_tim.Init.MemDataAlignment = DMA_MDATAALIGN_WORD; + hdma_tim.Init.Mode = DMA_NORMAL; + hdma_tim.Init.Priority = DMA_PRIORITY_HIGH; + hdma_tim.Init.FIFOMode = DMA_FIFOMODE_DISABLE; + hdma_tim.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL; + hdma_tim.Init.MemBurst = DMA_MBURST_SINGLE; + hdma_tim.Init.PeriphBurst = DMA_PBURST_SINGLE; + + /* Link hdma_tim to hdma[2] (channel3) */ + __HAL_LINKDMA(htim, hdma[TIM_DMA_ID_CC2], hdma_tim); + + /* Initialize TIMx DMA handle */ + if (HAL_DMA_Init(&hdma_tim) != HAL_OK) { + Error_Handler(); + } + } +} + +void HAL_UART_MspInit(UART_HandleTypeDef* huart) +{ + GPIO_InitTypeDef GPIO_InitStruct; + + if (huart->Instance == USART1) { + /* Peripheral clock enable */ + __USART1_CLK_ENABLE(); + + /**USART1 GPIO Configuration + PA9 ------> USART1_TX + PA10 ------> USART1_RX + */ + GPIO_InitStruct.Pin = GPIO_PIN_9 | GPIO_PIN_10; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_PULLUP; + GPIO_InitStruct.Speed = GPIO_SPEED_FAST; + GPIO_InitStruct.Alternate = GPIO_AF7_USART1; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + /* NVIC for interrupt mode */ + HAL_NVIC_SetPriority(USART1_IRQn, 0, 1); + HAL_NVIC_EnableIRQ(USART1_IRQn); + } +} + +void HAL_UART_MspDeInit(UART_HandleTypeDef* huart) +{ + if (huart->Instance == USART1) { + /* Peripheral clock disable */ + __USART1_CLK_DISABLE(); + + /**USART1 GPIO Configuration + PA9 ------> USART1_TX + PA10 ------> USART1_RX + */ + HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9 | GPIO_PIN_10); + } +} + +/** + * @brief This function is executed in case of error occurrence. + * @param None + * @retval None + */ +static void Error_Handler(void) +{ + /* Turn on RED LED and then loop indefinitely */ + HAL_GPIO_WritePin(LED_PORT, LED_RED, GPIO_PIN_SET); + + while (1) { ; } +} -- cgit v1.2.3