| 38 | } |
| 39 | |
| 40 | void 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 | |
| 73 | void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset) |
| 74 | { |
no outgoing calls
no test coverage detected