|
@@ -23,9 +23,9 @@
|
|
|
*/
|
|
|
|
|
|
#if defined ( __ICCARM__ )
|
|
|
- #pragma system_include /* treat file as system include file for MISRA check */
|
|
|
+ #pragma system_include /* treat file as system include file for MISRA check */
|
|
|
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
|
- #pragma clang system_header /* treat file as system include file */
|
|
|
+ #pragma clang system_header /* treat file as system include file */
|
|
|
#endif
|
|
|
|
|
|
#ifndef __CORE_CM0PLUS_H_GENERIC
|
|
@@ -34,7 +34,7 @@
|
|
|
#include <stdint.h>
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
- extern "C" {
|
|
|
+extern "C" {
|
|
|
#endif
|
|
|
|
|
|
/**
|
|
@@ -61,7 +61,7 @@
|
|
|
*/
|
|
|
|
|
|
#include "cmsis_version.h"
|
|
|
-
|
|
|
+
|
|
|
/* CMSIS CM0+ definitions */
|
|
|
#define __CM0PLUS_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
|
|
|
#define __CM0PLUS_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
|
|
@@ -76,39 +76,39 @@
|
|
|
#define __FPU_USED 0U
|
|
|
|
|
|
#if defined ( __CC_ARM )
|
|
|
- #if defined __TARGET_FPU_VFP
|
|
|
- #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
|
- #endif
|
|
|
+#if defined __TARGET_FPU_VFP
|
|
|
+#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
|
+#endif
|
|
|
|
|
|
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
|
- #if defined __ARM_PCS_VFP
|
|
|
- #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
|
- #endif
|
|
|
+#if defined __ARM_PCS_VFP
|
|
|
+#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
|
+#endif
|
|
|
|
|
|
#elif defined ( __GNUC__ )
|
|
|
- #if defined (__VFP_FP__) && !defined(__SOFTFP__)
|
|
|
- #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
|
- #endif
|
|
|
+#if defined (__VFP_FP__) && !defined(__SOFTFP__)
|
|
|
+#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
|
+#endif
|
|
|
|
|
|
#elif defined ( __ICCARM__ )
|
|
|
- #if defined __ARMVFP__
|
|
|
- #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
|
- #endif
|
|
|
+#if defined __ARMVFP__
|
|
|
+#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
|
+#endif
|
|
|
|
|
|
#elif defined ( __TI_ARM__ )
|
|
|
- #if defined __TI_VFP_SUPPORT__
|
|
|
- #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
|
- #endif
|
|
|
+#if defined __TI_VFP_SUPPORT__
|
|
|
+#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
|
+#endif
|
|
|
|
|
|
#elif defined ( __TASKING__ )
|
|
|
- #if defined __FPU_VFP__
|
|
|
- #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
|
- #endif
|
|
|
+#if defined __FPU_VFP__
|
|
|
+#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
|
+#endif
|
|
|
|
|
|
#elif defined ( __CSMC__ )
|
|
|
- #if ( __CSMC__ & 0x400U)
|
|
|
- #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
|
- #endif
|
|
|
+#if ( __CSMC__ & 0x400U)
|
|
|
+#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
|
|
+#endif
|
|
|
|
|
|
#endif
|
|
|
|
|
@@ -127,35 +127,35 @@
|
|
|
#define __CORE_CM0PLUS_H_DEPENDANT
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
- extern "C" {
|
|
|
+extern "C" {
|
|
|
#endif
|
|
|
|
|
|
/* check device defines and use defaults */
|
|
|
#if defined __CHECK_DEVICE_DEFINES
|
|
|
- #ifndef __CM0PLUS_REV
|
|
|
- #define __CM0PLUS_REV 0x0000U
|
|
|
- #warning "__CM0PLUS_REV not defined in device header file; using default!"
|
|
|
- #endif
|
|
|
-
|
|
|
- #ifndef __MPU_PRESENT
|
|
|
- #define __MPU_PRESENT 0U
|
|
|
- #warning "__MPU_PRESENT not defined in device header file; using default!"
|
|
|
- #endif
|
|
|
-
|
|
|
- #ifndef __VTOR_PRESENT
|
|
|
- #define __VTOR_PRESENT 0U
|
|
|
- #warning "__VTOR_PRESENT not defined in device header file; using default!"
|
|
|
- #endif
|
|
|
-
|
|
|
- #ifndef __NVIC_PRIO_BITS
|
|
|
- #define __NVIC_PRIO_BITS 2U
|
|
|
- #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
|
|
|
- #endif
|
|
|
-
|
|
|
- #ifndef __Vendor_SysTickConfig
|
|
|
- #define __Vendor_SysTickConfig 0U
|
|
|
- #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
|
|
|
- #endif
|
|
|
+#ifndef __CM0PLUS_REV
|
|
|
+#define __CM0PLUS_REV 0x0000U
|
|
|
+#warning "__CM0PLUS_REV not defined in device header file; using default!"
|
|
|
+#endif
|
|
|
+
|
|
|
+#ifndef __MPU_PRESENT
|
|
|
+#define __MPU_PRESENT 0U
|
|
|
+#warning "__MPU_PRESENT not defined in device header file; using default!"
|
|
|
+#endif
|
|
|
+
|
|
|
+#ifndef __VTOR_PRESENT
|
|
|
+#define __VTOR_PRESENT 0U
|
|
|
+#warning "__VTOR_PRESENT not defined in device header file; using default!"
|
|
|
+#endif
|
|
|
+
|
|
|
+#ifndef __NVIC_PRIO_BITS
|
|
|
+#define __NVIC_PRIO_BITS 2U
|
|
|
+#warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
|
|
|
+#endif
|
|
|
+
|
|
|
+#ifndef __Vendor_SysTickConfig
|
|
|
+#define __Vendor_SysTickConfig 0U
|
|
|
+#warning "__Vendor_SysTickConfig not defined in device header file; using default!"
|
|
|
+#endif
|
|
|
#endif
|
|
|
|
|
|
/* IO definitions (access restrictions to peripheral registers) */
|
|
@@ -167,9 +167,9 @@
|
|
|
\li for automatic generation of peripheral register debug information.
|
|
|
*/
|
|
|
#ifdef __cplusplus
|
|
|
- #define __I volatile /*!< Defines 'read only' permissions */
|
|
|
+#define __I volatile /*!< Defines 'read only' permissions */
|
|
|
#else
|
|
|
- #define __I volatile const /*!< Defines 'read only' permissions */
|
|
|
+#define __I volatile const /*!< Defines 'read only' permissions */
|
|
|
#endif
|
|
|
#define __O volatile /*!< Defines 'write only' permissions */
|
|
|
#define __IO volatile /*!< Defines 'read / write' permissions */
|
|
@@ -209,15 +209,15 @@
|
|
|
*/
|
|
|
typedef union
|
|
|
{
|
|
|
- struct
|
|
|
- {
|
|
|
- uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
|
|
|
- uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
|
|
|
- uint32_t C:1; /*!< bit: 29 Carry condition code flag */
|
|
|
- uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
|
|
|
- uint32_t N:1; /*!< bit: 31 Negative condition code flag */
|
|
|
- } b; /*!< Structure used for bit access */
|
|
|
- uint32_t w; /*!< Type used for word access */
|
|
|
+ struct
|
|
|
+ {
|
|
|
+ uint32_t _reserved0: 28; /*!< bit: 0..27 Reserved */
|
|
|
+ uint32_t V: 1; /*!< bit: 28 Overflow condition code flag */
|
|
|
+ uint32_t C: 1; /*!< bit: 29 Carry condition code flag */
|
|
|
+ uint32_t Z: 1; /*!< bit: 30 Zero condition code flag */
|
|
|
+ uint32_t N: 1; /*!< bit: 31 Negative condition code flag */
|
|
|
+ } b; /*!< Structure used for bit access */
|
|
|
+ uint32_t w; /*!< Type used for word access */
|
|
|
} APSR_Type;
|
|
|
|
|
|
/* APSR Register Definitions */
|
|
@@ -239,12 +239,12 @@ typedef union
|
|
|
*/
|
|
|
typedef union
|
|
|
{
|
|
|
- struct
|
|
|
- {
|
|
|
- uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
|
|
|
- uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
|
|
|
- } b; /*!< Structure used for bit access */
|
|
|
- uint32_t w; /*!< Type used for word access */
|
|
|
+ struct
|
|
|
+ {
|
|
|
+ uint32_t ISR: 9; /*!< bit: 0.. 8 Exception number */
|
|
|
+ uint32_t _reserved0: 23; /*!< bit: 9..31 Reserved */
|
|
|
+ } b; /*!< Structure used for bit access */
|
|
|
+ uint32_t w; /*!< Type used for word access */
|
|
|
} IPSR_Type;
|
|
|
|
|
|
/* IPSR Register Definitions */
|
|
@@ -257,18 +257,18 @@ typedef union
|
|
|
*/
|
|
|
typedef union
|
|
|
{
|
|
|
- struct
|
|
|
- {
|
|
|
- uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
|
|
|
- uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
|
|
|
- uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
|
|
|
- uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
|
|
|
- uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
|
|
|
- uint32_t C:1; /*!< bit: 29 Carry condition code flag */
|
|
|
- uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
|
|
|
- uint32_t N:1; /*!< bit: 31 Negative condition code flag */
|
|
|
- } b; /*!< Structure used for bit access */
|
|
|
- uint32_t w; /*!< Type used for word access */
|
|
|
+ struct
|
|
|
+ {
|
|
|
+ uint32_t ISR: 9; /*!< bit: 0.. 8 Exception number */
|
|
|
+ uint32_t _reserved0: 15; /*!< bit: 9..23 Reserved */
|
|
|
+ uint32_t T: 1; /*!< bit: 24 Thumb bit (read 0) */
|
|
|
+ uint32_t _reserved1: 3; /*!< bit: 25..27 Reserved */
|
|
|
+ uint32_t V: 1; /*!< bit: 28 Overflow condition code flag */
|
|
|
+ uint32_t C: 1; /*!< bit: 29 Carry condition code flag */
|
|
|
+ uint32_t Z: 1; /*!< bit: 30 Zero condition code flag */
|
|
|
+ uint32_t N: 1; /*!< bit: 31 Negative condition code flag */
|
|
|
+ } b; /*!< Structure used for bit access */
|
|
|
+ uint32_t w; /*!< Type used for word access */
|
|
|
} xPSR_Type;
|
|
|
|
|
|
/* xPSR Register Definitions */
|
|
@@ -296,13 +296,13 @@ typedef union
|
|
|
*/
|
|
|
typedef union
|
|
|
{
|
|
|
- struct
|
|
|
- {
|
|
|
- uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
|
|
|
- uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
|
|
|
- uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
|
|
|
- } b; /*!< Structure used for bit access */
|
|
|
- uint32_t w; /*!< Type used for word access */
|
|
|
+ struct
|
|
|
+ {
|
|
|
+ uint32_t nPRIV: 1; /*!< bit: 0 Execution privilege in Thread mode */
|
|
|
+ uint32_t SPSEL: 1; /*!< bit: 1 Stack to be used */
|
|
|
+ uint32_t _reserved1: 30; /*!< bit: 2..31 Reserved */
|
|
|
+ } b; /*!< Structure used for bit access */
|
|
|
+ uint32_t w; /*!< Type used for word access */
|
|
|
} CONTROL_Type;
|
|
|
|
|
|
/* CONTROL Register Definitions */
|
|
@@ -327,16 +327,16 @@ typedef union
|
|
|
*/
|
|
|
typedef struct
|
|
|
{
|
|
|
- __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
|
|
|
- uint32_t RESERVED0[31U];
|
|
|
- __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
|
|
|
- uint32_t RSERVED1[31U];
|
|
|
- __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
|
|
|
- uint32_t RESERVED2[31U];
|
|
|
- __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
|
|
|
- uint32_t RESERVED3[31U];
|
|
|
- uint32_t RESERVED4[64U];
|
|
|
- __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
|
|
|
+ __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
|
|
|
+ uint32_t RESERVED0[31U];
|
|
|
+ __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
|
|
|
+ uint32_t RSERVED1[31U];
|
|
|
+ __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
|
|
|
+ uint32_t RESERVED2[31U];
|
|
|
+ __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
|
|
|
+ uint32_t RESERVED3[31U];
|
|
|
+ uint32_t RESERVED4[64U];
|
|
|
+ __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
|
|
|
} NVIC_Type;
|
|
|
|
|
|
/*@} end of group CMSIS_NVIC */
|
|
@@ -354,19 +354,19 @@ typedef struct
|
|
|
*/
|
|
|
typedef struct
|
|
|
{
|
|
|
- __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
|
|
|
- __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
|
|
|
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
|
|
|
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
|
|
|
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
|
|
|
- __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
|
|
|
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
|
|
|
#else
|
|
|
- uint32_t RESERVED0;
|
|
|
+ uint32_t RESERVED0;
|
|
|
#endif
|
|
|
- __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
|
|
|
- __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
|
|
|
- __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
|
|
|
- uint32_t RESERVED1;
|
|
|
- __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
|
|
|
- __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
|
|
|
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
|
|
|
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
|
|
|
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
|
|
|
+ uint32_t RESERVED1;
|
|
|
+ __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
|
|
|
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
|
|
|
} SCB_Type;
|
|
|
|
|
|
/* SCB CPUID Register Definitions */
|
|
@@ -471,10 +471,10 @@ typedef struct
|
|
|
*/
|
|
|
typedef struct
|
|
|
{
|
|
|
- __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
|
|
|
- __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
|
|
|
- __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
|
|
|
- __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
|
|
|
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
|
|
|
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
|
|
|
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
|
|
|
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
|
|
|
} SysTick_Type;
|
|
|
|
|
|
/* SysTick Control / Status Register Definitions */
|
|
@@ -523,11 +523,11 @@ typedef struct
|
|
|
*/
|
|
|
typedef struct
|
|
|
{
|
|
|
- __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
|
|
|
- __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
|
|
|
- __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
|
|
|
- __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
|
|
|
- __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
|
|
|
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
|
|
|
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
|
|
|
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
|
|
|
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
|
|
|
+ __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
|
|
|
} MPU_Type;
|
|
|
|
|
|
/* MPU Type Register Definitions */
|
|
@@ -653,8 +653,8 @@ typedef struct
|
|
|
#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
|
|
|
|
|
|
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
|
|
|
- #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
|
|
|
- #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
|
|
|
+#define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
|
|
|
+#define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
|
|
|
#endif
|
|
|
|
|
|
/*@} */
|
|
@@ -683,33 +683,33 @@ typedef struct
|
|
|
*/
|
|
|
|
|
|
#ifdef CMSIS_NVIC_VIRTUAL
|
|
|
- #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
|
|
|
- #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
|
|
|
- #endif
|
|
|
- #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
|
|
|
+#ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
|
|
|
+#define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
|
|
|
+#endif
|
|
|
+#include CMSIS_NVIC_VIRTUAL_HEADER_FILE
|
|
|
#else
|
|
|
/*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for Cortex-M0+ */
|
|
|
/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for Cortex-M0+ */
|
|
|
- #define NVIC_EnableIRQ __NVIC_EnableIRQ
|
|
|
- #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
|
|
|
- #define NVIC_DisableIRQ __NVIC_DisableIRQ
|
|
|
- #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
|
|
|
- #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
|
|
|
- #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
|
|
|
+#define NVIC_EnableIRQ __NVIC_EnableIRQ
|
|
|
+#define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
|
|
|
+#define NVIC_DisableIRQ __NVIC_DisableIRQ
|
|
|
+#define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
|
|
|
+#define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
|
|
|
+#define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
|
|
|
/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M0+ */
|
|
|
- #define NVIC_SetPriority __NVIC_SetPriority
|
|
|
- #define NVIC_GetPriority __NVIC_GetPriority
|
|
|
- #define NVIC_SystemReset __NVIC_SystemReset
|
|
|
+#define NVIC_SetPriority __NVIC_SetPriority
|
|
|
+#define NVIC_GetPriority __NVIC_GetPriority
|
|
|
+#define NVIC_SystemReset __NVIC_SystemReset
|
|
|
#endif /* CMSIS_NVIC_VIRTUAL */
|
|
|
|
|
|
#ifdef CMSIS_VECTAB_VIRTUAL
|
|
|
- #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
|
|
|
- #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
|
|
|
- #endif
|
|
|
- #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
|
|
|
+#ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
|
|
|
+#define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
|
|
|
+#endif
|
|
|
+#include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
|
|
|
#else
|
|
|
- #define NVIC_SetVector __NVIC_SetVector
|
|
|
- #define NVIC_GetVector __NVIC_GetVector
|
|
|
+#define NVIC_SetVector __NVIC_SetVector
|
|
|
+#define NVIC_GetVector __NVIC_GetVector
|
|
|
#endif /* (CMSIS_VECTAB_VIRTUAL) */
|
|
|
|
|
|
#define NVIC_USER_IRQ_OFFSET 16
|
|
@@ -730,10 +730,10 @@ typedef struct
|
|
|
*/
|
|
|
__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
|
|
|
{
|
|
|
- if ((int32_t)(IRQn) >= 0)
|
|
|
- {
|
|
|
- NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
|
- }
|
|
|
+ if ((int32_t)(IRQn) >= 0)
|
|
|
+ {
|
|
|
+ NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -747,14 +747,14 @@ __STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
|
|
|
*/
|
|
|
__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
|
|
|
{
|
|
|
- if ((int32_t)(IRQn) >= 0)
|
|
|
- {
|
|
|
- return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return(0U);
|
|
|
- }
|
|
|
+ if ((int32_t)(IRQn) >= 0)
|
|
|
+ {
|
|
|
+ return ((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return (0U);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -766,12 +766,12 @@ __STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
|
|
|
*/
|
|
|
__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
|
|
|
{
|
|
|
- if ((int32_t)(IRQn) >= 0)
|
|
|
- {
|
|
|
- NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
|
- __DSB();
|
|
|
- __ISB();
|
|
|
- }
|
|
|
+ if ((int32_t)(IRQn) >= 0)
|
|
|
+ {
|
|
|
+ NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
|
+ __DSB();
|
|
|
+ __ISB();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -785,14 +785,14 @@ __STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
|
|
|
*/
|
|
|
__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
|
|
|
{
|
|
|
- if ((int32_t)(IRQn) >= 0)
|
|
|
- {
|
|
|
- return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return(0U);
|
|
|
- }
|
|
|
+ if ((int32_t)(IRQn) >= 0)
|
|
|
+ {
|
|
|
+ return ((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return (0U);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -804,10 +804,10 @@ __STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
|
|
|
*/
|
|
|
__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
|
|
|
{
|
|
|
- if ((int32_t)(IRQn) >= 0)
|
|
|
- {
|
|
|
- NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
|
- }
|
|
|
+ if ((int32_t)(IRQn) >= 0)
|
|
|
+ {
|
|
|
+ NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -819,10 +819,10 @@ __STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
|
|
|
*/
|
|
|
__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
|
|
|
{
|
|
|
- if ((int32_t)(IRQn) >= 0)
|
|
|
- {
|
|
|
- NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
|
- }
|
|
|
+ if ((int32_t)(IRQn) >= 0)
|
|
|
+ {
|
|
|
+ NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -837,16 +837,16 @@ __STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
|
|
|
*/
|
|
|
__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
|
|
|
{
|
|
|
- if ((int32_t)(IRQn) >= 0)
|
|
|
- {
|
|
|
- NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
|
|
|
- (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
|
|
|
- (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
|
|
|
- }
|
|
|
+ if ((int32_t)(IRQn) >= 0)
|
|
|
+ {
|
|
|
+ NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
|
|
|
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
|
|
|
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -862,14 +862,14 @@ __STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
|
|
|
__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
|
|
|
{
|
|
|
|
|
|
- if ((int32_t)(IRQn) >= 0)
|
|
|
- {
|
|
|
- return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
|
|
|
- }
|
|
|
+ if ((int32_t)(IRQn) >= 0)
|
|
|
+ {
|
|
|
+ return ((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn)) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return ((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn)) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -886,11 +886,11 @@ __STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
|
|
|
__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
|
|
|
{
|
|
|
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
|
|
|
- uint32_t *vectors = (uint32_t *)SCB->VTOR;
|
|
|
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
|
|
|
#else
|
|
|
uint32_t *vectors = (uint32_t *)0x0U;
|
|
|
#endif
|
|
|
- vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
|
|
|
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -905,11 +905,11 @@ __STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
|
|
|
__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
|
|
|
{
|
|
|
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
|
|
|
- uint32_t *vectors = (uint32_t *)SCB->VTOR;
|
|
|
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
|
|
|
#else
|
|
|
- uint32_t *vectors = (uint32_t *)0x0U;
|
|
|
+ uint32_t *vectors = (uint32_t *)0x0U;
|
|
|
#endif
|
|
|
- return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
|
|
|
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
|
|
|
|
|
|
}
|
|
|
|
|
@@ -920,16 +920,16 @@ __STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
|
|
|
*/
|
|
|
__STATIC_INLINE void __NVIC_SystemReset(void)
|
|
|
{
|
|
|
- __DSB(); /* Ensure all outstanding memory accesses included
|
|
|
+ __DSB(); /* Ensure all outstanding memory accesses included
|
|
|
buffered write are completed before reset */
|
|
|
- SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
|
|
|
- SCB_AIRCR_SYSRESETREQ_Msk);
|
|
|
- __DSB(); /* Ensure completion of memory access */
|
|
|
-
|
|
|
- for(;;) /* wait until reset */
|
|
|
- {
|
|
|
- __NOP();
|
|
|
- }
|
|
|
+ SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
|
|
|
+ SCB_AIRCR_SYSRESETREQ_Msk);
|
|
|
+ __DSB(); /* Ensure completion of memory access */
|
|
|
+
|
|
|
+ for (;;) /* wait until reset */
|
|
|
+ {
|
|
|
+ __NOP();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/*@} end of CMSIS_Core_NVICFunctions */
|
|
@@ -991,18 +991,18 @@ __STATIC_INLINE uint32_t SCB_GetFPUType(void)
|
|
|
*/
|
|
|
__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
|
|
|
{
|
|
|
- if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
|
|
|
- {
|
|
|
- return (1UL); /* Reload value impossible */
|
|
|
- }
|
|
|
-
|
|
|
- SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
|
|
|
- NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
|
|
|
- SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
|
|
- SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
|
|
|
- SysTick_CTRL_TICKINT_Msk |
|
|
|
- SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
|
|
|
- return (0UL); /* Function successful */
|
|
|
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
|
|
|
+ {
|
|
|
+ return (1UL); /* Reload value impossible */
|
|
|
+ }
|
|
|
+
|
|
|
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
|
|
|
+ NVIC_SetPriority(SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
|
|
|
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
|
|
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
|
|
|
+ SysTick_CTRL_TICKINT_Msk |
|
|
|
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
|
|
|
+ return (0UL); /* Function successful */
|
|
|
}
|
|
|
|
|
|
#endif
|