?? core_cm0.h
字號(hào):
/******************** (C) COPYRIGHT 2010 Embest Info&Tech Co.,LTD. ************
* 文件名: core_cm0.h
* 作者 : Wuhan R&D Center, Embest
* 日期 : 01/18/2010
* 描述 : CMSIS Cortex-M0核外圍訪問(wèn)層頭文件
*******************************************************************************
*******************************************************************************
* 歷史:
* 01/18/2010 : V1.0 初始版本
*******************************************************************************/
/* Includes ------------------------------------------------------------------*/
#ifndef __CM0_CORE_H__
#define __CM0_CORE_H__
#ifdef __cplusplus
extern "C" {
#endif
#define __CM0_CMSIS_VERSION_MAIN (0x01) /*!< [31:16] CMSIS HAL 主版本號(hào) */
#define __CM0_CMSIS_VERSION_SUB (0x20) /*!< [15:0] CMSIS HAL 子版本號(hào) */
#define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16) | __CM0_CMSIS_VERSION_SUB) /*!< CMSIS HAL 版本號(hào) */
#define __CORTEX_M (0x00) /*!< Cortex 核 */
#include <stdint.h>
#if defined (__ICCARM__)
#include <intrinsics.h> /* IAR 內(nèi)聯(lián) */
#endif
#ifndef __NVIC_PRIO_BITS
#define __NVIC_PRIO_BITS 2 /*!< NVIC優(yōu)先級(jí)位數(shù)定義*/
#endif
/**
* IO 定義
*
* 定義外圍寄存器訪問(wèn)權(quán)限
*/
#ifdef __cplusplus
#define __I volatile /*!< 'read only'允許 */
#else
#define __I volatile const /*!< 'read only'允許 */
#endif
#define __O volatile /*!< 'write only'允許 */
#define __IO volatile /*!< 'read / write'可讀寫(xiě) */
/* Private typedef ------------------------------------------------------------*/
/* System Reset */
#define NVIC_VECTRESET 0 /*!< 向量表復(fù)位 */
#define NVIC_SYSRESETREQ 2 /*!< 系統(tǒng)復(fù)位請(qǐng)求 */
#define NVIC_AIRCR_VECTKEY (0x5FA << 16) /*!< AIRCR Key用于寫(xiě)允許 */
#define NVIC_AIRCR_ENDIANESS 15 /*!< 端對(duì)齊 */
/* 嵌套向量中斷控制器(NVIC)寄存器映射 */
typedef struct
{
__IO uint32_t ISER[1]; /*!< 中斷設(shè)置使能寄存器 */
uint32_t RESERVED0[31];
__IO uint32_t ICER[1]; /*!< 中斷清除使能寄存器 */
uint32_t RSERVED1[31];
__IO uint32_t ISPR[1]; /*!< 中斷設(shè)置懸起寄存器 */
uint32_t RESERVED2[31];
__IO uint32_t ICPR[1]; /*!< 中斷清除懸起寄存器 */
uint32_t RESERVED3[31];
uint32_t RESERVED4[64];
__IO uint32_t IPR[8]; /*!< 中斷優(yōu)先級(jí)寄存器 */
} NVIC_Type;
/* 系統(tǒng)控制塊寄存器映射 */
typedef struct
{
__I uint32_t CPUID; /*!< CPU ID基址寄存器 */
__IO uint32_t ICSR; /*!< 中斷控制狀態(tài)寄存器 */
uint32_t RESERVED0;
__IO uint32_t AIRCR; /*!< 應(yīng)用程序中斷/復(fù)位控制寄存器 */
__IO uint32_t SCR; /*!< 系統(tǒng)控制寄存器 */
__IO uint32_t CCR; /*!< 配置控制寄存器 */
uint32_t RESERVED1;
__IO uint32_t SHP[2]; /*!< 系統(tǒng)處理優(yōu)先級(jí)寄存器,0位保留 */
__IO uint32_t SHCSR; /*!< 系統(tǒng)處理控制和狀態(tài)寄存器 */
uint32_t RESERVED2[2];
__IO uint32_t DFSR; /*!< 調(diào)試故障狀態(tài)寄存器 */
} SCB_Type;
/* 系統(tǒng)滴答存儲(chǔ)器映射 */
typedef struct
{
__IO uint32_t CTRL; /*!< SysTick控制和狀態(tài)寄存器 */
__IO uint32_t LOAD; /*!< SysTick重裝載值寄存器 */
__IO uint32_t VAL; /*!< SysTick當(dāng)前值寄存器 */
__I uint32_t CALIB; /*!< SysTick校驗(yàn)寄存器 */
} SysTick_Type;
/* 內(nèi)核調(diào)試寄存器 */
typedef struct
{
__IO uint32_t DHCSR; /*!< 調(diào)試停機(jī)控制和狀態(tài)寄存器 */
__O uint32_t DCRSR; /*!< 調(diào)試內(nèi)核寄存器選擇寄存器 */
__IO uint32_t DCRDR; /*!< 調(diào)試內(nèi)核寄存器數(shù)據(jù)寄存器 */
__IO uint32_t DEMCR; /*!< 調(diào)試異常和監(jiān)控控制寄存器 */
} CoreDebug_Type;
/* Cortex-M0硬件存儲(chǔ)器映射 */
#define SCS_BASE (0xE000E000) /*!< 系統(tǒng)控制空間基地址 */
#define CoreDebug_BASE (0xE000EDF0) /*!< 內(nèi)核調(diào)試基地址 */
#define SysTick_BASE (SCS_BASE + 0x0010) /*!< SysTick基地址 */
#define NVIC_BASE (SCS_BASE + 0x0100) /*!< NVIC基地址 */
#define SCB_BASE (SCS_BASE + 0x0D00) /*!< 系統(tǒng)控制塊基地址 */
#define SCB ((SCB_Type *) SCB_BASE) /*!< SCB配置結(jié)構(gòu) */
#define SysTick ((SysTick_Type *) SysTick_BASE) /*!< SysTick配置結(jié)構(gòu) */
#define NVIC ((NVIC_Type *) NVIC_BASE) /*!< NVIC配置結(jié)構(gòu) */
#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug配置結(jié)構(gòu) */
/*******************************************************************************
* 硬件抽象層
******************************************************************************/
#if defined ( __CC_ARM )
#define __ASM __asm
#define __INLINE __inline
#elif defined ( __ICCARM__ )
#define __ASM __asm
#define __INLINE inline
#elif defined ( __GNUC__ )
#define __ASM __asm
#define __INLINE inline
#elif defined ( __TASKING__ )
#define __ASM __asm
#define __INLINE inline
#endif
/* ################### 編譯器特性相關(guān) ########################### */
#if defined ( __CC_ARM ) /*------------------RealView編譯器 -----------------*/
#define __enable_fault_irq __enable_fiq
#define __disable_fault_irq __disable_fiq
#define __NOP __nop
#define __WFI __wfi
#define __WFE __wfe
#define __SEV __sev
#define __ISB() __isb(0)
#define __DSB() __dsb(0)
#define __DMB() __dmb(0)
#define __REV __rev
/* intrinsic void __enable_irq(); */
/* intrinsic void __disable_irq(); */
extern uint32_t __get_PSP(void);
extern void __set_PSP(uint32_t topOfProcStack);
extern uint32_t __get_MSP(void);
extern void __set_MSP(uint32_t topOfMainStack);
extern uint32_t __REV16(uint16_t value);
extern int32_t __REVSH(int16_t value);
#if (__ARMCC_VERSION < 400000)
extern uint32_t __get_PRIMASK(void);
extern void __set_PRIMASK(uint32_t priMask);
extern uint32_t __get_CONTROL(void);
extern void __set_CONTROL(uint32_t control);
#else /* (__ARMCC_VERSION >= 400000) */
/**
* @函數(shù)名:__get_PRIMASK
* @描述:獲取優(yōu)先級(jí)屏蔽狀態(tài)
* @參數(shù): 無(wú)
* @返回值:uint32_t PriMask
*/
static __INLINE uint32_t __get_PRIMASK(void)
{
register uint32_t __regPriMask __ASM("primask");
return(__regPriMask);
}
/**
* @函數(shù)名:__set_PRIMASK
* @描述:配置優(yōu)先級(jí)屏蔽寄存器
* @參數(shù): uint32_t PriMask
* @返回值:無(wú)
*/
static __INLINE void __set_PRIMASK(uint32_t priMask)
{
register uint32_t __regPriMask __ASM("primask");
__regPriMask = (priMask);
}
/**
* @函數(shù)名:__get_CONTROL
* @描述:返回控制寄存器值
* @參數(shù): 無(wú)
* @返回值:uint32_t 控制寄存器值
*/
static __INLINE uint32_t __get_CONTROL(void)
{
register uint32_t __regControl __ASM("control");
return(__regControl);
}
/**
* @函數(shù)名:__set_CONTROL
* @描述:設(shè)置控制寄存器
* @參數(shù): uint32_t 控制寄存器值
* @返回值:無(wú)
*/
static __INLINE void __set_CONTROL(uint32_t control)
{
register uint32_t __regControl __ASM("control");
__regControl = control;
}
#endif /* __ARMCC_VERSION */
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -