AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/ports/stm32f10x/drivers/src/stm32f10x_misc.c
void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct)
{
  uint32_t tmppriority = 0x00, tmppre = 0x00, tmpsub = 0x0F;

  /* Check the parameters */
  assert_param(IS_FUNCTIONAL_STATE(NVIC_InitStruct->NVIC_IRQChannelCmd));
  assert_param(IS_NVIC_PREEMPTION_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority));
  assert_param(IS_NVIC_SUB_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelSubPriority));

  if (NVIC_InitStruct->NVIC_IRQChannelCmd != DISABLE)
  {
    /* Compute the Corresponding IRQ Priority --------------------------------*/
    tmppriority = (0x700 - ((SCB->AIRCR) & (uint32_t)0x700))>> 0x08;
    tmppre = (0x4 - tmppriority);
    tmpsub = tmpsub >> tmppriority;

    tmppriority = (uint32_t)NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority << tmppre;
    tmppriority |=  NVIC_InitStruct->NVIC_IRQChannelSubPriority & tmpsub;
    tmppriority = tmppriority << 0x04;

    NVIC->IP[NVIC_InitStruct->NVIC_IRQChannel] = tmppriority;

    /* Enable the Selected IRQ Channels --------------------------------------*/
    NVIC->ISER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] =
      (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F);
  }
  else
  {
    /* Disable the Selected IRQ Channels -------------------------------------*/
    NVIC->ICER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] =
      (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F);
  }
}
/**
  * @brief  Initializes the NVIC peripheral according to the specified
  *   parameters in the NVIC_InitStruct.
  * @param  NVIC_InitStruct: pointer to a NVIC_InitTypeDef structure that contains
  *   the configuration information for the specified NVIC peripheral.
  * @retval None
  */
@brief  Initializes the NVIC peripheral according to the specified
parameters in the NVIC_InitStruct.
@param  NVIC_InitStruct: pointer to a NVIC_InitTypeDef structure that contains
the configuration information for the specified NVIC peripheral.
@retval None
@brief Initializes the NVIC peripheral according to the specified parameters in the NVIC_InitStruct . @param NVIC_InitStruct : pointer to a NVIC_InitTypeDef structure that contains the configuration information for the specified NVIC peripheral . @retval None
void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct)
{
  uint32_t tmppriority = 0x00, tmppre = 0x00, tmpsub = 0x0F;
  assert_param(IS_FUNCTIONAL_STATE(NVIC_InitStruct->NVIC_IRQChannelCmd));
  assert_param(IS_NVIC_PREEMPTION_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority));
  assert_param(IS_NVIC_SUB_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelSubPriority));
  if (NVIC_InitStruct->NVIC_IRQChannelCmd != DISABLE)
  {
    tmppriority = (0x700 - ((SCB->AIRCR) & (uint32_t)0x700))>> 0x08;
    tmppre = (0x4 - tmppriority);
    tmpsub = tmpsub >> tmppriority;
    tmppriority = (uint32_t)NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority << tmppre;
    tmppriority |=  NVIC_InitStruct->NVIC_IRQChannelSubPriority & tmpsub;
    tmppriority = tmppriority << 0x04;
    NVIC->IP[NVIC_InitStruct->NVIC_IRQChannel] = tmppriority;
    NVIC->ISER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] =
      (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F);
  }
  else
  {
    NVIC->ICER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] =
      (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F);
  }
}
void NVIC_Init ( NVIC_InitTypeDef * NVIC_InitStruct ) { uint32_t tmppriority = 0x00 , tmppre = 0x00 , tmpsub = 0x0F ; assert_param ( IS_FUNCTIONAL_STATE ( NVIC_InitStruct -> NVIC_IRQChannelCmd ) ) ; assert_param ( IS_NVIC_PREEMPTION_PRIORITY ( NVIC_InitStruct -> NVIC_IRQChannelPreemptionPriority ) ) ; assert_param ( IS_NVIC_SUB_PRIORITY ( NVIC_InitStruct -> NVIC_IRQChannelSubPriority ) ) ; if ( NVIC_InitStruct -> NVIC_IRQChannelCmd != DISABLE ) { tmppriority = ( 0x700 - ( ( SCB -> AIRCR ) & ( uint32_t ) 0x700 ) ) >> 0x08 ; tmppre = ( 0x4 - tmppriority ) ; tmpsub = tmpsub >> tmppriority ; tmppriority = ( uint32_t ) NVIC_InitStruct -> NVIC_IRQChannelPreemptionPriority << tmppre ; tmppriority |= NVIC_InitStruct -> NVIC_IRQChannelSubPriority & tmpsub ; tmppriority = tmppriority << 0x04 ; NVIC -> IP [ NVIC_InitStruct -> NVIC_IRQChannel ] = tmppriority ; NVIC -> ISER [ NVIC_InitStruct -> NVIC_IRQChannel >> 0x05 ] = ( uint32_t ) 0x01 << ( NVIC_InitStruct -> NVIC_IRQChannel & ( uint8_t ) 0x1F ) ; } else { NVIC -> ICER [ NVIC_InitStruct -> NVIC_IRQChannel >> 0x05 ] = ( uint32_t ) 0x01 << ( NVIC_InitStruct -> NVIC_IRQChannel & ( uint8_t ) 0x1F ) ; } }
@brief  Initializes the NVIC peripheral according to the specified
   parameters in the NVIC_InitStruct.
@brief Initializes the NVIC peripheral according to the specified parameters in the NVIC_InitStruct .
/* Check the parameters */ /* Compute the Corresponding IRQ Priority --------------------------------*/ /* Enable the Selected IRQ Channels --------------------------------------*/ /* Disable the Selected IRQ Channels -------------------------------------*/