My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

lpc17xx_nvic.c 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /**********************************************************************
  2. * $Id$ lpc17xx_nvic.c 2010-05-21
  3. *//**
  4. * @file lpc17xx_nvic.c
  5. * @brief Contains all expansion functions support for
  6. * NVIC firmware library on LPC17xx. The main
  7. * NVIC functions are defined in core_cm3.h
  8. * @version 2.0
  9. * @date 21. May. 2010
  10. * @author NXP MCU SW Application Team
  11. *
  12. * Copyright(C) 2010, NXP Semiconductor
  13. * All rights reserved.
  14. *
  15. ***********************************************************************
  16. * Software that is described herein is for illustrative purposes only
  17. * which provides customers with programming information regarding the
  18. * products. This software is supplied "AS IS" without any warranties.
  19. * NXP Semiconductors assumes no responsibility or liability for the
  20. * use of the software, conveys no license or title under any patent,
  21. * copyright, or mask work right to the product. NXP Semiconductors
  22. * reserves the right to make changes in the software without
  23. * notification. NXP Semiconductors also make no representation or
  24. * warranty that such application will be suitable for the specified
  25. * use without further testing or modification.
  26. * Permission to use, copy, modify, and distribute this software and its
  27. * documentation is hereby granted, under NXP Semiconductors'
  28. * relevant copyright in the software, without fee, provided that it
  29. * is used in conjunction with NXP Semiconductors microcontrollers. This
  30. * copyright, permission, and disclaimer notice must appear in all copies of
  31. * this code.
  32. **********************************************************************/
  33. /* Peripheral group ----------------------------------------------------------- */
  34. /** @addtogroup NVIC
  35. * @{
  36. */
  37. /* Includes ------------------------------------------------------------------- */
  38. #include "lpc17xx_nvic.h"
  39. /* Private Macros ------------------------------------------------------------- */
  40. /** @addtogroup NVIC_Private_Macros
  41. * @{
  42. */
  43. /* Vector table offset bit mask */
  44. #define NVIC_VTOR_MASK 0x3FFFFF80
  45. /**
  46. * @}
  47. */
  48. /* Public Functions ----------------------------------------------------------- */
  49. /** @addtogroup NVIC_Public_Functions
  50. * @{
  51. */
  52. /*****************************************************************************//**
  53. * @brief De-initializes the NVIC peripheral registers to their default
  54. * reset values.
  55. * @param None
  56. * @return None
  57. *
  58. * These following NVIC peripheral registers will be de-initialized:
  59. * - Disable Interrupt (32 IRQ interrupt sources that matched with LPC17xx)
  60. * - Clear all Pending Interrupts (32 IRQ interrupt source that matched with LPC17xx)
  61. * - Clear all Interrupt Priorities (32 IRQ interrupt source that matched with LPC17xx)
  62. *******************************************************************************/
  63. void NVIC_DeInit(void)
  64. {
  65. uint8_t tmp;
  66. /* Disable all interrupts */
  67. NVIC->ICER[0] = 0xFFFFFFFF;
  68. NVIC->ICER[1] = 0x00000001;
  69. /* Clear all pending interrupts */
  70. NVIC->ICPR[0] = 0xFFFFFFFF;
  71. NVIC->ICPR[1] = 0x00000001;
  72. /* Clear all interrupt priority */
  73. for (tmp = 0; tmp < 32; tmp++) {
  74. NVIC->IP[tmp] = 0x00;
  75. }
  76. }
  77. /*****************************************************************************//**
  78. * @brief De-initializes the SCB peripheral registers to their default
  79. * reset values.
  80. * @param none
  81. * @return none
  82. *
  83. * These following SCB NVIC peripheral registers will be de-initialized:
  84. * - Interrupt Control State register
  85. * - Interrupt Vector Table Offset register
  86. * - Application Interrupt/Reset Control register
  87. * - System Control register
  88. * - Configuration Control register
  89. * - System Handlers Priority Registers
  90. * - System Handler Control and State Register
  91. * - Configurable Fault Status Register
  92. * - Hard Fault Status Register
  93. * - Debug Fault Status Register
  94. *******************************************************************************/
  95. void NVIC_SCBDeInit(void)
  96. {
  97. uint8_t tmp;
  98. SCB->ICSR = 0x0A000000;
  99. SCB->VTOR = 0x00000000;
  100. SCB->AIRCR = 0x05FA0000;
  101. SCB->SCR = 0x00000000;
  102. SCB->CCR = 0x00000000;
  103. for (tmp = 0; tmp < (sizeof(SCB->SHP) / sizeof(SCB->SHP[0])); tmp++) {
  104. SCB->SHP[tmp] = 0x00;
  105. }
  106. SCB->SHCSR = 0x00000000;
  107. SCB->CFSR = 0xFFFFFFFF;
  108. SCB->HFSR = 0xFFFFFFFF;
  109. SCB->DFSR = 0xFFFFFFFF;
  110. }
  111. /*****************************************************************************//**
  112. * @brief Set Vector Table Offset value
  113. * @param offset Offset value
  114. * @return None
  115. *******************************************************************************/
  116. void NVIC_SetVTOR(uint32_t offset)
  117. {
  118. // SCB->VTOR = (offset & NVIC_VTOR_MASK);
  119. SCB->VTOR = offset;
  120. }
  121. /**
  122. * @}
  123. */
  124. /**
  125. * @}
  126. */
  127. /* --------------------------------- End Of File ------------------------------ */