summaryrefslogtreecommitdiff
path: root/libcpu/aarch64/common/cpuport.h
blob: d20c1d50080ef94a5d4fe7712d678f195b750bc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 */

#ifndef  CPUPORT_H__
#define  CPUPORT_H__

#include <armv8.h>
#include <rtdef.h>

#ifdef RT_USING_SMP
typedef union {
    unsigned long slock;
    struct __arch_tickets {
        unsigned short owner;
        unsigned short next;
    } tickets;
} rt_hw_spinlock_t;
#endif

rt_inline void rt_hw_isb(void)
{
    __asm__ volatile ("isb":::"memory");
}

rt_inline void rt_hw_dmb(void)
{
    __asm__ volatile ("dmb ish":::"memory");
}

rt_inline void rt_hw_wmb(void)
{
    __asm__ volatile ("dmb ishst":::"memory");
}

rt_inline void rt_hw_rmb(void)
{
    __asm__ volatile ("dmb ishld":::"memory");
}

rt_inline void rt_hw_dsb(void)
{
    __asm__ volatile ("dsb ish":::"memory");
}

#endif  /*CPUPORT_H__*/