/**
  * @brief  Initializes the Global MSP.
  * @param  None
  * @retval None
  */
void HAL_MspInit(void)
{
  /* NOTE : This function is generated automatically by MicroXplorer and eventually  
  modified by the user
  */
  /* Enable UART 4 clock  */
  __UART4_CLK_ENABLE();
  
  /* RNG Periph clock enable */
  __RNG_CLK_ENABLE();
  
#ifdef USE_STM32F4XX_HW_CRYPTO   
  /* Enable CRYP clock */
  __CRYP_CLK_ENABLE();
    
  /* Enable Hash clock */
  __HASH_CLK_ENABLE();

#endif
  
}
/**
  * @brief  Initializes the CRYP MSP.
  *        This function configures the hardware resources used in this example: 
  *           - CRYP's clock enable
  * @param  hcryp: CRYP handle
  * @retval None
  */
void HAL_CRYP_MspInit(CRYP_HandleTypeDef *hcryp)
{
  /* Enable CRYP clock */
  __CRYP_CLK_ENABLE(); 
}
Beispiel #3
0
void HAL_CRYP_MspInit(CRYP_HandleTypeDef *hcryp)
{
  static  DMA_HandleTypeDef   hdmaIn;
  static  DMA_HandleTypeDef   hdmaOut;

  /* Enable CRYP clock */
  __CRYP_CLK_ENABLE();
  
  /* Force the CRYP Periheral Clock Reset */  
  __CRYP_FORCE_RESET(); 
  
  /* Release the CRYP Periheral Clock Reset */  
  __CRYP_RELEASE_RESET();
  
  /* Enable and set CRYP Interrupt to the highest priority */
  HAL_NVIC_SetPriority(AES_RNG_LPUART1_IRQn, 0, 0);
  HAL_NVIC_EnableIRQ(AES_RNG_LPUART1_IRQn);
  
    /* Enable DMA1 clocks */
  __DMA1_CLK_ENABLE();
  __DMA1_FORCE_RESET();
  __DMA1_RELEASE_RESET();
  
  /***************** Configure common DMA In parameters ***********************/
  hdmaIn.Instance                 = DMA1_Channel1;
  hdmaIn.Init.Direction           = DMA_MEMORY_TO_PERIPH;
  hdmaIn.Init.PeriphInc           = DMA_PINC_DISABLE;
  hdmaIn.Init.MemInc              = DMA_MINC_ENABLE;
  hdmaIn.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
  hdmaIn.Init.MemDataAlignment    = DMA_MDATAALIGN_WORD;
  hdmaIn.Init.Mode                = DMA_NORMAL;
  hdmaIn.Init.Priority            = DMA_PRIORITY_MEDIUM;
  hdmaIn.Init.Request             = DMA_REQUEST_11;
  
  /* Associate the DMA handle */
  __HAL_LINKDMA(hcryp, hdmain, hdmaIn);
  
  /* Deinitialize the Stream for new transfer */
  HAL_DMA_DeInit(hcryp->hdmain);
  
  /* Configure the DMA Stream */
  HAL_DMA_Init(hcryp->hdmain);      
  
  /* NVIC configuration for DMA Input data interrupt */
  HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 1, 0);
  HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
  
  /***************** Configure common DMA Out parameters **********************/
  hdmaOut.Instance                 = DMA1_Channel3;
  hdmaOut.Init.Direction           = DMA_PERIPH_TO_MEMORY;
  hdmaOut.Init.PeriphInc           = DMA_PINC_DISABLE;
  hdmaOut.Init.MemInc              = DMA_MINC_ENABLE;
  hdmaOut.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
  hdmaOut.Init.MemDataAlignment    = DMA_MDATAALIGN_WORD;
  hdmaOut.Init.Mode                = DMA_NORMAL;
  hdmaOut.Init.Priority            = DMA_PRIORITY_VERY_HIGH;
  hdmaOut.Init.Request             = DMA_REQUEST_11;
  
  /* Associate the DMA handle */
  __HAL_LINKDMA(hcryp, hdmaout, hdmaOut);
  
  /* Deinitialize the Stream for new processing */
  HAL_DMA_DeInit(&hdmaOut);
  
  /* Configure the DMA Stream */
  HAL_DMA_Init(&hdmaOut);
  
  /* NVIC configuration for DMA output data interrupt */
  /* Already configured */
  HAL_NVIC_SetPriority(DMA1_Channel2_3_IRQn, 0, 0);
  HAL_NVIC_EnableIRQ(DMA1_Channel2_3_IRQn);
  
}