Subversion Repositories LedShow

Rev

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_sc000.h
2
 * @file     core_sc000.h
3
 * @brief    CMSIS SC000 Core Peripheral Access Layer Header File
3
 * @brief    CMSIS SC000 Core Peripheral Access Layer Header File
4
 * @version  V4.30
4
 * @version  V5.0.5
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_SC000_H_GENERIC
31
#ifndef __CORE_SC000_H_GENERIC
42
#define __CORE_SC000_H_GENERIC
32
#define __CORE_SC000_H_GENERIC
Line 68... Line 58...
68
/**
58
/**
69
  \ingroup SC000
59
  \ingroup SC000
70
  @{
60
  @{
71
 */
61
 */
72
 
62
 
-
 
63
#include "cmsis_version.h"
-
 
64
 
73
/*  CMSIS SC000 definitions */
65
/*  CMSIS SC000 definitions */
74
#define __SC000_CMSIS_VERSION_MAIN  (0x04U)                                    /*!< [31:16] CMSIS HAL main version */
66
#define __SC000_CMSIS_VERSION_MAIN  (__CM_CMSIS_VERSION_MAIN)                /*!< \deprecated [31:16] CMSIS HAL main version */
75
#define __SC000_CMSIS_VERSION_SUB   (0x1EU)                                    /*!< [15:0]  CMSIS HAL sub version */
67
#define __SC000_CMSIS_VERSION_SUB   (__CM_CMSIS_VERSION_SUB)                 /*!< \deprecated [15:0]  CMSIS HAL sub version */
76
#define __SC000_CMSIS_VERSION       ((__SC000_CMSIS_VERSION_MAIN << 16U) | \
68
#define __SC000_CMSIS_VERSION       ((__SC000_CMSIS_VERSION_MAIN << 16U) | \
77
                                      __SC000_CMSIS_VERSION_SUB           )    /*!< CMSIS HAL version number */
69
                                      __SC000_CMSIS_VERSION_SUB           )  /*!< \deprecated CMSIS HAL version number */
78
 
-
 
79
#define __CORTEX_SC                 (000U)                                     /*!< Cortex secure 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
 
70
 
111
#elif defined ( __CSMC__ )
-
 
112
  #define __packed
-
 
113
  #define __ASM            _asm                                      /*!< asm keyword for COSMIC Compiler */
71
#define __CORTEX_SC                 (000U)                                   /*!< Cortex secure core */
114
  #define __INLINE         inline                                    /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */
-
 
115
  #define __STATIC_INLINE  static inline
-
 
116
 
-
 
117
#else
-
 
118
  #error Unknown compiler
-
 
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 567... Line 519...
567
#define SysTick_CALIB_TENMS_Pos             0U                                            /*!< SysTick CALIB: TENMS Position */
519
#define SysTick_CALIB_TENMS_Pos             0U                                            /*!< SysTick CALIB: TENMS Position */
568
#define SysTick_CALIB_TENMS_Msk            (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/)    /*!< SysTick CALIB: TENMS Mask */
520
#define SysTick_CALIB_TENMS_Msk            (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/)    /*!< SysTick CALIB: TENMS Mask */
569
 
521
 
570
/*@} end of group CMSIS_SysTick */
522
/*@} end of group CMSIS_SysTick */
571
 
523
 
572
#if (__MPU_PRESENT == 1U)
524
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
573
/**
525
/**
574
  \ingroup  CMSIS_core_register
526
  \ingroup  CMSIS_core_register
575
  \defgroup CMSIS_MPU     Memory Protection Unit (MPU)
527
  \defgroup CMSIS_MPU     Memory Protection Unit (MPU)
576
  \brief    Type definitions for the Memory Protection Unit (MPU)
528
  \brief    Type definitions for the Memory Protection Unit (MPU)
577
  @{
529
  @{
Line 676... Line 628...
676
 */
628
 */
677
 
629
 
