1 /*
2  * Copyright (c) 2006-2024, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2018-10-03     Bernard      The first version
9  */
10 
11 #ifndef CPUPORT_H__
12 #define CPUPORT_H__
13 
14 #include <rtconfig.h>
15 #include <opcode.h>
16 
17 #ifndef __ASSEMBLY__
18 
19 #ifdef RT_USING_SMP
20 typedef union {
21     unsigned long slock;
22     struct __arch_tickets {
23         unsigned short owner;
24         unsigned short next;
25     } tickets;
26 } rt_hw_spinlock_t;
27 #endif
28 
29 #include <rtcompiler.h>
30 
rt_hw_dsb(void)31 rt_inline void rt_hw_dsb(void)
32 {
33     __asm__ volatile("fence":::"memory");
34 }
35 
rt_hw_dmb(void)36 rt_inline void rt_hw_dmb(void)
37 {
38     __asm__ volatile("fence":::"memory");
39 }
40 
rt_hw_isb(void)41 rt_inline void rt_hw_isb(void)
42 {
43     __asm__ volatile(OPC_FENCE_I:::"memory");
44 }
45 
46 int rt_hw_cpu_id(void);
47 
48 #endif
49 
50 #endif
51 #ifdef RISCV_U_MODE
52 #define RISCV_USER_ENTRY 0xFFFFFFE000000000ULL
53 #endif
54