XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
mb.h
浏览该文件的文档.
1
13#ifndef __xwos_lib_mb_h__
14#define __xwos_lib_mb_h__
15
16#include <cfg/project.h>
17
24#include <xwos/ospl/soc/isa.h>
25
33// cppcheck-suppress [misra-c2012-20.7]
34#define xwmb_access(t, v) (*((volatile t *)&(v)))
35
44// cppcheck-suppress [misra-c2012-20.7]
45#define xwmb_read(t, v, p) xwmb_access(t, v) = (*(volatile t * )(p))
46
55// cppcheck-suppress [misra-c2012-20.7]
56#define xwmb_write(t, p, v) (*(volatile t * )(p)) = (v)
57
58#if !defined(xwmb_compiler) || defined(__DOXYGEN__)
62# define xwmb_compiler()
63#endif
64
65#if !defined(xwmb_mp_mb) || defined(__DOXYGEN__)
69# define xwmb_mp_mb()
70#endif
71
72#if !defined(xwmb_mp_rmb) || defined(__DOXYGEN__)
76# define xwmb_mp_rmb()
77#endif
78
79#if !defined(xwmb_mp_wmb) || defined(__DOXYGEN__)
83# define xwmb_mp_wmb()
84#endif
85
86#if !defined(xwmb_ddb) || defined(__DOXYGEN__)
154# define xwmb_ddb() xwmb_compiler()
155#endif
156
157#if !defined(xwmb_mp_consume) || defined(__DOXYGEN__)
161# define xwmb_mp_consume() xwmb_ddb()
162#endif
163
164#if !defined(xwmb_mp_acquire) || defined(__DOXYGEN__)
170# define xwmb_mp_acquire() xwmb_mp_mb()
171#endif
172
173#if !defined(xwmb_mp_release) || defined(__DOXYGEN__)
179# define xwmb_mp_release() xwmb_mp_mb()
180#endif
181
182#if !defined(xwmb_mp_load_acquire) || defined(__DOXYGEN__)
191#define xwmb_mp_load_acquire(t, v, p) \
192 do { \
193 xwmb_read(t, (v), (p)); \
194 xwmb_mp_acquire(); \
195 } while (0)
196#endif
197
198#if !defined(xwmb_mp_store_release) || defined(__DOXYGEN__)
207#define xwmb_mp_store_release(t, p, v) \
208 do { \
209 xwmb_mp_release(); \
210 xwmb_write(t, (p), (v)); \
211 } while (0)
212#endif
213
218#endif /* xwos/lib/mb.h */