678
/**
630
/**
679
  \brief   Mask and shift a bit field value for use in a register bit range.
631
  \brief   Mask and shift a bit field value for use in a register bit range.
680
  \param[in] field  Name of the register bit field.
632
  \param[in] field  Name of the register bit field.
681
  \param[in] value  Value of the bit field.
633
  \param[in] value  Value of the bit field. This parameter is interpreted as an uint32_t type.
682
  \return           Masked and shifted value.
634
  \return           Masked and shifted value.
683
*/
635
*/
684
#define _VAL2FLD(field, value)    ((value << field ## _Pos) & field ## _Msk)
636
#define _VAL2FLD(field, value)    (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
685
 
637
 
686
/**
638
/**
687
  \brief     Mask and shift a register value to extract a bit filed value.
639
  \brief     Mask and shift a register value to extract a bit filed value.
688
  \param[in] field  Name of the register bit field.
640
  \param[in] field  Name of the register bit field.
689
  \param[in] value  Value of register.
641
  \param[in] value  Value of register. This parameter is interpreted as an uint32_t type.
690
  \return           Masked and shifted bit field value.
642
  \return           Masked and shifted bit field value.
691
*/
643
*/
692
#define _FLD2VAL(field, value)    ((value & field ## _Msk) >> field ## _Pos)
644
#define _FLD2VAL(field, value)    (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
693
 
645
 
694
/*@} end of group CMSIS_core_bitfield */
646
/*@} end of group CMSIS_core_bitfield */
695
 
647
 
696
 
648
 
697
/**
649
/**
Line 699... Line 651...
699
  \defgroup   CMSIS_core_base     Core Definitions
651
  \defgroup   CMSIS_core_base     Core Definitions
700
  \brief      Definitions for base addresses, unions, and structures.
652
  \brief      Definitions for base addresses, unions, and structures.
701
  @{
653
  @{
702
 */
654
 */
703
 
655
 
704
/* Memory mapping of SC000 Hardware */
656
/* Memory mapping of Core Hardware */
705
#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address */
657
#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address */
706
#define SysTick_BASE        (SCS_BASE +  0x0010UL)                    /*!< SysTick Base Address */
658
#define SysTick_BASE        (SCS_BASE +  0x0010UL)                    /*!< SysTick Base Address */
707
#define NVIC_BASE           (SCS_BASE +  0x0100UL)                    /*!< NVIC Base Address */
659
#define NVIC_BASE           (SCS_BASE +  0x0100UL)                    /*!< NVIC Base Address */
708
#define SCB_BASE            (SCS_BASE +  0x0D00UL)                    /*!< System Control Block Base Address */
660
#define SCB_BASE            (SCS_BASE +  0x0D00UL)                    /*!< System Control Block Base Address */
709
 
661
 
710
#define SCnSCB              ((SCnSCB_Type    *)     SCS_BASE      )   /*!< System control Register not in SCB */
662
#define SCnSCB              ((SCnSCB_Type    *)     SCS_BASE      )   /*!< System control Register not in SCB */
711
#define SCB                 ((SCB_Type       *)     SCB_BASE      )   /*!< SCB configuration struct */
663
#define SCB                 ((SCB_Type       *)     SCB_BASE      )   /*!< SCB configuration struct */
712
#define SysTick             ((SysTick_Type   *)     SysTick_BASE  )   /*!< SysTick configuration struct */
664
#define SysTick             ((SysTick_Type   *)     SysTick_BASE  )   /*!< SysTick configuration struct */
713
#define NVIC                ((NVIC_Type      *)     NVIC_BASE     )   /*!< NVIC configuration struct */
665
#define NVIC                ((NVIC_Type      *)     NVIC_BASE     )   /*!< NVIC configuration struct */
714
 
666
 
715
#if (__MPU_PRESENT == 1U)
667
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
716
  #define MPU_BASE          (SCS_BASE +  0x0D90UL)                    /*!< Memory Protection Unit */
