MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / NVIC_Init

Function NVIC_Init

bsp/CME_M7/StdPeriph_Driver/src/cmem7_misc.c:40–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct)
41{
42 uint32_t tmppriority = 0x00, tmppre = 0x00, tmpsub = 0x0F;
43
44 /* Check the parameters */
45 assert_param(IS_NVIC_PREEMPTION_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority));
46 assert_param(IS_NVIC_SUB_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelSubPriority));
47
48 if (NVIC_InitStruct->NVIC_IRQChannelCmd != FALSE)
49 {
50 /* Compute the Corresponding IRQ Priority --------------------------------*/
51 tmppriority = (0x700 - ((SCB->AIRCR) & (uint32_t)0x700))>> 0x08;
52 tmppre = (0x4 - tmppriority);
53 tmpsub = tmpsub >> tmppriority;
54
55 tmppriority = (uint32_t)NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority << tmppre;
56 tmppriority |= NVIC_InitStruct->NVIC_IRQChannelSubPriority & tmpsub;
57 tmppriority = tmppriority << 0x04;
58
59 NVIC->IP[NVIC_InitStruct->NVIC_IRQChannel] = tmppriority;
60
61 /* Enable the Selected IRQ Channels --------------------------------------*/
62 NVIC->ISER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] =
63 (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F);
64 }
65 else
66 {
67 /* Disable the Selected IRQ Channels -------------------------------------*/
68 NVIC->ICER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] =
69 (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F);
70 }
71}
72
73void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset)
74{

Callers 5

usbhs_common_initFunction · 0.50
usb_dc_low_level_deinitFunction · 0.50
usb_hc_low_level_deinitFunction · 0.50
NVIC_ConfigurationFunction · 0.50
CME_M7_controlFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected