2022-12-03 12:07:44 +08:00
|
|
|
/*
|
2024-09-02 16:38:42 +08:00
|
|
|
* Copyright (c) 2006-2024, RT-Thread Development Team
|
2022-12-03 12:07:44 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2018-10-03 Bernard The first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CPUPORT_H__
|
|
|
|
#define CPUPORT_H__
|
|
|
|
|
|
|
|
#include <rtconfig.h>
|
|
|
|
#include <opcode.h>
|
|
|
|
|
2024-09-02 16:38:42 +08:00
|
|
|
#ifdef RT_USING_SMP
|
|
|
|
typedef union {
|
|
|
|
unsigned long slock;
|
|
|
|
struct __arch_tickets {
|
|
|
|
unsigned short owner;
|
|
|
|
unsigned short next;
|
|
|
|
} tickets;
|
|
|
|
} rt_hw_spinlock_t;
|
2022-12-03 12:07:44 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
2023-11-02 20:16:02 +08:00
|
|
|
#include <rtdef.h>
|
2023-01-09 10:08:55 +08:00
|
|
|
|
2024-02-21 11:45:04 +08:00
|
|
|
rt_inline void rt_hw_dsb(void)
|
2022-12-03 12:07:44 +08:00
|
|
|
{
|
2023-01-09 10:08:55 +08:00
|
|
|
__asm__ volatile("fence":::"memory");
|
2022-12-03 12:07:44 +08:00
|
|
|
}
|
|
|
|
|
2024-02-21 11:45:04 +08:00
|
|
|
rt_inline void rt_hw_dmb(void)
|
2022-12-03 12:07:44 +08:00
|
|
|
{
|
2023-01-09 10:08:55 +08:00
|
|
|
__asm__ volatile("fence":::"memory");
|
2022-12-03 12:07:44 +08:00
|
|
|
}
|
|
|
|
|
2024-02-21 11:45:04 +08:00
|
|
|
rt_inline void rt_hw_isb(void)
|
2022-12-03 12:07:44 +08:00
|
|
|
{
|
2023-01-09 10:08:55 +08:00
|
|
|
__asm__ volatile(OPC_FENCE_I:::"memory");
|
2022-12-03 12:07:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int rt_hw_cpu_id(void);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#ifdef RISCV_U_MODE
|
|
|
|
#define RISCV_USER_ENTRY 0xFFFFFFE000000000ULL
|
|
|
|
#endif
|