1 /* 2 * Copyright (c) 2006-2020, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 */ 9 10 #ifndef CPUPORT_H__ 11 #define CPUPORT_H__ 12 13 #include <rtcompiler.h> 14 15 /* the exception stack without VFP registers */ 16 struct rt_hw_exp_stack 17 { 18 unsigned long r0; 19 unsigned long r1; 20 unsigned long r2; 21 unsigned long r3; 22 unsigned long r4; 23 unsigned long r5; 24 unsigned long r6; 25 unsigned long r7; 26 unsigned long r8; 27 unsigned long r9; 28 unsigned long r10; 29 unsigned long fp; 30 unsigned long ip; 31 unsigned long sp; 32 unsigned long lr; 33 unsigned long pc; 34 unsigned long cpsr; 35 }; 36 37 struct rt_hw_stack 38 { 39 unsigned long cpsr; 40 unsigned long r0; 41 unsigned long r1; 42 unsigned long r2; 43 unsigned long r3; 44 unsigned long r4; 45 unsigned long r5; 46 unsigned long r6; 47 unsigned long r7; 48 unsigned long r8; 49 unsigned long r9; 50 unsigned long r10; 51 unsigned long fp; 52 unsigned long ip; 53 unsigned long lr; 54 unsigned long pc; 55 }; 56 57 #define USERMODE 0x10 58 #define FIQMODE 0x11 59 #define IRQMODE 0x12 60 #define SVCMODE 0x13 61 #define MONITORMODE 0x16 62 #define ABORTMODE 0x17 63 #define HYPMODE 0x1b 64 #define UNDEFMODE 0x1b 65 #define MODEMASK 0x1f 66 #define NOINT 0xc0 67 68 #define T_Bit (1<<5) 69 #define F_Bit (1<<6) 70 #define I_Bit (1<<7) 71 #define A_Bit (1<<8) 72 #define E_Bit (1<<9) 73 #define J_Bit (1<<24) 74 75 #ifdef RT_USING_SMP 76 typedef union { 77 unsigned long slock; 78 struct __arch_tickets { 79 unsigned short owner; 80 unsigned short next; 81 } tickets; 82 } rt_hw_spinlock_t; 83 #endif 84 rt_hw_isb(void)85rt_inline void rt_hw_isb(void) 86 { 87 __asm volatile ("isb":::"memory"); 88 } 89 rt_hw_dmb(void)90rt_inline void rt_hw_dmb(void) 91 { 92 __asm volatile ("dmb":::"memory"); 93 } 94 rt_hw_dsb(void)95rt_inline void rt_hw_dsb(void) 96 { 97 __asm volatile ("dsb":::"memory"); 98 } 99 100 void _thread_start(void); 101 102 #endif /*CPUPORT_H__*/ 103