Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 9 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /**************************************************************************//** |
1 | /**************************************************************************//** |
| 2 | * @file core_cm0plus.h |
2 | * @file core_cm0plus.h |
| 3 | * @brief CMSIS Cortex-M0+ Core Peripheral Access Layer Header File |
3 | * @brief CMSIS Cortex-M0+ Core Peripheral Access Layer Header File |
| 4 | * @version V4.30 |
4 | * @version V5.0.6 |
| 5 | * @date 20. October 2015 |
5 | * @date 28. May 2018 |
| 6 | ******************************************************************************/ |
6 | ******************************************************************************/ |
| - | 7 | /* |
|
| 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED |
8 | * Copyright (c) 2009-2018 Arm Limited. All rights reserved. |
| 8 | 9 | * |
|
| 9 | All rights reserved. |
10 | * SPDX-License-Identifier: Apache-2.0 |
| 10 | Redistribution and use in source and binary forms, with or without |
- | |
| 11 | modification, are permitted provided that the following conditions are met: |
- | |
| - | 11 | * |
|
| 12 | - Redistributions of source code must retain the above copyright |
12 | * Licensed under the Apache License, Version 2.0 (the License); you may |
| 13 | notice, this list of conditions and the following disclaimer. |
13 | * not use this file except in compliance with the License. |
| 14 | - Redistributions in binary form must reproduce the above copyright |
14 | * You may obtain a copy of the License at |
| 15 | notice, this list of conditions and the following disclaimer in the |
- | |
| 16 | documentation and/or other materials provided with the distribution. |
- | |
| 17 | - Neither the name of ARM nor the names of its contributors may be used |
- | |
| 18 | to endorse or promote products derived from this software without |
- | |
| - | 15 | * |
|
| 19 | specific prior written permission. |
16 | * www.apache.org/licenses/LICENSE-2.0 |
| 20 | * |
17 | * |
| 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
- | |
| 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
- | |
| 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
- | |
| 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE |
- | |
| 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
- | |
| 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
- | |
| 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
18 | * Unless required by applicable law or agreed to in writing, software |
| 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
21 | * See the License for the specific language governing permissions and |
| 31 | POSSIBILITY OF SUCH DAMAGE. |
22 | * limitations under the License. |
| 32 | ---------------------------------------------------------------------------*/ |
- | |
| 33 | 23 | */ |
|
| 34 | 24 | ||
| 35 | #if defined ( __ICCARM__ ) |
25 | #if defined ( __ICCARM__ ) |
| 36 | #pragma system_include /* treat file as system include file for MISRA check */ |
26 | #pragma system_include /* treat file as system include file for MISRA check */ |
| 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) |
27 | #elif defined (__clang__) |
| 38 | #pragma clang system_header /* treat file as system include file */ |
28 | #pragma clang system_header /* treat file as system include file */ |
| 39 | #endif |
29 | #endif |
| 40 | 30 | ||
| 41 | #ifndef __CORE_CM0PLUS_H_GENERIC |
31 | #ifndef __CORE_CM0PLUS_H_GENERIC |
| 42 | #define __CORE_CM0PLUS_H_GENERIC |
32 | #define __CORE_CM0PLUS_H_GENERIC |
| Line 68... | Line 58... | ||
| 68 | /** |
58 | /** |
| 69 | \ingroup Cortex-M0+ |
59 | \ingroup Cortex-M0+ |
| 70 | @{ |
60 | @{ |
| 71 | */ |
61 | */ |
| 72 | 62 | ||
| - | 63 | #include "cmsis_version.h" |
|
| - | 64 | ||
| 73 | /* CMSIS CM0+ definitions */ |
65 | /* CMSIS CM0+ definitions */ |
| 74 | #define __CM0PLUS_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */ |
66 | #define __CM0PLUS_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ |
| 75 | #define __CM0PLUS_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */ |
67 | #define __CM0PLUS_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ |
| 76 | #define __CM0PLUS_CMSIS_VERSION ((__CM0PLUS_CMSIS_VERSION_MAIN << 16U) | \ |
68 | #define __CM0PLUS_CMSIS_VERSION ((__CM0PLUS_CMSIS_VERSION_MAIN << 16U) | \ |
| 77 | __CM0PLUS_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ |
69 | __CM0PLUS_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ |
| 78 | - | ||
| 79 | #define __CORTEX_M (0x00U) /*!< Cortex-M Core */ |
- | |
| 80 | - | ||
| 81 | - | ||
| 82 | #if defined ( __CC_ARM ) |
- | |
| 83 | #define __ASM __asm /*!< asm keyword for ARM Compiler */ |
- | |
| 84 | #define __INLINE __inline /*!< inline keyword for ARM Compiler */ |
- | |
| 85 | #define __STATIC_INLINE static __inline |
- | |
| 86 | - | ||
| 87 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) |
- | |
| 88 | #define __ASM __asm /*!< asm keyword for ARM Compiler */ |
- | |
| 89 | #define __INLINE __inline /*!< inline keyword for ARM Compiler */ |
- | |
| 90 | #define __STATIC_INLINE static __inline |
- | |
| 91 | - | ||
| 92 | #elif defined ( __GNUC__ ) |
- | |
| 93 | #define __ASM __asm /*!< asm keyword for GNU Compiler */ |
- | |
| 94 | #define __INLINE inline /*!< inline keyword for GNU Compiler */ |
- | |
| 95 | #define __STATIC_INLINE static inline |
- | |
| 96 | - | ||
| 97 | #elif defined ( __ICCARM__ ) |
- | |
| 98 | #define __ASM __asm /*!< asm keyword for IAR Compiler */ |
- | |
| 99 | #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ |
- | |
| 100 | #define __STATIC_INLINE static inline |
- | |
| 101 | - | ||
| 102 | #elif defined ( __TMS470__ ) |
- | |
| 103 | #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ |
- | |
| 104 | #define __STATIC_INLINE static inline |
- | |
| 105 | - | ||
| 106 | #elif defined ( __TASKING__ ) |
- | |
| 107 | #define __ASM __asm /*!< asm keyword for TASKING Compiler */ |
- | |
| 108 | #define __INLINE inline /*!< inline keyword for TASKING Compiler */ |
- | |
| 109 | #define __STATIC_INLINE static inline |
- | |
| 110 | - | ||
| 111 | #elif defined ( __CSMC__ ) |
- | |
| 112 | #define __packed |
- | |
| 113 | #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ |
- | |
| 114 | #define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */ |
- | |
| 115 | #define __STATIC_INLINE static inline |
- | |
| 116 | 70 | ||
| 117 | #else |
- | |
| 118 | #error Unknown compiler |
71 | #define __CORTEX_M (0U) /*!< Cortex-M Core */ |
| 119 | #endif |
- | |
| 120 | 72 | ||
| 121 | /** __FPU_USED indicates whether an FPU is used or not. |
73 | /** __FPU_USED indicates whether an FPU is used or not. |
| 122 | This core does not support an FPU at all |
74 | This core does not support an FPU at all |
| 123 | */ |
75 | */ |
| 124 | #define __FPU_USED 0U |
76 | #define __FPU_USED 0U |
| Line 126... | Line 78... | ||
| 126 | #if defined ( __CC_ARM ) |
78 | #if defined ( __CC_ARM ) |
| 127 | #if defined __TARGET_FPU_VFP |
79 | #if defined __TARGET_FPU_VFP |
| 128 | #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" |
80 | #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" |
| 129 | #endif |
81 | #endif |
| 130 | 82 | ||
| 131 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) |
83 | #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) |
| 132 | #if defined __ARM_PCS_VFP |
84 | #if defined __ARM_PCS_VFP |
| 133 | #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" |
85 | #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" |
| 134 | #endif |
86 | #endif |
| 135 | 87 | ||
| 136 | #elif defined ( __GNUC__ ) |
88 | #elif defined ( __GNUC__ ) |
| Line 141... | Line 93... | ||
| 141 | #elif defined ( __ICCARM__ ) |
93 | #elif defined ( __ICCARM__ ) |
| 142 | #if defined __ARMVFP__ |
94 | #if defined __ARMVFP__ |
| 143 | #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" |
95 | #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" |
| 144 | #endif |
96 | #endif |
| 145 | 97 | ||
| 146 | #elif defined ( __TMS470__ ) |
98 | #elif defined ( __TI_ARM__ ) |
| 147 | #if defined __TI_VFP_SUPPORT__ |
99 | #if defined __TI_VFP_SUPPORT__ |
| 148 | #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" |
100 | #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" |
| 149 | #endif |
101 | #endif |
| 150 | 102 | ||
| 151 | #elif defined ( __TASKING__ ) |
103 | #elif defined ( __TASKING__ ) |
| Line 158... | Line 110... | ||
| 158 | #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" |
110 | #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" |
| 159 | #endif |
111 | #endif |
| 160 | 112 | ||
| 161 | #endif |
113 | #endif |
| 162 | 114 | ||
| 163 | #include "core_cmInstr.h" /* Core Instruction Access */ |
115 | #include "cmsis_compiler.h" /* CMSIS compiler specific defines */ |
| 164 | #include "core_cmFunc.h" /* Core Function Access */ |
- | |
| - | 116 | ||
| 165 | 117 | ||
| 166 | #ifdef __cplusplus |
118 | #ifdef __cplusplus |
| 167 | } |
119 | } |
| 168 | #endif |
120 | #endif |
| 169 | 121 | ||
| Line 402... | Line 354... | ||
| 402 | */ |
354 | */ |
| 403 | typedef struct |
355 | typedef struct |
| 404 | { |
356 | { |
| 405 | __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ |
357 | __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ |
| 406 | __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ |
358 | __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ |
| 407 | #if (__VTOR_PRESENT == 1U) |
359 | #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) |
| 408 | __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ |
360 | __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ |
| 409 | #else |
361 | #else |
| 410 | uint32_t RESERVED0; |
362 | uint32_t RESERVED0; |
| 411 | #endif |
363 | #endif |
| 412 | __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ |
364 | __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ |
| Line 459... | Line 411... | ||
| 459 | #define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ |
411 | #define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ |
| 460 | 412 | ||
| 461 | #define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ |
413 | #define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ |
| 462 | #define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ |
414 | #define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ |
| 463 | 415 | ||
| 464 | #if (__VTOR_PRESENT == 1U) |
416 | #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) |
| 465 | /* SCB Interrupt Control State Register Definitions */ |
417 | /* SCB Interrupt Control State Register Definitions */ |
| 466 | #define SCB_VTOR_TBLOFF_Pos 8U /*!< SCB VTOR: TBLOFF Position */ |
418 | #define SCB_VTOR_TBLOFF_Pos 8U /*!< SCB VTOR: TBLOFF Position */ |
| 467 | #define SCB_VTOR_TBLOFF_Msk (0xFFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ |
419 | #define SCB_VTOR_TBLOFF_Msk (0xFFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ |
| 468 | #endif |
420 | #endif |
| 469 | 421 | ||
| Line 556... | Line 508... | ||
| 556 | #define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ |
508 | #define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ |
| 557 | #define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ |
509 | #define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ |
| 558 | 510 | ||
| 559 | /*@} end of group CMSIS_SysTick */ |
511 | /*@} end of group CMSIS_SysTick */ |
| 560 | 512 | ||
| 561 | #if (__MPU_PRESENT == 1U) |
513 | #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) |
| 562 | /** |
514 | /** |
| 563 | \ingroup CMSIS_core_register |
515 | \ingroup CMSIS_core_register |
| 564 | \defgroup CMSIS_MPU Memory Protection Unit (MPU) |
516 | \defgroup CMSIS_MPU Memory Protection Unit (MPU) |
| 565 | \brief Type definitions for the Memory Protection Unit (MPU) |
517 | \brief Type definitions for the Memory Protection Unit (MPU) |
| 566 | @{ |
518 | @{ |
| Line 576... | Line 528... | ||
| 576 | __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ |
528 | __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ |
| 577 | __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ |
529 | __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ |
| 578 | __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ |
530 | __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ |
| 579 | } MPU_Type; |
531 | } MPU_Type; |
| 580 | 532 | ||
| - | 533 | #define MPU_TYPE_RALIASES 1U |
|
| - | 534 | ||
| 581 | /* MPU Type Register Definitions */ |
535 | /* MPU Type Register Definitions */ |
| 582 | #define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ |
536 | #define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ |
| 583 | #define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ |
537 | #define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ |
| 584 | 538 | ||
| 585 | #define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ |
539 | #define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ |
| Line 665... | Line 619... | ||
| 665 | */ |
619 | */ |
| 666 | 620 | ||
| 667 | /** |
621 | /** |
| 668 | \brief Mask and shift a bit field value for use in a register bit range. |
622 | \brief Mask and shift a bit field value for use in a register bit range. |
| 669 | \param[in] field Name of the register bit field. |
623 | \param[in] field Name of the register bit field. |
| 670 | \param[in] value Value of the bit field. |
624 | \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. |
| 671 | \return Masked and shifted value. |
625 | \return Masked and shifted value. |
| 672 | */ |
626 | */ |
| 673 | #define _VAL2FLD(field, value) ((value << field ## _Pos) & field ## _Msk) |
627 | #define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) |
| 674 | 628 | ||
| 675 | /** |
629 | /** |
| 676 | \brief Mask and shift a register value to extract a bit filed value. |
630 | \brief Mask and shift a register value to extract a bit filed value. |
| 677 | \param[in] field Name of the register bit field. |
631 | \param[in] field Name of the register bit field. |
| 678 | \param[in] value Value of register. |
632 | \param[in] value Value of register. This parameter is interpreted as an uint32_t type. |
| 679 | \return Masked and shifted bit field value. |
633 | \return Masked and shifted bit field value. |
| 680 | */ |
634 | */ |
| 681 | #define _FLD2VAL(field, value) ((value & field ## _Msk) >> field ## _Pos) |
635 | #define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) |
| 682 | 636 | ||
| 683 | /*@} end of group CMSIS_core_bitfield */ |
637 | /*@} end of group CMSIS_core_bitfield */ |
| 684 | 638 | ||
| 685 | 639 | ||
| 686 | /** |
640 | /** |
| Line 688... | Line 642... | ||
| 688 | \defgroup CMSIS_core_base Core Definitions |
642 | \defgroup CMSIS_core_base Core Definitions |
| 689 | \brief Definitions for base addresses, unions, and structures. |
643 | \brief Definitions for base addresses, unions, and structures. |
| 690 | @{ |
644 | @{ |
| 691 | */ |
645 | */ |
| 692 | 646 | ||
| 693 | /* Memory mapping of Cortex-M0+ Hardware */ |
647 | /* Memory mapping of Core Hardware */ |
| 694 | #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ |
648 | #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ |
| 695 | #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ |
649 | #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ |
| 696 | #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ |
650 | #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ |
| 697 | #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ |
651 | #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ |
| 698 | 652 | ||
| 699 | #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ |
653 | #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ |
| 700 | #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ |
654 | #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ |
| 701 | #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ |
655 | #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ |
| 702 | 656 | ||
| 703 | #if (__MPU_PRESENT == 1U) |
657 | #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) |
| 704 | #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ |
658 | #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ |
| 705 | #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ |
659 | #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ |
| 706 | #endif |
660 | #endif |
| 707 | 661 | ||
| 708 | /*@} */ |
662 | /*@} */ |
| Line 728... | Line 682... | ||
| 728 | \defgroup CMSIS_Core_NVICFunctions NVIC Functions |
682 | \defgroup CMSIS_Core_NVICFunctions NVIC Functions |
| 729 | \brief Functions that manage interrupts and exceptions via the NVIC. |
683 | \brief Functions that manage interrupts and exceptions via the NVIC. |
| 730 | @{ |
684 | @{ |
| 731 | */ |
685 | */ |
| 732 | 686 | ||
| - | 687 | #ifdef CMSIS_NVIC_VIRTUAL |
|
| - | 688 | #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE |
|
| - | 689 | #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" |
|
| - | 690 | #endif |
|
| - | 691 | #include CMSIS_NVIC_VIRTUAL_HEADER_FILE |
|
| - | 692 | #else |
|
| - | 693 | #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping |
|
| - | 694 | #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping |
|
| - | 695 | #define NVIC_EnableIRQ __NVIC_EnableIRQ |
|
| - | 696 | #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ |
|
| - | 697 | #define NVIC_DisableIRQ __NVIC_DisableIRQ |
|
| - | 698 | #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ |
|
| - | 699 | #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ |
|
| - | 700 | #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ |
|
| - | 701 | /*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M0+ */ |
|
| - | 702 | #define NVIC_SetPriority __NVIC_SetPriority |
|
| - | 703 | #define NVIC_GetPriority __NVIC_GetPriority |
|
| - | 704 | #define NVIC_SystemReset __NVIC_SystemReset |
|
| - | 705 | #endif /* CMSIS_NVIC_VIRTUAL */ |
|
| - | 706 | ||
| - | 707 | #ifdef CMSIS_VECTAB_VIRTUAL |
|
| - | 708 | #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE |
|
| - | 709 | #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" |
|
| - | 710 | #endif |
|
| - | 711 | #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE |
|
| - | 712 | #else |
|
| - | 713 | #define NVIC_SetVector __NVIC_SetVector |
|
| - | 714 | #define NVIC_GetVector __NVIC_GetVector |
|
| - | 715 | #endif /* (CMSIS_VECTAB_VIRTUAL) */ |
|
| - | 716 | ||
| - | 717 | #define NVIC_USER_IRQ_OFFSET 16 |
|
| - | 718 | ||
| - | 719 | ||
| - | 720 | /* The following EXC_RETURN values are saved the LR on exception entry */ |
|
| - | 721 | #define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ |
|
| - | 722 | #define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ |
|
| - | 723 | #define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ |
|
| - | 724 | ||
| - | 725 | ||
| 733 | /* Interrupt Priorities are WORD accessible only under ARMv6M */ |
726 | /* Interrupt Priorities are WORD accessible only under Armv6-M */ |
| 734 | /* The following MACROS handle generation of the register offset and byte masks */ |
727 | /* The following MACROS handle generation of the register offset and byte masks */ |
| 735 | #define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) |
728 | #define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) |
| 736 | #define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) |
729 | #define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) |
| 737 | #define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) |
730 | #define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) |
| 738 | 731 | ||
| - | 732 | #define __NVIC_SetPriorityGrouping(X) (void)(X) |
|
| - | 733 | #define __NVIC_GetPriorityGrouping() (0U) |
|
| 739 | 734 | ||
| 740 | /** |
735 | /** |
| 741 | \brief Enable External Interrupt |
736 | \brief Enable Interrupt |
| 742 | \details Enables a device-specific interrupt in the NVIC interrupt controller. |
737 | \details Enables a device specific interrupt in the NVIC interrupt controller. |
| 743 | \param [in] IRQn External interrupt number. Value cannot be negative. |
738 | \param [in] IRQn Device specific interrupt number. |
| - | 739 | \note IRQn must not be negative. |
|
| 744 | */ |
740 | */ |
| 745 | __STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) |
741 | __STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) |
| 746 | { |
742 | { |
| - | 743 | if ((int32_t)(IRQn) >= 0) |
|
| - | 744 | { |
|
| 747 | NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); |
745 | NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); |
| - | 746 | } |
|
| 748 | } |
747 | } |
| 749 | 748 | ||
| 750 | 749 | ||
| 751 | /** |
750 | /** |
| 752 | \brief Disable External Interrupt |
751 | \brief Get Interrupt Enable status |
| 753 | \details Disables a device-specific interrupt in the NVIC interrupt controller. |
752 | \details Returns a device specific interrupt enable status from the NVIC interrupt controller. |
| 754 | \param [in] IRQn External interrupt number. Value cannot be negative. |
753 | \param [in] IRQn Device specific interrupt number. |
| - | 754 | \return 0 Interrupt is not enabled. |
|
| - | 755 | \return 1 Interrupt is enabled. |
|
| - | 756 | \note IRQn must not be negative. |
|
| 755 | */ |
757 | */ |
| 756 | __STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) |
758 | __STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) |
| 757 | { |
759 | { |
| - | 760 | if ((int32_t)(IRQn) >= 0) |
|
| - | 761 | { |
|
| - | 762 | return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); |
|
| - | 763 | } |
|
| - | 764 | else |
|
| - | 765 | { |
|
| - | 766 | return(0U); |
|
| - | 767 | } |
|
| - | 768 | } |
|
| - | 769 | ||
| - | 770 | ||
| - | 771 | /** |
|
| - | 772 | \brief Disable Interrupt |
|
| - | 773 | \details Disables a device specific interrupt in the NVIC interrupt controller. |
|
| - | 774 | \param [in] IRQn Device specific interrupt number. |
|
| - | 775 | \note IRQn must not be negative. |
|
| - | 776 | */ |
|
| - | 777 | __STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) |
|
| - | 778 | { |
|
| - | 779 | if ((int32_t)(IRQn) >= 0) |
|
| - | 780 | { |
|
| 758 | NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); |
781 | NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); |
| - | 782 | __DSB(); |
|
| - | 783 | __ISB(); |
|
| - | 784 | } |
|
| 759 | } |
785 | } |
| 760 | 786 | ||
| 761 | 787 | ||
| 762 | /** |
788 | /** |
| 763 | \brief Get Pending Interrupt |
789 | \brief Get Pending Interrupt |
| 764 | \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt. |
790 | \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. |
| 765 | \param [in] IRQn Interrupt number. |
791 | \param [in] IRQn Device specific interrupt number. |
| 766 | \return 0 Interrupt status is not pending. |
792 | \return 0 Interrupt status is not pending. |
| 767 | \return 1 Interrupt status is pending. |
793 | \return 1 Interrupt status is pending. |
| - | 794 | \note IRQn must not be negative. |
|
| 768 | */ |
795 | */ |
| 769 | __STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) |
796 | __STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) |
| 770 | { |
797 | { |
| - | 798 | if ((int32_t)(IRQn) >= 0) |
|
| - | 799 | { |
|
| 771 | return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); |
800 | return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); |
| - | 801 | } |
|
| - | 802 | else |
|
| - | 803 | { |
|
| - | 804 | return(0U); |
|
| - | 805 | } |
|
| 772 | } |
806 | } |
| 773 | 807 | ||
| 774 | 808 | ||
| 775 | /** |
809 | /** |
| 776 | \brief Set Pending Interrupt |
810 | \brief Set Pending Interrupt |
| 777 | \details Sets the pending bit of an external interrupt. |
811 | \details Sets the pending bit of a device specific interrupt in the NVIC pending register. |
| 778 | \param [in] IRQn Interrupt number. Value cannot be negative. |
812 | \param [in] IRQn Device specific interrupt number. |
| - | 813 | \note IRQn must not be negative. |
|
| 779 | */ |
814 | */ |
| 780 | __STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) |
815 | __STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) |
| 781 | { |
816 | { |
| - | 817 | if ((int32_t)(IRQn) >= 0) |
|
| - | 818 | { |
|
| 782 | NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); |
819 | NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); |
| - | 820 | } |
|
| 783 | } |
821 | } |
| 784 | 822 | ||
| 785 | 823 | ||
| 786 | /** |
824 | /** |
| 787 | \brief Clear Pending Interrupt |
825 | \brief Clear Pending Interrupt |
| 788 | \details Clears the pending bit of an external interrupt. |
826 | \details Clears the pending bit of a device specific interrupt in the NVIC pending register. |
| 789 | \param [in] IRQn External interrupt number. Value cannot be negative. |
827 | \param [in] IRQn Device specific interrupt number. |
| - | 828 | \note IRQn must not be negative. |
|
| 790 | */ |
829 | */ |
| 791 | __STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) |
830 | __STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) |
| 792 | { |
831 | { |
| - | 832 | if ((int32_t)(IRQn) >= 0) |
|
| - | 833 | { |
|
| 793 | NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); |
834 | NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); |
| - | 835 | } |
|
| 794 | } |
836 | } |
| 795 | 837 | ||
| 796 | 838 | ||
| 797 | /** |
839 | /** |
| 798 | \brief Set Interrupt Priority |
840 | \brief Set Interrupt Priority |
| 799 | \details Sets the priority of an interrupt. |
841 | \details Sets the priority of a device specific interrupt or a processor exception. |
| 800 | \note The priority cannot be set for every core interrupt. |
842 | The interrupt number can be positive to specify a device specific interrupt, |
| - | 843 | or negative to specify a processor exception. |
|
| 801 | \param [in] IRQn Interrupt number. |
844 | \param [in] IRQn Interrupt number. |
| 802 | \param [in] priority Priority to set. |
845 | \param [in] priority Priority to set. |
| - | 846 | \note The priority cannot be set for every processor exception. |
|
| 803 | */ |
847 | */ |
| 804 | __STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) |
848 | __STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) |
| 805 | { |
849 | { |
| 806 | if ((int32_t)(IRQn) < 0) |
850 | if ((int32_t)(IRQn) >= 0) |
| 807 | { |
851 | { |
| 808 | SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | |
852 | NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | |
| 809 | (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); |
853 | (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); |
| 810 | } |
854 | } |
| 811 | else |
855 | else |
| 812 | { |
856 | { |
| 813 | NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | |
857 | SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | |
| 814 | (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); |
858 | (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); |
| 815 | } |
859 | } |
| 816 | } |
860 | } |
| 817 | 861 | ||
| 818 | 862 | ||
| 819 | /** |
863 | /** |
| 820 | \brief Get Interrupt Priority |
864 | \brief Get Interrupt Priority |
| 821 | \details Reads the priority of an interrupt. |
865 | \details Reads the priority of a device specific interrupt or a processor exception. |
| 822 | The interrupt number can be positive to specify an external (device specific) interrupt, |
866 | The interrupt number can be positive to specify a device specific interrupt, |
| 823 | or negative to specify an internal (core) interrupt. |
867 | or negative to specify a processor exception. |
| 824 | \param [in] IRQn Interrupt number. |
868 | \param [in] IRQn Interrupt number. |
| 825 | \return Interrupt Priority. |
869 | \return Interrupt Priority. |
| 826 | Value is aligned automatically to the implemented priority bits of the microcontroller. |
870 | Value is aligned automatically to the implemented priority bits of the microcontroller. |
| 827 | */ |
871 | */ |
| 828 | __STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn) |
872 | __STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) |
| 829 | { |
873 | { |
| 830 | 874 | ||
| 831 | if ((int32_t)(IRQn) < 0) |
875 | if ((int32_t)(IRQn) >= 0) |
| 832 | { |
876 | { |
| 833 | return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); |
877 | return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); |
| 834 | } |
878 | } |
| 835 | else |
879 | else |
| 836 | { |
880 | { |
| 837 | return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); |
881 | return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); |
| 838 | } |
882 | } |
| 839 | } |
883 | } |
| 840 | 884 | ||
| 841 | 885 | ||
| 842 | /** |
886 | /** |
| - | 887 | \brief Encode Priority |
|
| - | 888 | \details Encodes the priority for an interrupt with the given priority group, |
|
| - | 889 | preemptive priority value, and subpriority value. |
|
| - | 890 | In case of a conflict between priority grouping and available |
|
| - | 891 | priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. |
|
| - | 892 | \param [in] PriorityGroup Used priority group. |
|
| - | 893 | \param [in] PreemptPriority Preemptive priority value (starting from 0). |
|
| - | 894 | \param [in] SubPriority Subpriority value (starting from 0). |
|
| - | 895 | \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). |
|
| - | 896 | */ |
|
| - | 897 | __STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) |
|
| - | 898 | { |
|
| - | 899 | uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ |
|
| - | 900 | uint32_t PreemptPriorityBits; |
|
| - | 901 | uint32_t SubPriorityBits; |
|
| - | 902 | ||
| - | 903 | PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); |
|
| - | 904 | SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); |
|
| - | 905 | ||
| - | 906 | return ( |
|
| - | 907 | ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | |
|
| - | 908 | ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) |
|
| - | 909 | ); |
|
| - | 910 | } |
|
| - | 911 | ||
| - | 912 | ||
| - | 913 | /** |
|
| - | 914 | \brief Decode Priority |
|
| - | 915 | \details Decodes an interrupt priority value with a given priority group to |
|
| - | 916 | preemptive priority value and subpriority value. |
|
| - | 917 | In case of a conflict between priority grouping and available |
|
| - | 918 | priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. |
|
| - | 919 | \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). |
|
| - | 920 | \param [in] PriorityGroup Used priority group. |
|
| - | 921 | \param [out] pPreemptPriority Preemptive priority value (starting from 0). |
|
| - | 922 | \param [out] pSubPriority Subpriority value (starting from 0). |
|
| - | 923 | */ |
|
| - | 924 | __STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) |
|
| - | 925 | { |
|
| - | 926 | uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ |
|
| - | 927 | uint32_t PreemptPriorityBits; |
|
| - | 928 | uint32_t SubPriorityBits; |
|
| - | 929 | ||
| - | 930 | PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); |
|
| - | 931 | SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); |
|
| - | 932 | ||
| - | 933 | *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); |
|
| - | 934 | *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); |
|
| - | 935 | } |
|
| - | 936 | ||
| - | 937 | ||
| - | 938 | /** |
|
| - | 939 | \brief Set Interrupt Vector |
|
| - | 940 | \details Sets an interrupt vector in SRAM based interrupt vector table. |
|
| - | 941 | The interrupt number can be positive to specify a device specific interrupt, |
|
| - | 942 | or negative to specify a processor exception. |
|
| - | 943 | VTOR must been relocated to SRAM before. |
|
| - | 944 | If VTOR is not present address 0 must be mapped to SRAM. |
|
| - | 945 | \param [in] IRQn Interrupt number |
|
| - | 946 | \param [in] vector Address of interrupt handler function |
|
| - | 947 | */ |
|
| - | 948 | __STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) |
|
| - | 949 | { |
|
| - | 950 | #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) |
|
| - | 951 | uint32_t *vectors = (uint32_t *)SCB->VTOR; |
|
| - | 952 | #else |
|
| - | 953 | uint32_t *vectors = (uint32_t *)0x0U; |
|
| - | 954 | #endif |
|
| - | 955 | vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; |
|
| - | 956 | } |
|
| - | 957 | ||
| - | 958 | ||
| - | 959 | /** |
|
| - | 960 | \brief Get Interrupt Vector |
|
| - | 961 | \details Reads an interrupt vector from interrupt vector table. |
|
| - | 962 | The interrupt number can be positive to specify a device specific interrupt, |
|
| - | 963 | or negative to specify a processor exception. |
|
| - | 964 | \param [in] IRQn Interrupt number. |
|
| - | 965 | \return Address of interrupt handler function |
|
| - | 966 | */ |
|
| - | 967 | __STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) |
|
| - | 968 | { |
|
| - | 969 | #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) |
|
| - | 970 | uint32_t *vectors = (uint32_t *)SCB->VTOR; |
|
| - | 971 | #else |
|
| - | 972 | uint32_t *vectors = (uint32_t *)0x0U; |
|
| - | 973 | #endif |
|
| - | 974 | return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; |
|
| - | 975 | ||
| - | 976 | } |
|
| - | 977 | ||
| - | 978 | ||
| - | 979 | /** |
|
| 843 | \brief System Reset |
980 | \brief System Reset |
| 844 | \details Initiates a system reset request to reset the MCU. |
981 | \details Initiates a system reset request to reset the MCU. |
| 845 | */ |
982 | */ |
| 846 | __STATIC_INLINE void NVIC_SystemReset(void) |
983 | __NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) |
| 847 | { |
984 | { |
| 848 | __DSB(); /* Ensure all outstanding memory accesses included |
985 | __DSB(); /* Ensure all outstanding memory accesses included |
| 849 | buffered write are completed before reset */ |
986 | buffered write are completed before reset */ |
| 850 | SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | |
987 | SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | |
| 851 | SCB_AIRCR_SYSRESETREQ_Msk); |
988 | SCB_AIRCR_SYSRESETREQ_Msk); |
| Line 857... | Line 994... | ||
| 857 | } |
994 | } |
| 858 | } |
995 | } |
| 859 | 996 | ||
| 860 | /*@} end of CMSIS_Core_NVICFunctions */ |
997 | /*@} end of CMSIS_Core_NVICFunctions */ |
| 861 | 998 | ||
| - | 999 | /* ########################## MPU functions #################################### */ |
|
| - | 1000 | ||
| - | 1001 | #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) |
|
| - | 1002 | ||
| - | 1003 | #include "mpu_armv7.h" |
|
| - | 1004 | ||
| - | 1005 | #endif |
|
| - | 1006 | ||
| - | 1007 | /* ########################## FPU functions #################################### */ |
|
| - | 1008 | /** |
|
| - | 1009 | \ingroup CMSIS_Core_FunctionInterface |
|
| - | 1010 | \defgroup CMSIS_Core_FpuFunctions FPU Functions |
|
| - | 1011 | \brief Function that provides FPU type. |
|
| - | 1012 | @{ |
|
| - | 1013 | */ |
|
| - | 1014 | ||
| - | 1015 | /** |
|
| - | 1016 | \brief get FPU type |
|
| - | 1017 | \details returns the FPU type |
|
| - | 1018 | \returns |
|
| - | 1019 | - \b 0: No FPU |
|
| - | 1020 | - \b 1: Single precision FPU |
|
| - | 1021 | - \b 2: Double + Single precision FPU |
|
| - | 1022 | */ |
|
| - | 1023 | __STATIC_INLINE uint32_t SCB_GetFPUType(void) |
|
| - | 1024 | { |
|
| - | 1025 | return 0U; /* No FPU */ |
|
| - | 1026 | } |
|
| - | 1027 | ||
| - | 1028 | ||
| - | 1029 | /*@} end of CMSIS_Core_FpuFunctions */ |
|
| - | 1030 | ||
| 862 | 1031 | ||
| 863 | 1032 | ||
| 864 | /* ################################## SysTick function ############################################ */ |
1033 | /* ################################## SysTick function ############################################ */ |
| 865 | /** |
1034 | /** |
| 866 | \ingroup CMSIS_Core_FunctionInterface |
1035 | \ingroup CMSIS_Core_FunctionInterface |
| 867 | \defgroup CMSIS_Core_SysTickFunctions SysTick Functions |
1036 | \defgroup CMSIS_Core_SysTickFunctions SysTick Functions |
| 868 | \brief Functions that configure the System. |
1037 | \brief Functions that configure the System. |
| 869 | @{ |
1038 | @{ |
| 870 | */ |
1039 | */ |
| 871 | 1040 | ||
| 872 | #if (__Vendor_SysTickConfig == 0U) |
1041 | #if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) |
| 873 | 1042 | ||
| 874 | /** |
1043 | /** |
| 875 | \brief System Tick Configuration |
1044 | \brief System Tick Configuration |
| 876 | \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. |
1045 | \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. |
| 877 | Counter is in free running mode to generate periodic interrupts. |
1046 | Counter is in free running mode to generate periodic interrupts. |