668
  #define MPU_BASE          (SCS_BASE +  0x0D90UL)                    /*!< Memory Protection Unit */
717
  #define MPU               ((MPU_Type       *)     MPU_BASE      )   /*!< Memory Protection Unit */
669
  #define MPU               ((MPU_Type       *)     MPU_BASE      )   /*!< Memory Protection Unit */
718
#endif
670
#endif
719
 
671
 
720
/*@} */
672
/*@} */
Line 740... Line 692...
740
  \defgroup CMSIS_Core_NVICFunctions NVIC Functions
692
  \defgroup CMSIS_Core_NVICFunctions NVIC Functions
741
  \brief    Functions that manage interrupts and exceptions via the NVIC.
693
  \brief    Functions that manage interrupts and exceptions via the NVIC.
742
  @{
694
  @{
743
 */
695
 */
744
 
696
 
-
 
697
#ifdef CMSIS_NVIC_VIRTUAL
-
 
698
  #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
-
 
699
    #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
-
 
700
  #endif
-
 
701
  #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
-
 
702
#else
-
 
703
/*#define NVIC_SetPriorityGrouping    __NVIC_SetPriorityGrouping   not available for SC000 */
-
 
704
/*#define NVIC_GetPriorityGrouping    __NVIC_GetPriorityGrouping   not available for SC000 */
-
 
705
  #define NVIC_EnableIRQ              __NVIC_EnableIRQ
-
 
706
  #define NVIC_GetEnableIRQ           __NVIC_GetEnableIRQ
-
 
707
  #define NVIC_DisableIRQ             __NVIC_DisableIRQ
-
 
708
  #define NVIC_GetPendingIRQ          __NVIC_GetPendingIRQ
-
 
709
  #define NVIC_SetPendingIRQ          __NVIC_SetPendingIRQ
-
 
710
  #define NVIC_ClearPendingIRQ        __NVIC_ClearPendingIRQ
-
 
711
/*#define NVIC_GetActive              __NVIC_GetActive             not available for SC000 */
-
 
712
  #define NVIC_SetPriority            __NVIC_SetPriority
-
 
713
  #define NVIC_GetPriority            __NVIC_GetPriority
-
 
714
  #define NVIC_SystemReset            __NVIC_SystemReset
-
 
715
#endif /* CMSIS_NVIC_VIRTUAL */
-
 
716
 
-
 
717
#ifdef CMSIS_VECTAB_VIRTUAL
-
 
718
  #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
-
 
719
    #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
-
 
720
  #endif
-
 
721
  #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
-
 
722
#else
-
 
723
  #define NVIC_SetVector              __NVIC_SetVector
-
 
724
  #define NVIC_GetVector              __NVIC_GetVector
-
 
725
#endif  /* (CMSIS_VECTAB_VIRTUAL) */
-
 
726
 
-
 
727
#define NVIC_USER_IRQ_OFFSET          16
-
 
728
 
-
 
729
 
-
 
730
/* The following EXC_RETURN values are saved the LR on exception entry */
-
 
731
#define EXC_RETURN_HANDLER         (0xFFFFFFF1UL)     /* return to Handler mode, uses MSP after return                               */
-
 
732
#define EXC_RETURN_THREAD_MSP      (0xFFFFFFF9UL)     /* return to Thread mode, uses MSP after return                                */
-
 
733
#define EXC_RETURN_THREAD_PSP      (0xFFFFFFFDUL)     /* return to Thread mode, uses PSP after return                                */
-
 
734
 
-
 
735
 
745
/* Interrupt Priorities are WORD accessible only under ARMv6M                   */
736
/* Interrupt Priorities are WORD accessible only under Armv6-M                  */
746
/* The following MACROS handle generation of the register offset and byte masks */
737
/* The following MACROS handle generation of the register offset and byte masks */
747
#define _BIT_SHIFT(IRQn)         (  ((((uint32_t)(int32_t)(IRQn))         )      &  0x03UL) * 8UL)
738
#define _BIT_SHIFT(IRQn)         (  ((((uint32_t)(int32_t)(IRQn))         )      &  0x03UL) * 8UL)
748
#define _SHP_IDX(IRQn)           ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >>    2UL)      )
739
#define _SHP_IDX(IRQn)           ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >>    2UL)      )
749
#define _IP_IDX(IRQn)            (   (((uint32_t)(int32_t)(IRQn))                >>    2UL)      )
740
#define _IP_IDX(IRQn)            (   (((uint32_t)(int32_t)(IRQn))                >>    2UL)      )
750
 
741
 
751
 
742
 
752
/**
743
/**
753
  \brief   Enable External Interrupt
744
  \brief   Enable Interrupt
754
  \details Enables a device-specific interrupt in the NVIC interrupt controller.
745
  \details Enables a device specific interrupt in the NVIC interrupt controller.
755
  \param [in]      IRQn  External interrupt number. Value cannot be negative.
746
  \param [in]      IRQn  Device specific interrupt number.
-
 
747
  \note    IRQn must not be negative.
756
 */
748
 */
757
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
749
__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
758
{
750
{
-
 
751
  if ((int32_t)(IRQn) >= 0)
-
 
752
  {
759
  NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
753
    NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
754
  }
760
}
755
}
761
 
756
 
762
 
757
 
763
/**
758
/**
764
  \brief   Disable External Interrupt
759
  \brief   Get Interrupt Enable status
765
  \details Disables a device-specific interrupt in the NVIC interrupt controller.
760
  \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
766
  \param [in]      IRQn  External interrupt number. Value cannot be negative.
761
  \param [in]      IRQn  Device specific interrupt number.
-
 
762
  \return             0  Interrupt is not enabled.
-
 
763
  \return             1  Interrupt is enabled.
-
 
764
  \note    IRQn must not be negative.
767
 */
765
 */
768
__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
766
__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
769
{
767
{
-
 
768
  if ((int32_t)(IRQn) >= 0)
-
 
769
  {
-
 
770
    return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
-
 
771
  }
-
 
772
  else
-
 
773
  {
-
 
774
    return(0U);
-
 
775
  }
-
 
776
}
-
 
777
 
-
 
778
 
-
 
779
/**
-
 
780
  \brief   Disable Interrupt
-
 
781
  \details Disables a device specific interrupt in the NVIC interrupt controller.
-
 
782
  \param [in]      IRQn  Device specific interrupt number.
-
 
783
  \note    IRQn must not be negative.
-
 
784
 */
-
 
785
__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
-
 
786
{
-
 
787
  if ((int32_t)(IRQn) >= 0)
-
 
788
  {
770
  NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
789
    NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
790
    __DSB();
-
 
791
    __ISB();
-
 
792
  }
771
}
793
}
772
 
794
 
773
 
795
 
774
/**
796
/**
775
  \brief   Get Pending Interrupt
797
  \brief   Get Pending Interrupt
776
  \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt.
798
  \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
777
  \param [in]      IRQn  Interrupt number.
799
  \param [in]      IRQn  Device specific interrupt number.
778
  \return             0  Interrupt status is not pending.
800
  \return             0  Interrupt status is not pending.
779
  \return             1  Interrupt status is pending.
801
  \return             1  Interrupt status is pending.
-
 
802
  \note    IRQn must not be negative.
780
 */
803
 */
781
__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
804
__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
782
{
805
{
-
 
806
  if ((int32_t)(IRQn) >= 0)
-
 
807
  {
783
  return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
808
    return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
-
 
809
  }
-
 
810
  else
-
 
811
  {
-
 
812
    return(0U);
-
 
813
  }
784
}
814
}
785
 
815
 
786
 
816
 
787
/**
817
/**
788
  \brief   Set Pending Interrupt
818
  \brief   Set Pending Interrupt
789
  \details Sets the pending bit of an external interrupt.
819
  \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
790
  \param [in]      IRQn  Interrupt number. Value cannot be negative.
820
  \param [in]      IRQn  Device specific interrupt number.
-
 
821
  \note    IRQn must not be negative.
791
 */
822
 */
792
__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
823
__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
793
{
824
{
-
 
825
  if ((int32_t)(IRQn) >= 0)
-
 
826
  {
794
  NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
827
    NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
828
  }
795
}
829
}
796
 
830
 
797
 
831
 
798
/**
832
/**
799
  \brief   Clear Pending Interrupt
833
  \brief   Clear Pending Interrupt
800
  \details Clears the pending bit of an external interrupt.
834
  \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
801
  \param [in]      IRQn  External interrupt number. Value cannot be negative.
835
  \param [in]      IRQn  Device specific interrupt number.
-
 
836
  \note    IRQn must not be negative.
802
 */
837
 */
803
__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
838
__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
804
{
839
{
-
 
840
  if ((int32_t)(IRQn) >= 0)
-
 
841
  {
805
  NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
842
    NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
843
  }
806
}
844
}
807
 
845
 
808
 
846
 
809
/**
847
/**
810
  \brief   Set Interrupt Priority
848
  \brief   Set Interrupt Priority
811
  \details Sets the priority of an interrupt.
849
  \details Sets the priority of a device specific interrupt or a processor exception.
812
  \note    The priority cannot be set for every core interrupt.
850
           The interrupt number can be positive to specify a device specific interrupt,
-
 
851
           or negative to specify a processor exception.
813
  \param [in]      IRQn  Interrupt number.
852
  \param [in]      IRQn  Interrupt number.
814
  \param [in]  priority  Priority to set.
853
  \param [in]  priority  Priority to set.
-
 
854
  \note    The priority cannot be set for every processor exception.
815
 */
855
 */
816
__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
856
__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
817
{
857
{
818
  if ((int32_t)(IRQn) < 0)
858
  if ((int32_t)(IRQn) >= 0)
819
  {
859
  {
820
    SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
860
    NVIC->IP[_IP_IDX(IRQn)]  = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)]  & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
821
       (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
861
       (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
822
  }
862
  }
823
  else
863
  else
824
  {
864
  {
825
    NVIC->IP[_IP_IDX(IRQn)]  = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)]  & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
865
    SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
826
       (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
866
       (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
827
  }
867
  }
828
}
868
}
829
 
869
 
830
 
870
 
831
/**
871
/**
832
  \brief   Get Interrupt Priority
872
  \brief   Get Interrupt Priority
833
  \details Reads the priority of an interrupt.
873
  \details Reads the priority of a device specific interrupt or a processor exception.
834
           The interrupt number can be positive to specify an external (device specific) interrupt,
874
           The interrupt number can be positive to specify a device specific interrupt,
835
           or negative to specify an internal (core) interrupt.
875
           or negative to specify a processor exception.
836
  \param [in]   IRQn  Interrupt number.
876
  \param [in]   IRQn  Interrupt number.
837
  \return             Interrupt Priority.
877
  \return             Interrupt Priority.
838
                      Value is aligned automatically to the implemented priority bits of the microcontroller.
878
                      Value is aligned automatically to the implemented priority bits of the microcontroller.
839
 */
879
 */
840
__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
880
__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
841
{
881
{
842
 
882
 
843
  if ((int32_t)(IRQn) < 0)
883
  if ((int32_t)(IRQn) >= 0)
844
  {
884
  {
845
    return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
885
    return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
846
  }
886
  }
847
  else
887
  else
848
  {
888
  {
849
    return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
889
    return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
850
  }
890
  }
851
}
891
}
852
 
892
 
853
 
893
 
854
/**
894
/**
-
 
895
  \brief   Set Interrupt Vector
-
 
896
  \details Sets an interrupt vector in SRAM based interrupt vector table.
-
 
897
           The interrupt number can be positive to specify a device specific interrupt,
-
 
898
           or negative to specify a processor exception.
-
 
899
           VTOR must been relocated to SRAM before.
-
 
900
  \param [in]   IRQn      Interrupt number
-
 
901
  \param [in]   vector    Address of interrupt handler function
-
 
902
 */
-
 
903
__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
-
 
904
{
-
 
905
  uint32_t *vectors = (uint32_t *)SCB->VTOR;
-
 
906
  vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
-
 
907
}
-
 
908
 
-
 
909
 
-
 
910
/**
-
 
911
  \brief   Get Interrupt Vector
-
 
912
  \details Reads an interrupt vector from interrupt vector table.
-
 
913
           The interrupt number can be positive to specify a device specific interrupt,
-
 
914
           or negative to specify a processor exception.
-
 
915
  \param [in]   IRQn      Interrupt number.
-
 
916
  \return                 Address of interrupt handler function
-
 
917
 */
-
 
918
__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
-
 
919
{
-
 
920
  uint32_t *vectors = (uint32_t *)SCB->VTOR;
-
 
921
  return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
-
 
922
}
-
 
923
 
-
 
924
 
-
 
925
/**
855
  \brief   System Reset
926
  \brief   System Reset
856
  \details Initiates a system reset request to reset the MCU.
927
  \details Initiates a system reset request to reset the MCU.
857
 */
928
 */
858
__STATIC_INLINE void NVIC_SystemReset(void)
929
__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
859
{
930
{
860
  __DSB();                                                          /* Ensure all outstanding memory accesses included
931
  __DSB();                                                          /* Ensure all outstanding memory accesses included
861
                                                                       buffered write are completed before reset */
932
                                                                       buffered write are completed before reset */
862
  SCB->AIRCR  = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
933
  SCB->AIRCR  = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
863
                 SCB_AIRCR_SYSRESETREQ_Msk);
934
                 SCB_AIRCR_SYSRESETREQ_Msk);
Line 870... Line 941...
870
}
941
}
871
 
