112d8a729Srev13@wp.pl /* 212d8a729Srev13@wp.pl * (C) Copyright 2010,2011 312d8a729Srev13@wp.pl * Vladimir Khusainov, Emcraft Systems, vlad@emcraft.com 412d8a729Srev13@wp.pl * 512d8a729Srev13@wp.pl * (C) Copyright 2015 65be93569SKamil Lulko * Kamil Lulko, <kamil.lulko@gmail.com> 712d8a729Srev13@wp.pl * 812d8a729Srev13@wp.pl * SPDX-License-Identifier: GPL-2.0+ 912d8a729Srev13@wp.pl */ 1012d8a729Srev13@wp.pl 1112d8a729Srev13@wp.pl #ifndef ARMV7M_H 1212d8a729Srev13@wp.pl #define ARMV7M_H 1312d8a729Srev13@wp.pl 1412d8a729Srev13@wp.pl #if defined(__ASSEMBLY__) 1512d8a729Srev13@wp.pl .syntax unified 1612d8a729Srev13@wp.pl .thumb 1712d8a729Srev13@wp.pl #endif 1812d8a729Srev13@wp.pl 19*bf4d0495SVikas Manocha /* armv7m fixed base addresses */ 20*bf4d0495SVikas Manocha #define V7M_SCS_BASE 0xE000E000 21*bf4d0495SVikas Manocha #define V7M_NVIC_BASE (V7M_SCS_BASE + 0x0100) 22*bf4d0495SVikas Manocha #define V7M_SCB_BASE (V7M_SCS_BASE + 0x0D00) 23*bf4d0495SVikas Manocha #define V7M_PROC_FTR_BASE (V7M_SCS_BASE + 0x0D78) 24*bf4d0495SVikas Manocha #define V7M_MPU_BASE (V7M_SCS_BASE + 0x0D90) 25*bf4d0495SVikas Manocha #define V7M_FPU_BASE (V7M_SCS_BASE + 0x0F30) 26*bf4d0495SVikas Manocha #define V7M_CACHE_MAINT_BASE (V7M_SCS_BASE + 0x0F50) 27*bf4d0495SVikas Manocha #define V7M_ACCESS_CNTL_BASE (V7M_SCS_BASE + 0x0F90) 2812d8a729Srev13@wp.pl 2912d8a729Srev13@wp.pl #define V7M_SCB_VTOR 0x08 3012d8a729Srev13@wp.pl 3112d8a729Srev13@wp.pl #if !defined(__ASSEMBLY__) 3212d8a729Srev13@wp.pl struct v7m_scb { 3312d8a729Srev13@wp.pl uint32_t cpuid; /* CPUID Base Register */ 3412d8a729Srev13@wp.pl uint32_t icsr; /* Interrupt Control and State Register */ 3512d8a729Srev13@wp.pl uint32_t vtor; /* Vector Table Offset Register */ 3612d8a729Srev13@wp.pl uint32_t aircr; /* App Interrupt and Reset Control Register */ 37*bf4d0495SVikas Manocha uint32_t scr; /* offset 0x10: System Control Register */ 38*bf4d0495SVikas Manocha uint32_t ccr; /* offset 0x14: Config and Control Register */ 39*bf4d0495SVikas Manocha uint32_t shpr1; /* offset 0x18: System Handler Priority Reg 1 */ 40*bf4d0495SVikas Manocha uint32_t shpr2; /* offset 0x1c: System Handler Priority Reg 2 */ 41*bf4d0495SVikas Manocha uint32_t shpr3; /* offset 0x20: System Handler Priority Reg 3 */ 42*bf4d0495SVikas Manocha uint32_t shcrs; /* offset 0x24: System Handler Control State */ 43*bf4d0495SVikas Manocha uint32_t cfsr; /* offset 0x28: Configurable Fault Status Reg */ 44*bf4d0495SVikas Manocha uint32_t hfsr; /* offset 0x2C: HardFault Status Register */ 45*bf4d0495SVikas Manocha uint32_t res; /* offset 0x30: reserved */ 46*bf4d0495SVikas Manocha uint32_t mmar; /* offset 0x34: MemManage Fault Address Reg */ 47*bf4d0495SVikas Manocha uint32_t bfar; /* offset 0x38: BusFault Address Reg */ 48*bf4d0495SVikas Manocha uint32_t afsr; /* offset 0x3C: Auxiliary Fault Status Reg */ 4912d8a729Srev13@wp.pl }; 5012d8a729Srev13@wp.pl #define V7M_SCB ((struct v7m_scb *)V7M_SCB_BASE) 5112d8a729Srev13@wp.pl 5212d8a729Srev13@wp.pl #define V7M_AIRCR_VECTKEY 0x5fa 5312d8a729Srev13@wp.pl #define V7M_AIRCR_VECTKEY_SHIFT 16 5412d8a729Srev13@wp.pl #define V7M_AIRCR_ENDIAN (1 << 15) 5512d8a729Srev13@wp.pl #define V7M_AIRCR_PRIGROUP_SHIFT 8 5612d8a729Srev13@wp.pl #define V7M_AIRCR_PRIGROUP_MSK (0x7 << V7M_AIRCR_PRIGROUP_SHIFT) 5712d8a729Srev13@wp.pl #define V7M_AIRCR_SYSRESET (1 << 2) 5812d8a729Srev13@wp.pl 5912d8a729Srev13@wp.pl #define V7M_ICSR_VECTACT_MSK 0xFF 6012d8a729Srev13@wp.pl 61*bf4d0495SVikas Manocha #define V7M_CCR_DCACHE 16 62*bf4d0495SVikas Manocha #define V7M_CCR_ICACHE 17 63*bf4d0495SVikas Manocha 6412d8a729Srev13@wp.pl struct v7m_mpu { 6512d8a729Srev13@wp.pl uint32_t type; /* Type Register */ 6612d8a729Srev13@wp.pl uint32_t ctrl; /* Control Register */ 6712d8a729Srev13@wp.pl uint32_t rnr; /* Region Number Register */ 6812d8a729Srev13@wp.pl uint32_t rbar; /* Region Base Address Register */ 6912d8a729Srev13@wp.pl uint32_t rasr; /* Region Attribute and Size Register */ 7012d8a729Srev13@wp.pl }; 7112d8a729Srev13@wp.pl #define V7M_MPU ((struct v7m_mpu *)V7M_MPU_BASE) 7212d8a729Srev13@wp.pl 7312d8a729Srev13@wp.pl #endif /* !defined(__ASSEMBLY__) */ 7412d8a729Srev13@wp.pl #endif /* ARMV7M_H */ 75