32 lines
727 B
C
32 lines
727 B
C
#ifndef __OSPATOMOPTH__
|
|
#define __OSPATOMOPTH__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
typedef struct {
|
|
int32_t counter;
|
|
} OSP_atomic_t;
|
|
#define atomic_read(v) (*(volatile int32_t *)&(v)->counter)
|
|
#define atomic_set(v, i) (((v)->counter) = (i))
|
|
|
|
/* function prototype */
|
|
extern void osp_atomic_inc(int32_t *pVar);
|
|
extern void osp_atomic_dec(int32_t *pVar);
|
|
extern int32_t osp_atomic_get(int32_t *pVar);
|
|
extern void osp_atomic_set(int32_t *pVar, int32_t val);
|
|
extern void osp_atomic64_inc(int64_t *pVar);
|
|
extern void osp_atomic64_dec(int64_t *pVar);
|
|
extern int64_t osp_atomic64_get(int64_t *pVar);
|
|
extern void osp_atomic64_set(int64_t *pVar, int64_t val);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __OSPATOMOPTH__ */
|
|
|
|
|