942
 
872
/*@} end of CMSIS_Core_NVICFunctions */
943
/*@} end of CMSIS_Core_NVICFunctions */
873
 
944
 
874
 
945
 
-
 
946
/* ##########################  FPU functions  #################################### */
-
 
947
/**
-
 
948
  \ingroup  CMSIS_Core_FunctionInterface
-
 
949
  \defgroup CMSIS_Core_FpuFunctions FPU Functions
-
 
950
  \brief    Function that provides FPU type.
-
 
951
  @{
-
 
952
 */
-
 
953
 
-
 
954
/**
-
 
955
  \brief   get FPU type
-
 
956
  \details returns the FPU type
-
 
957
  \returns
-
 
958
   - \b  0: No FPU
-
 
959
   - \b  1: Single precision FPU
-
 
960
   - \b  2: Double + Single precision FPU
-
 
961
 */
-
 
962
__STATIC_INLINE uint32_t SCB_GetFPUType(void)
-
 
963
{
-
 
964
    return 0U;           /* No FPU */
-
 
965
}
-
 
966
 
-
 
967
 
-
 
968
/*@} end of CMSIS_Core_FpuFunctions */
-
 
969
 
-
 
970
 
875
 
971
 
876
/* ##################################    SysTick function  ############################################ */
972
/* ##################################    SysTick function  ############################################ */
877
/**
973
/**
878
  \ingroup  CMSIS_Core_FunctionInterface
974
  \ingroup  CMSIS_Core_FunctionInterface
879
  \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
975
  \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
880
  \brief    Functions that configure the System.
976
  \brief    Functions that configure the System.
881
  @{
977
  @{
882
 */
978
 */
883
 
979
 
884
#if (__Vendor_SysTickConfig == 0U)
980
#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
885
 
981
 
886
/**
982
/**
887
  \brief   System Tick Configuration
983
  \brief   System Tick Configuration
888
  \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
984
  \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
889
           Counter is in free running mode to generate periodic interrupts.
985
           Counter is in free running mode to generate periodic interrupts.