📄 stm32f10x_nvic.lst
字号:
226 {
227 __RESETFAULTMASK();
228 }
229
230 /*******************************************************************************
231 * Function Name : NVIC_BASEPRICONFIG
232 * Description : The execution priority can be changed from 15 (lowest
233 configurable priority) to 1.
234 * Input : None
235 * Output : None
236 * Return : None
237 *******************************************************************************/
238 void NVIC_BASEPRICONFIG(u32 NewPriority)
239 {
240 /* Check the parameters */
241 assert(IS_NVIC_BASE_PRI(NewPriority));
242
243 __BASEPRICONFIG(NewPriority << 0x04);
244 }
245
246 /*******************************************************************************
247 * Function Name : NVIC_GetBASEPRI
248 * Description : Returns the BASEPRI mask value.
249 * Input : None
250 * Output : None
251 * Return : BASEPRI register value
252 *******************************************************************************/
253 u32 NVIC_GetBASEPRI(void)
254 {
255 return (__GetBASEPRI());
256 }
257
258 /*******************************************************************************
259 * Function Name : NVIC_GetCurrentPendingIRQChannel
260 * Description : Returns the current pending IRQ channel identifier.
261 * Input : None
262 * Output : None
263 * Return : Pending IRQ Channel Identifier.
264 *******************************************************************************/
265 u16 NVIC_GetCurrentPendingIRQChannel(void)
266 {
267 return ((u16)((SCB->IRQControlState & (u32)0x003FF000) >> 0x0C));
268 }
269
270 /*******************************************************************************
271 * Function Name : NVIC_GetIRQChannelPendingBitStatus
272 * Description : Checks whether the specified IRQ Channel pending bit is set
273 * or not.
274 * Input : - NVIC_IRQChannel: specifies the interrupt pending bit to check.
275 * Output : None
276 * Return : The new state of IRQ Channel pending bit(SET or RESET).
277 *******************************************************************************/
278 ITStatus NVIC_GetIRQChannelPendingBitStatus(u8 NVIC_IRQChannel)
279 {
280 ITStatus pendingirqstatus = RESET;
281 u32 tmp = 0x00;
282
283 /* Check the parameters */
284 assert(IS_NVIC_IRQ_CHANNEL(NVIC_IRQChannel));
285
286 tmp = ((u32)0x01 << (NVIC_IRQChannel & (u32)0x1F));
287
288 if (((NVIC->Set[(NVIC_IRQChannel >> 0x05)]) & tmp) == tmp)
289 {
290 pendingirqstatus = SET;
291 }
292 else
293 {
294 pendingirqstatus = RESET;
295 }
296 return pendingirqstatus;
297 }
298
299 /*******************************************************************************
300 * Function Name : NVIC_SetIRQChannelPendingBit
301 * Description : Sets the NVIC抯 interrupt pending bit.
302 * Input : - NVIC_IRQChannel: specifies the interrupt pending bit to Set.
303 * Output : None
304 * Return : None
305 *******************************************************************************/
306 void NVIC_SetIRQChannelPendingBit(u8 NVIC_IRQChannel)
307 {
308 /* Check the parameters */
309 assert(IS_NVIC_IRQ_CHANNEL(NVIC_IRQChannel));
310
311 *(u32*)0xE000EF00 = (u32)NVIC_IRQChannel;
312 }
313
314 /*******************************************************************************
315 * Function Name : NVIC_ClearIRQChannelPendingBit
316 * Description : Clears the NVIC抯 interrupt pending bit.
317 * Input : - NVIC_IRQChannel: specifies the interrupt pending bit to clear.
318 * Output : None
319 * Return : None
320 *******************************************************************************/
321 void NVIC_ClearIRQChannelPendingBit(u8 NVIC_IRQChannel)
322 {
323 /* Check the parameters */
324 assert(IS_NVIC_IRQ_CHANNEL(NVIC_IRQChannel));
325
326 NVIC->Clear[(NVIC_IRQChannel >> 0x05)] = (u32)0x01 << (NVIC_IRQChannel & (u32)0x1F);
327 }
328
329 /*******************************************************************************
330 * Function Name : NVIC_GetCurrentActiveHandler
331 * Description : Returns the current active Handler (IRQ Channel and
332 * SystemHandler) identifier.
333 * Input : None
334 * Output : None
335 * Return : Active Handler Identifier.
336 *******************************************************************************/
337 u16 NVIC_GetCurrentActiveHandler(void)
338 {
339 return ((u16)(SCB->IRQControlState & (u32)0x3FF));
340 }
341
342 /*******************************************************************************
343 * Function Name : NVIC_GetIRQChannelActiveBitStatus
344 * Description : Checks whether the specified IRQ Channel active bit is set
345 * or not.
346 * Input : - NVIC_IRQChannel: specifies the interrupt active bit to check.
347 * Output : None
348 * Return : The new state of IRQ Channel active bit(SET or RESET).
349 *******************************************************************************/
350 ITStatus NVIC_GetIRQChannelActiveBitStatus(u8 NVIC_IRQChannel)
351 {
352 ITStatus activeirqstatus = RESET;
353 u32 tmp = 0x00;
354
355 /* Check the parameters */
356 assert(IS_NVIC_IRQ_CHANNEL(NVIC_IRQChannel));
357
358 tmp = ((u32)0x01 << (NVIC_IRQChannel & (u32)0x1F));
359
360 if (((NVIC->Active[(NVIC_IRQChannel >> 0x05)]) & tmp) == tmp )
361 {
362 activeirqstatus = SET;
363 }
364 else
365 {
366 activeirqstatus = RESET;
367 }
368 return activeirqstatus;
369 }
370
371 /*******************************************************************************
372 * Function Name : NVIC_GetCPUID
373 * Description : Returns the ID number, the version number and the implementation
374 * details of the Cortex-M3 core.
375 * Input : None
376 * Output : None
377 * Return : CPU ID.
378 *******************************************************************************/
379 u32 NVIC_GetCPUID(void)
380 {
381 return (SCB->CPUID);
382 }
383
384 /*******************************************************************************
385 * Function Name : NVIC_SetVectorTable
386 * Description : Sets the vector table location and Offset.
387 * Input : - NVIC_VectTab: specifies if the vector table is in RAM or
388 * FLASH memory.
389 * This parameter can be one of the following values:
390 * - NVIC_VectTab_RAM
391 * - NVIC_VectTab_FLASH
392 * - Offset: Vector Table base offset field.
393 * This value must be a multiple of 0x100.
394 * Output : None
395 * Return : None
396 *******************************************************************************/
397 void NVIC_SetVectorTable(u32 NVIC_VectTab, u32 Offset)
398 {
399 /* Check the parameters */
400 assert(IS_NVIC_VECTTAB(NVIC_VectTab));
401 assert(IS_NVIC_OFFSET(Offset));
402
403 SCB->ExceptionTableOffset = NVIC_VectTab | (Offset & (u32)0x1FFFFF80);
404 }
405
406 /*******************************************************************************
407 * Function Name : NVIC_GenerateSystemReset
408 * Description : Generates a system reset.
409 * Input : None
410 * Output : None
411 * Return : None
412 *******************************************************************************/
413 void NVIC_GenerateSystemReset(void)
414 {
415 SCB->AIRC = AIRC_VECTKEY_MASK | (u32)0x04;
416 }
417
418 /*******************************************************************************
419 * Function Name : NVIC_GenerateCoreReset
420 * Description : Generates a Core (Core + NVIC) reset.
421 * Input : None
422 * Output : None
423 * Return : None
424 *******************************************************************************/
425 void NVIC_GenerateCoreReset(void)
426 {
427 SCB->AIRC = AIRC_VECTKEY_MASK | (u32)0x01;
428 }
429
430 /*******************************************************************************
431 * Function Name : NVIC_SystemLPConfig
432 * Description : Selects the condition for the system to enter low power mode.
433 * Input : - LowPowerMode: Specifies the new mode for the system to enter
434 * low power mode.
435 * This parameter can be one of the following values:
436 * - NVIC_LP_SEVONPEND
437 * - NVIC_LP_SLEEPDEEP
438 * - NVIC_LP_SLEEPONEXIT
439 * - NewState: new state of LP condition.
440 * This parameter can be: ENABLE or DISABLE.
441 * Output : None
442 * Return : None
443 *******************************************************************************/
444 void NVIC_SystemLPConfig(u8 LowPowerMode, FunctionalState NewState)
445 {
446 /* Check the parameters */
447 assert(IS_NVIC_LP(LowPowerMode));
448 assert(IS_FUNCTIONAL_STATE(NewState));
449
450 if (NewState != DISABLE)
451 {
452 SCB->SysCtrl |= LowPowerMode;
453 }
454 else
455 {
456 SCB->SysCtrl &= (u32)(~(u32)LowPowerMode);
457 }
458 }
459
460 /*******************************************************************************
461 * Function Name : NVIC_SystemHandlerConfig
462 * Description : Enables or disables the specified System Handlers.
463 * Input : - SystemHandler: specifies the system handler to be enabled
464 * or disabled.
465 * This parameter can be one of the following values:
466 * - SystemHandler_MemoryManage
467 * - SystemHandler_BusFault
468 * - SystemHandler_UsageFault
469 * - NewState: new state of specified System Handlers.
470 * This parameter can be: ENABLE or DISABLE.
471 * Output : None
472 * Return : None
473 *******************************************************************************/
474 void NVIC_SystemHandlerConfig(u32 SystemHandler, FunctionalState NewState)
475 {
476 u32 tmpreg = 0x00;
477
478 /* Check the parameters */
479 assert(IS_CONFIG_SYSTEM_HANDLER(SystemHandler));
480 assert(IS_FUNCTIONAL_STATE(NewState));
481
482 tmpreg = (u32)0x01 << (SystemHandler & (u32)0x1F);
483
484 if (NewState != DISABLE)
485 {
486 SCB->SysHandlerCtrl |= tmpreg;
487 }
488 else
489 {
490 SCB->SysHandlerCtrl &= ~tmpreg;
491 }
492 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -