Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
Mock Turtle
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Mock Turtle
Commits
2579a70e
Commit
2579a70e
authored
Jun 24, 2015
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rt: extend shared memory API
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
e3fd6f0e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
2 deletions
+38
-2
rt-smem.h
applications/common/rt/rt-smem.h
+38
-2
No files found.
applications/common/rt/rt-smem.h
View file @
2579a70e
...
...
@@ -24,13 +24,22 @@
#define SMEM __attribute__((section(".smem")))
/**
* Perform an operation on a given pointer. Operation can be performed only
* on integer variables
*/
static
inline
void
__smem_atomic_op
(
int
*
p
,
int
x
,
unsigned
int
range
)
{
*
(
volatile
int
*
)(
p
+
(
range
>>
2
))
=
x
;
}
/**
* Add x to the value in the shared memory pointed by p
*/
static
inline
void
smem_atomic_add
(
int
*
p
,
int
x
)
{
*
(
volatile
int
*
)(
p
+
(
SMEM_RANGE_ADD
>>
2
))
=
x
;
__smem_atomic_op
(
p
,
x
,
SMEM_RANGE_ADD
)
;
}
...
...
@@ -39,7 +48,34 @@ static inline void smem_atomic_add(int *p, int x)
*/
static
inline
void
smem_atomic_sub
(
int
*
p
,
int
x
)
{
*
(
volatile
int
*
)(
p
+
(
SMEM_RANGE_SUB
>>
2
))
=
x
;
__smem_atomic_op
(
p
,
x
,
SMEM_RANGE_SUB
);
}
/**
* Do "OR" between x and the value in the shared memory pointed by p
*/
static
inline
void
smem_atomic_or
(
int
*
p
,
int
x
)
{
__smem_atomic_op
(
p
,
x
,
SMEM_RANGE_SET
);
}
/**
* Do "AND ~" between x and the value in the shared memory pointed by p
*/
static
inline
void
smem_atomic_and_not
(
int
*
p
,
int
x
)
{
__smem_atomic_op
(
p
,
x
,
SMEM_RANGE_CLEAR
);
}
/**
* Do "XOR" between x and the value in the shared memory pointed by p
*/
static
inline
void
smem_atomic_xor
(
int
*
p
,
int
x
)
{
__smem_atomic_op
(
p
,
x
,
SMEM_RANGE_FLIP
);
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment