RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
载入中...
搜索中...
未找到
rtatomic.h 文件参考
#include <rthw.h>
+ rtatomic.h 的引用(Include)关系图:
+ 此图展示该文件被哪些文件直接或间接地引用了:

浏览该文件的源代码.

宏定义

#define rt_atomic_load(ptr)
 
#define rt_atomic_store(ptr, v)
 
#define rt_atomic_add(ptr, v)
 
#define rt_atomic_sub(ptr, v)
 
#define rt_atomic_and(ptr, v)
 
#define rt_atomic_or(ptr, v)
 
#define rt_atomic_xor(ptr, v)
 
#define rt_atomic_exchange(ptr, v)
 
#define rt_atomic_flag_clear(ptr)
 
#define rt_atomic_flag_test_and_set(ptr)
 
#define rt_atomic_compare_exchange_strong(ptr, v, des)
 

函数

rt_atomic_t rt_hw_atomic_load (volatile rt_atomic_t *ptr)
 
void rt_hw_atomic_store (volatile rt_atomic_t *ptr, rt_atomic_t val)
 
rt_atomic_t rt_hw_atomic_add (volatile rt_atomic_t *ptr, rt_atomic_t val)
 
rt_atomic_t rt_hw_atomic_sub (volatile rt_atomic_t *ptr, rt_atomic_t val)
 
rt_atomic_t rt_hw_atomic_and (volatile rt_atomic_t *ptr, rt_atomic_t val)
 
rt_atomic_t rt_hw_atomic_or (volatile rt_atomic_t *ptr, rt_atomic_t val)
 
rt_atomic_t rt_hw_atomic_xor (volatile rt_atomic_t *ptr, rt_atomic_t val)
 
rt_atomic_t rt_hw_atomic_exchange (volatile rt_atomic_t *ptr, rt_atomic_t val)
 
void rt_hw_atomic_flag_clear (volatile rt_atomic_t *ptr)
 
rt_atomic_t rt_hw_atomic_flag_test_and_set (volatile rt_atomic_t *ptr)
 
rt_atomic_t rt_hw_atomic_compare_exchange_strong (volatile rt_atomic_t *ptr, rt_atomic_t *expected, rt_atomic_t desired)
 
rt_inline rt_atomic_t rt_soft_atomic_exchange (volatile rt_atomic_t *ptr, rt_atomic_t val)
 
rt_inline rt_atomic_t rt_soft_atomic_add (volatile rt_atomic_t *ptr, rt_atomic_t val)
 
rt_inline rt_atomic_t rt_soft_atomic_sub (volatile rt_atomic_t *ptr, rt_atomic_t val)
 
rt_inline rt_atomic_t rt_soft_atomic_xor (volatile rt_atomic_t *ptr, rt_atomic_t val)
 
rt_inline rt_atomic_t rt_soft_atomic_and (volatile rt_atomic_t *ptr, rt_atomic_t val)
 
rt_inline rt_atomic_t rt_soft_atomic_or (volatile rt_atomic_t *ptr, rt_atomic_t val)
 
rt_inline rt_atomic_t rt_soft_atomic_load (volatile rt_atomic_t *ptr)
 
rt_inline void rt_soft_atomic_store (volatile rt_atomic_t *ptr, rt_atomic_t val)
 
rt_inline rt_atomic_t rt_soft_atomic_flag_test_and_set (volatile rt_atomic_t *ptr)
 
rt_inline void rt_soft_atomic_flag_clear (volatile rt_atomic_t *ptr)
 
rt_inline rt_atomic_t rt_soft_atomic_compare_exchange_strong (volatile rt_atomic_t *ptr1, rt_atomic_t *ptr2, rt_atomic_t desired)
 
rt_inline rt_bool_t rt_atomic_dec_and_test (volatile rt_atomic_t *ptr)
 
rt_inline rt_atomic_t rt_atomic_fetch_add_unless (volatile rt_atomic_t *ptr, rt_atomic_t a, rt_atomic_t u)
 
rt_inline rt_bool_t rt_atomic_add_unless (volatile rt_atomic_t *ptr, rt_atomic_t a, rt_atomic_t u)
 
rt_inline rt_bool_t rt_atomic_inc_not_zero (volatile rt_atomic_t *ptr)
 
rt_inline void rt_ll_slist_init (rt_ll_slist_t *l)
 
rt_inline void rt_ll_slist_enqueue (rt_ll_slist_t *l, rt_ll_slist_t *n)
 
rt_inline rt_ll_slist_trt_ll_slist_dequeue (rt_ll_slist_t *l)
 

宏定义说明

◆ rt_atomic_load

#define rt_atomic_load ( ptr)
值:
rt_inline rt_atomic_t rt_soft_atomic_load(volatile rt_atomic_t *ptr)

在文件 rtatomic.h63 行定义.

◆ rt_atomic_store

#define rt_atomic_store ( ptr,
v )
值:
rt_inline void rt_soft_atomic_store(volatile rt_atomic_t *ptr, rt_atomic_t val)

在文件 rtatomic.h64 行定义.

◆ rt_atomic_add

#define rt_atomic_add ( ptr,
v )
值:
rt_inline rt_atomic_t rt_soft_atomic_add(volatile rt_atomic_t *ptr, rt_atomic_t val)

在文件 rtatomic.h65 行定义.

◆ rt_atomic_sub

#define rt_atomic_sub ( ptr,
v )
值:
rt_inline rt_atomic_t rt_soft_atomic_sub(volatile rt_atomic_t *ptr, rt_atomic_t val)

在文件 rtatomic.h66 行定义.

◆ rt_atomic_and

#define rt_atomic_and ( ptr,
v )
值:
rt_inline rt_atomic_t rt_soft_atomic_and(volatile rt_atomic_t *ptr, rt_atomic_t val)

在文件 rtatomic.h67 行定义.

◆ rt_atomic_or

#define rt_atomic_or ( ptr,
v )
值:
rt_inline rt_atomic_t rt_soft_atomic_or(volatile rt_atomic_t *ptr, rt_atomic_t val)

在文件 rtatomic.h68 行定义.

◆ rt_atomic_xor

#define rt_atomic_xor ( ptr,
v )
值:
rt_inline rt_atomic_t rt_soft_atomic_xor(volatile rt_atomic_t *ptr, rt_atomic_t val)

在文件 rtatomic.h69 行定义.

◆ rt_atomic_exchange

#define rt_atomic_exchange ( ptr,
v )
值:
rt_inline rt_atomic_t rt_soft_atomic_exchange(volatile rt_atomic_t *ptr, rt_atomic_t val)

在文件 rtatomic.h70 行定义.

◆ rt_atomic_flag_clear

#define rt_atomic_flag_clear ( ptr)
值:
rt_inline void rt_soft_atomic_flag_clear(volatile rt_atomic_t *ptr)

在文件 rtatomic.h71 行定义.

◆ rt_atomic_flag_test_and_set

#define rt_atomic_flag_test_and_set ( ptr)
值:
rt_inline rt_atomic_t rt_soft_atomic_flag_test_and_set(volatile rt_atomic_t *ptr)

在文件 rtatomic.h72 行定义.

◆ rt_atomic_compare_exchange_strong

#define rt_atomic_compare_exchange_strong ( ptr,
v,
des )
值:
rt_inline rt_atomic_t rt_soft_atomic_compare_exchange_strong(volatile rt_atomic_t *ptr1, rt_atomic_t *ptr2, rt_atomic_t desired)

在文件 rtatomic.h73 行定义.

函数说明

◆ rt_hw_atomic_load()

rt_atomic_t rt_hw_atomic_load ( volatile rt_atomic_t * ptr)

◆ rt_hw_atomic_store()

void rt_hw_atomic_store ( volatile rt_atomic_t * ptr,
rt_atomic_t val )

◆ rt_hw_atomic_add()

rt_atomic_t rt_hw_atomic_add ( volatile rt_atomic_t * ptr,
rt_atomic_t val )

◆ rt_hw_atomic_sub()

rt_atomic_t rt_hw_atomic_sub ( volatile rt_atomic_t * ptr,
rt_atomic_t val )

◆ rt_hw_atomic_and()

rt_atomic_t rt_hw_atomic_and ( volatile rt_atomic_t * ptr,
rt_atomic_t val )

◆ rt_hw_atomic_or()

rt_atomic_t rt_hw_atomic_or ( volatile rt_atomic_t * ptr,
rt_atomic_t val )

◆ rt_hw_atomic_xor()

rt_atomic_t rt_hw_atomic_xor ( volatile rt_atomic_t * ptr,
rt_atomic_t val )

◆ rt_hw_atomic_exchange()

rt_atomic_t rt_hw_atomic_exchange ( volatile rt_atomic_t * ptr,
rt_atomic_t val )

◆ rt_hw_atomic_flag_clear()

void rt_hw_atomic_flag_clear ( volatile rt_atomic_t * ptr)

◆ rt_hw_atomic_flag_test_and_set()

rt_atomic_t rt_hw_atomic_flag_test_and_set ( volatile rt_atomic_t * ptr)

◆ rt_hw_atomic_compare_exchange_strong()

rt_atomic_t rt_hw_atomic_compare_exchange_strong ( volatile rt_atomic_t * ptr,
rt_atomic_t * expected,
rt_atomic_t desired )

◆ rt_soft_atomic_exchange()

rt_inline rt_atomic_t rt_soft_atomic_exchange ( volatile rt_atomic_t * ptr,
rt_atomic_t val )

在文件 rtatomic.h75 行定义.

76{
77 rt_base_t level;
78 rt_atomic_t temp;
80 temp = *ptr;
81 *ptr = val;
83 return temp;
84}
void rt_hw_interrupt_enable(rt_base_t level)
rt_base_t rt_hw_interrupt_disable(void)
rt_int32_t rt_base_t
rt_base_t rt_atomic_t

引用了 rt_hw_interrupt_disable() , 以及 rt_hw_interrupt_enable().

+ 函数调用图:

◆ rt_soft_atomic_add()

rt_inline rt_atomic_t rt_soft_atomic_add ( volatile rt_atomic_t * ptr,
rt_atomic_t val )

在文件 rtatomic.h86 行定义.

87{
88 rt_base_t level;
89 rt_atomic_t temp;
91 temp = *ptr;
92 *ptr += val;
94 return temp;
95}

引用了 rt_hw_interrupt_disable() , 以及 rt_hw_interrupt_enable().

+ 函数调用图:

◆ rt_soft_atomic_sub()

rt_inline rt_atomic_t rt_soft_atomic_sub ( volatile rt_atomic_t * ptr,
rt_atomic_t val )

在文件 rtatomic.h97 行定义.

98{
99 rt_base_t level;
100 rt_atomic_t temp;
101 level = rt_hw_interrupt_disable();
102 temp = *ptr;
103 *ptr -= val;
105 return temp;
106}

引用了 rt_hw_interrupt_disable() , 以及 rt_hw_interrupt_enable().

+ 函数调用图:

◆ rt_soft_atomic_xor()

rt_inline rt_atomic_t rt_soft_atomic_xor ( volatile rt_atomic_t * ptr,
rt_atomic_t val )

在文件 rtatomic.h108 行定义.

109{
110 rt_base_t level;
111 rt_atomic_t temp;
112 level = rt_hw_interrupt_disable();
113 temp = *ptr;
114 *ptr = (*ptr) ^ val;
116 return temp;
117}

引用了 rt_hw_interrupt_disable() , 以及 rt_hw_interrupt_enable().

+ 函数调用图:

◆ rt_soft_atomic_and()

rt_inline rt_atomic_t rt_soft_atomic_and ( volatile rt_atomic_t * ptr,
rt_atomic_t val )

在文件 rtatomic.h119 行定义.

120{
121 rt_base_t level;
122 rt_atomic_t temp;
123 level = rt_hw_interrupt_disable();
124 temp = *ptr;
125 *ptr = (*ptr) & val;
127 return temp;
128}

引用了 rt_hw_interrupt_disable() , 以及 rt_hw_interrupt_enable().

+ 函数调用图:

◆ rt_soft_atomic_or()

rt_inline rt_atomic_t rt_soft_atomic_or ( volatile rt_atomic_t * ptr,
rt_atomic_t val )

在文件 rtatomic.h130 行定义.

131{
132 rt_base_t level;
133 rt_atomic_t temp;
134 level = rt_hw_interrupt_disable();
135 temp = *ptr;
136 *ptr = (*ptr) | val;
138 return temp;
139}

引用了 rt_hw_interrupt_disable() , 以及 rt_hw_interrupt_enable().

+ 函数调用图:

◆ rt_soft_atomic_load()

rt_inline rt_atomic_t rt_soft_atomic_load ( volatile rt_atomic_t * ptr)

在文件 rtatomic.h141 行定义.

142{
143 rt_base_t level;
144 rt_atomic_t temp;
145 level = rt_hw_interrupt_disable();
146 temp = *ptr;
148 return temp;
149}

引用了 rt_hw_interrupt_disable() , 以及 rt_hw_interrupt_enable().

+ 函数调用图:

◆ rt_soft_atomic_store()

rt_inline void rt_soft_atomic_store ( volatile rt_atomic_t * ptr,
rt_atomic_t val )

在文件 rtatomic.h151 行定义.

152{
153 rt_base_t level;
154 level = rt_hw_interrupt_disable();
155 *ptr = val;
157}

引用了 rt_hw_interrupt_disable() , 以及 rt_hw_interrupt_enable().

+ 函数调用图:

◆ rt_soft_atomic_flag_test_and_set()

rt_inline rt_atomic_t rt_soft_atomic_flag_test_and_set ( volatile rt_atomic_t * ptr)

在文件 rtatomic.h159 行定义.

160{
161 rt_base_t level;
162 rt_atomic_t temp;
163 level = rt_hw_interrupt_disable();
164 if (*ptr == 0)
165 {
166 temp = 0;
167 *ptr = 1;
168 }
169 else
170 temp = 1;
172 return temp;
173}

引用了 rt_hw_interrupt_disable() , 以及 rt_hw_interrupt_enable().

+ 函数调用图:

◆ rt_soft_atomic_flag_clear()

rt_inline void rt_soft_atomic_flag_clear ( volatile rt_atomic_t * ptr)

在文件 rtatomic.h175 行定义.

176{
177 rt_base_t level;
178 level = rt_hw_interrupt_disable();
179 *ptr = 0;
181}

引用了 rt_hw_interrupt_disable() , 以及 rt_hw_interrupt_enable().

+ 函数调用图:

◆ rt_soft_atomic_compare_exchange_strong()

rt_inline rt_atomic_t rt_soft_atomic_compare_exchange_strong ( volatile rt_atomic_t * ptr1,
rt_atomic_t * ptr2,
rt_atomic_t desired )

在文件 rtatomic.h183 行定义.

185{
186 rt_base_t level;
187 rt_atomic_t temp;
188 level = rt_hw_interrupt_disable();
189 if ((*ptr1) != (*ptr2))
190 {
191 *ptr2 = *ptr1;
192 temp = 0;
193 }
194 else
195 {
196 *ptr1 = desired;
197 temp = 1;
198 }
200 return temp;
201}

引用了 rt_hw_interrupt_disable() , 以及 rt_hw_interrupt_enable().

+ 函数调用图:

◆ rt_atomic_dec_and_test()

rt_inline rt_bool_t rt_atomic_dec_and_test ( volatile rt_atomic_t * ptr)

在文件 rtatomic.h204 行定义.

205{
206 return rt_atomic_sub(ptr, 1) == 1;
207}
#define rt_atomic_sub(ptr, v)

引用了 rt_atomic_sub.

◆ rt_atomic_fetch_add_unless()

rt_inline rt_atomic_t rt_atomic_fetch_add_unless ( volatile rt_atomic_t * ptr,
rt_atomic_t a,
rt_atomic_t u )

在文件 rtatomic.h209 行定义.

210{
212
213 do {
214 if (c == u)
215 {
216 break;
217 }
218 } while (!rt_atomic_compare_exchange_strong(ptr, &c, c + a));
219
220 return c;
221}
#define rt_atomic_compare_exchange_strong(ptr, v, des)
#define rt_atomic_load(ptr)

引用了 rt_atomic_compare_exchange_strong , 以及 rt_atomic_load.

+ 这是这个函数的调用关系图:

◆ rt_atomic_add_unless()

rt_inline rt_bool_t rt_atomic_add_unless ( volatile rt_atomic_t * ptr,
rt_atomic_t a,
rt_atomic_t u )

在文件 rtatomic.h223 行定义.

224{
225 return rt_atomic_fetch_add_unless(ptr, a, u) != u;
226}
rt_inline rt_atomic_t rt_atomic_fetch_add_unless(volatile rt_atomic_t *ptr, rt_atomic_t a, rt_atomic_t u)

引用了 rt_atomic_fetch_add_unless().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ rt_atomic_inc_not_zero()

rt_inline rt_bool_t rt_atomic_inc_not_zero ( volatile rt_atomic_t * ptr)

在文件 rtatomic.h228 行定义.

229{
230 return rt_atomic_add_unless(ptr, 1, 0);
231}
rt_inline rt_bool_t rt_atomic_add_unless(volatile rt_atomic_t *ptr, rt_atomic_t a, rt_atomic_t u)

引用了 rt_atomic_add_unless().

+ 函数调用图:

◆ rt_ll_slist_init()

rt_inline void rt_ll_slist_init ( rt_ll_slist_t * l)

initialize a lock-less single list

参数
lthe single list to be initialized

在文件 rtatomic.h238 行定义.

239{
240 l->next = 0;
241}

引用了 rt_lockless_slist_node::next.

◆ rt_ll_slist_enqueue()

rt_inline void rt_ll_slist_enqueue ( rt_ll_slist_t * l,
rt_ll_slist_t * n )

在文件 rtatomic.h243 行定义.

244{
245 rt_base_t exp;
246 exp = rt_atomic_load(&l->next);
247 do
248 {
249 n->next = exp;
250 } while (!rt_atomic_compare_exchange_strong(&l->next, &exp, (rt_base_t)n));
251}

引用了 rt_lockless_slist_node::next, rt_atomic_compare_exchange_strong , 以及 rt_atomic_load.

◆ rt_ll_slist_dequeue()

rt_inline rt_ll_slist_t * rt_ll_slist_dequeue ( rt_ll_slist_t * l)

在文件 rtatomic.h253 行定义.

254{
255 rt_base_t exp;
256 rt_ll_slist_t *head;
257
258 exp = rt_atomic_load(&l->next);
259 do
260 {
261 head = (rt_ll_slist_t *)exp;
262 } while (head && !rt_atomic_compare_exchange_strong(&l->next, &exp, rt_atomic_load(&head->next)));
263 return head;
264}
struct rt_lockless_slist_node rt_ll_slist_t

引用了 rt_lockless_slist_node::next, rt_atomic_compare_exchange_strong , 以及 rt_atomic_load.