Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
FORMUS3IC_LAS3
/
embb
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
53832595
authored
Nov 18, 2016
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adapted assembler commands in atomic defines
parent
29d124d0
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
239 additions
and
14 deletions
+239
-14
CMakeCommon/SetCompilerFlags.cmake
+1
-1
CMakeLists.txt
+15
-9
TC_Toolchain.cmake
+5
-1
base_c/CMakeLists.txt
+9
-0
base_c/include/embb/base/c/internal/atomic/and_assign.h
+20
-0
base_c/include/embb/base/c/internal/atomic/compare_and_swap.h
+24
-0
base_c/include/embb/base/c/internal/atomic/fetch_and_add.h
+20
-0
base_c/include/embb/base/c/internal/atomic/load.h
+23
-0
base_c/include/embb/base/c/internal/atomic/memory_barrier.h
+10
-0
base_c/include/embb/base/c/internal/atomic/or_assign.h
+20
-0
base_c/include/embb/base/c/internal/atomic/store.h
+20
-0
base_c/include/embb/base/c/internal/atomic/swap.h
+22
-0
base_c/include/embb/base/c/internal/atomic/xor_assign.h
+22
-0
base_c/include/embb/base/c/internal/platform.h
+2
-1
base_c/src/thread.c
+1
-1
base_cpp/CMakeLists.txt
+2
-0
base_cpp/include/embb/base/internal/platform.h
+17
-1
base_cpp/src/thread.cc
+6
-0
No files found.
CMakeCommon/SetCompilerFlags.cmake
View file @
53832595
...
...
@@ -28,7 +28,7 @@ function(SetGNUCompilerFlags compiler_libs)
if
(
CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX
)
if
(
DEFINED CMAKE_SYSTEM_PROCESSOR
)
set
(
compiler_libs PARENT_SCOPE
)
set
(
common_flags
"-fno-common -Os"
)
set
(
common_flags
"-fno-common -Os
-std=c99
"
)
set
(
warning_flags
"-W -Wall -Wextra -Wdiv-by-zero -Warray-bounds -Wcast-align -Wignored-qualifiers -Wformat -Wformat-security"
)
set
(
target_flags
"-DAPPKIT_TC277TFT -fshort-double -mcpu=tc27xx -mversion-info"
)
...
...
CMakeLists.txt
View file @
53832595
...
...
@@ -104,11 +104,9 @@ else()
endif
()
message
(
" (set with command line option -DUSE_AUTOMATIC_INITIALIZATION=ON/OFF)"
)
set
(
CMAKE_CXX_STANDARD_LIBRARIES
${
FREE_RTOS_LIB_PATH
}
/iRom/libFreeRTOS_Lib.a
)
set
(
CMAKE_C_STANDARD_LIBRARIES
${
FREE_RTOS_LIB_PATH
}
/iRom/libFreeRTOS_Lib.a
)
set
(
CMAKE_INSTALL_RPATH FREE_RTOS_LIB_PATH
)
set
(
__TriCore__ 1
)
include_directories
(
${
FREE_RTOS_LIB_PATH
}
/include
)
include
(
CMakeCommon/SetCompilerFlags.cmake
)
SetGNUCompilerFlags
(
compiler_libs compiler_flags
)
...
...
@@ -142,16 +140,22 @@ set(EXPECTED_EMBB_TEST_EXECUTABLES "embb_algorithms_cpp_test"
"embb_dataflow_cpp_test"
"embb_mtapi_c_test"
"embb_mtapi_cpp_test"
"embb_mtapi_network_c_test"
"embb_tasks_cpp_test"
)
# if opencl is there, we also expect the mtapi opencl test to be generated
if
(
BUILD_OPENCL_PLUGIN STREQUAL ON
)
list
(
APPEND EXPECTED_EMBB_TEST_EXECUTABLES
"embb_mtapi_opencl_c_test"
)
if
(
NOT __TriCore__
)
list
(
APPEND EXPECTED_EMBB_TEST_EXECUTABLES
"embb_mtapi_network_c_test"
)
# if opencl is there, we also expect the mtapi opencl test to be generated
if
(
BUILD_OPENCL_PLUGIN STREQUAL ON
)
list
(
APPEND EXPECTED_EMBB_TEST_EXECUTABLES
"embb_mtapi_opencl_c_test"
)
endif
()
else
()
message
(
"-- MTAPI plugins will not be build on target 'TriCore'."
)
endif
()
## Copy test execution script to local binaries folder
if
(
DEFINED CYGWIN
)
...
...
@@ -182,10 +186,12 @@ CheckPartestInstall(${BUILD_TESTS} partest_includepath partest_libpath)
add_subdirectory
(
base_c
)
add_subdirectory
(
base_cpp
)
add_subdirectory
(
mtapi_c
)
if
(
NOT __TriCore__
)
add_subdirectory
(
mtapi_plugins_c/mtapi_network_c
)
if
(
BUILD_OPENCL_PLUGIN STREQUAL ON
)
add_subdirectory
(
mtapi_plugins_c/mtapi_opencl_c
)
endif
()
endif
()
add_subdirectory
(
tasks_cpp
)
add_subdirectory
(
mtapi_cpp
)
add_subdirectory
(
containers_cpp
)
...
...
TC_Toolchain.cmake
View file @
53832595
...
...
@@ -3,7 +3,11 @@ SET(CMAKE_SYSTEM_NAME Generic)
#this one not so much
SET
(
CMAKE_SYSTEM_VERSION 1
)
SET
(
CMAKE_SYSTEM_PROCESSOR __TriCore__
)
SET
(
__TriCore__ 1
)
#Add __TriCore__ to compiler flags
add_definitions
(
-D__TriCore__
)
#Add __TriCore__ to cmake flags
set
(
__TriCore__ 1
)
# specify the cross compiler
SET
(
CMAKE_C_COMPILER C:/HighTec/toolchains/tricore/v4.6.6.0-infineon-1.1/bin/tricore-gcc.exe
)
...
...
base_c/CMakeLists.txt
View file @
53832595
...
...
@@ -72,6 +72,15 @@ if(MSVC)
)
endif
()
set
(
CMAKE_CXX_STANDARD_LIBRARIES
${
FREE_RTOS_LIB_PATH
}
/iRom/libFreeRTOS_Lib.a
)
set
(
CMAKE_C_STANDARD_LIBRARIES
${
FREE_RTOS_LIB_PATH
}
/iRom/libFreeRTOS_Lib.a
)
set
(
CMAKE_INSTALL_RPATH
${
FREE_RTOS_LIB_PATH
}
)
file
(
GLOB_RECURSE FREE_RTOS_HEADERS
"
${
FREE_RTOS_LIB_PATH
}
/*.h"
)
## CONFIGURATION
#
# Check headers and create configure file with preprocessor defines
...
...
base_c/include/embb/base/c/internal/atomic/and_assign.h
View file @
53832595
...
...
@@ -126,6 +126,26 @@ EMBB_DEFINE_AND_ASSIGN(1, "b")
EMBB_DEFINE_AND_ASSIGN
(
2
,
"h"
)
EMBB_DEFINE_AND_ASSIGN
(
4
,
""
)
#elif defined(EMBB_PLATFORM_ARCH_TC)
#if defined(EMBB_PLATFORM_COMPILER_GNUC)
// scm34681: add atomic methods (all headers)
#define EMBB_DEFINE_AND_ASSIGN(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX)\
EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_internal__atomic_and_assign_, \
EMBB_PARAMETER_SIZE_BYTE)(EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) value) { \
__asm__ __volatile__("and" EMBB_ATOMIC_X86_SIZE_SUFFIX " %[value], %[value_p]\n\t" \
"dsync" \
: [value]"+r" (value) \
: [value_p]"r" (*pointer_to_value)\
: "memory"); \
}
#else
#error "No atomic fetch and store implementation found"
#endif
EMBB_DEFINE_AND_ASSIGN
(
1
,
""
)
EMBB_DEFINE_AND_ASSIGN
(
2
,
""
)
EMBB_DEFINE_AND_ASSIGN
(
4
,
""
)
#else
#error "Unknown architecture"
#endif
...
...
base_c/include/embb/base/c/internal/atomic/compare_and_swap.h
View file @
53832595
...
...
@@ -125,6 +125,30 @@ EMBB_DEFINE_COMPARE_AND_SWAP(1, "b")
EMBB_DEFINE_COMPARE_AND_SWAP
(
2
,
"h"
)
EMBB_DEFINE_COMPARE_AND_SWAP
(
4
,
""
)
#elif defined(EMBB_PLATFORM_ARCH_TC)
#if defined(EMBB_PLATFORM_COMPILER_GNUC)
// scm34681: use aurix instruction set
#define EMBB_DEFINE_COMPARE_AND_SWAP(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \
EMBB_PLATFORM_INLINE int EMBB_CAT2(embb_internal__atomic_compare_and_swap_, \
EMBB_PARAMETER_SIZE_BYTE)(EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* expected, \
EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) desired) { \
unsigned int result; \
__asm__ __volatile__ ("eq" EMBB_ATOMIC_X86_SIZE_SUFFIX " %[result], %[expected], %[desired]\n\t" \
"mov %[desired], %[pointer_to_value]" \
: [result]"=r" (result)\
: [expected]"r" (*expected), [desired]"r" (desired), [pointer_to_value]"r"(*pointer_to_value)\
: "memory", "cc" ); \
return (result & 0xFF); \
}
#else
#error "No atomic fetch and store implementation found"
#endif
EMBB_DEFINE_COMPARE_AND_SWAP
(
1
,
"ANY.B"
)
EMBB_DEFINE_COMPARE_AND_SWAP
(
2
,
"ANY.H"
)
EMBB_DEFINE_COMPARE_AND_SWAP
(
4
,
""
)
#else
#error "Unknown architecture"
#endif
...
...
base_c/include/embb/base/c/internal/atomic/fetch_and_add.h
View file @
53832595
...
...
@@ -118,6 +118,26 @@ EMBB_DEFINE_FETCH_AND_ADD(1, "b")
EMBB_DEFINE_FETCH_AND_ADD
(
2
,
"h"
)
EMBB_DEFINE_FETCH_AND_ADD
(
4
,
""
)
#elif defined(EMBB_PLATFORM_ARCH_TC)
#if defined(EMBB_PLATFORM_COMPILER_GNUC)
#define EMBB_DEFINE_FETCH_AND_ADD(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \
EMBB_PLATFORM_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) EMBB_CAT2(embb_internal__atomic_fetch_and_add_, EMBB_PARAMETER_SIZE_BYTE) \
(EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) new_value) { \
__asm__ __volatile__ ("add" EMBB_ATOMIC_X86_SIZE_SUFFIX " %[new_value], %[value_p]\n\t" \
"dsync" \
: [new_value]"+r" (new_value) \
: [value_p]"r" (*pointer_to_value) \
: "memory", "cc" ); \
return new_value; \
}
#else
#error "No atomic fetch and store implementation found"
#endif
EMBB_DEFINE_FETCH_AND_ADD
(
1
,
".b"
)
EMBB_DEFINE_FETCH_AND_ADD
(
2
,
".h"
)
EMBB_DEFINE_FETCH_AND_ADD
(
4
,
""
)
#else
#error "Unknown architecture"
#endif
...
...
base_c/include/embb/base/c/internal/atomic/load.h
View file @
53832595
...
...
@@ -109,6 +109,29 @@ EMBB_DEFINE_LOAD(1, "b")
EMBB_DEFINE_LOAD
(
2
,
"h"
)
EMBB_DEFINE_LOAD
(
4
,
""
)
#elif defined(EMBB_PLATFORM_ARCH_TC)
#if defined(EMBB_PLATFORM_COMPILER_GNUC)
#define EMBB_DEFINE_LOAD(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \
EMBB_PLATFORM_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) \
EMBB_CAT2(embb_internal__atomic_load_, EMBB_PARAMETER_SIZE_BYTE)(EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value) { \
/* no fence required for loads */
\
EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) result; \
__asm__ __volatile__("mov" EMBB_ATOMIC_X86_SIZE_SUFFIX " %1, %0" \
: "=r" (result) \
: "r" (*pointer_to_value) \
: "memory"); \
return result; \
}
#else
#error "No atomic fetch and store implementation found"
#endif
EMBB_DEFINE_LOAD
(
1
,
""
)
EMBB_DEFINE_LOAD
(
2
,
""
)
EMBB_DEFINE_LOAD
(
4
,
""
)
#else
#error "Unknown architecture"
#endif
...
...
base_c/include/embb/base/c/internal/atomic/memory_barrier.h
View file @
53832595
...
...
@@ -60,6 +60,16 @@ EMBB_PLATFORM_INLINE void embb_atomic_memory_barrier() {
__asm__
__volatile__
(
"dmb"
:
:
:
"memory"
);
}
#elif defined(EMBB_PLATFORM_ARCH_TC)
#if defined(EMBB_PLATFORM_COMPILER_GNUC)
// Read/write barrier
EMBB_PLATFORM_INLINE
void
embb_atomic_memory_barrier
()
{
__asm__
__volatile__
(
"isync"
:
:
:
"memory"
);
}
#else
#error "No atomic fetch and store implementation found"
#endif
#endif
#endif //DOXYGEN
...
...
base_c/include/embb/base/c/internal/atomic/or_assign.h
View file @
53832595
...
...
@@ -111,6 +111,26 @@ EMBB_DEFINE_OR_ASSIGN(1, "b")
EMBB_DEFINE_OR_ASSIGN
(
2
,
"h"
)
EMBB_DEFINE_OR_ASSIGN
(
4
,
""
)
#elif defined(EMBB_PLATFORM_ARCH_TC)
#if defined(EMBB_PLATFORM_COMPILER_GNUC)
#define EMBB_DEFINE_OR_ASSIGN(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \
EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_internal__atomic_or_assign_, EMBB_PARAMETER_SIZE_BYTE)(\
EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) value) { \
__asm__ __volatile__("or" EMBB_ATOMIC_X86_SIZE_SUFFIX " %[value], %[value_p]\n\t" \
"dsync" \
: [value]"+r" (value) \
: [value_p]"r" (*pointer_to_value) \
: "memory"); \
}
#else
#error "No atomic fetch and store implementation found"
#endif
EMBB_DEFINE_OR_ASSIGN
(
1
,
""
)
EMBB_DEFINE_OR_ASSIGN
(
2
,
""
)
EMBB_DEFINE_OR_ASSIGN
(
4
,
""
)
#else
#error "Unknown architecture"
#endif
...
...
base_c/include/embb/base/c/internal/atomic/store.h
View file @
53832595
...
...
@@ -106,6 +106,26 @@ EMBB_DEFINE_STORE(1, "b")
EMBB_DEFINE_STORE
(
2
,
"h"
)
EMBB_DEFINE_STORE
(
4
,
""
)
#elif defined(EMBB_PLATFORM_ARCH_TC)
#if defined(EMBB_PLATFORM_COMPILER_GNUC)
#define EMBB_DEFINE_STORE(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX)\
EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_internal__atomic_store_, EMBB_PARAMETER_SIZE_BYTE)(EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, \
EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) new_value) {\
__asm__ __volatile__("st" EMBB_ATOMIC_X86_SIZE_SUFFIX " %[result], %[value]\n\t" \
"dsync" \
: [result]"=m" (pointer_to_value)\
: [value]"r" (new_value)\
: "memory"); \
} // scm34681: check correct implementation
#else
#error "No atomic fetch and store implementation found"
#endif
EMBB_DEFINE_STORE
(
1
,
".b"
)
EMBB_DEFINE_STORE
(
2
,
".h"
)
EMBB_DEFINE_STORE
(
4
,
".w"
)
#else
#error "Unknown architecture"
#endif
...
...
base_c/include/embb/base/c/internal/atomic/swap.h
View file @
53832595
...
...
@@ -114,6 +114,28 @@ EMBB_DEFINE_SWAP(1, "b")
EMBB_DEFINE_SWAP
(
2
,
"h"
)
EMBB_DEFINE_SWAP
(
4
,
""
)
#elif defined(EMBB_PLATFORM_ARCH_TC)
#if defined(EMBB_PLATFORM_COMPILER_GNUC)
#define EMBB_DEFINE_SWAP(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \
EMBB_PLATFORM_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) EMBB_CAT2(embb_internal__atomic_swap_, EMBB_PARAMETER_SIZE_BYTE)(\
EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) new_value)\
{ \
/*the lock prefix is implicit for xchg*/
\
__asm__ __volatile__("swap" EMBB_ATOMIC_X86_SIZE_SUFFIX " %1, %0" \
: "+m" (pointer_to_value), "+r" (new_value) \
: \
: "memory"); \
return new_value; \
}
#else
#error "No atomic fetch and store implementation found"
#endif
EMBB_DEFINE_SWAP
(
1
,
".w"
)
EMBB_DEFINE_SWAP
(
2
,
".w"
)
EMBB_DEFINE_SWAP
(
4
,
".w"
)
#else
#error "Unknown architecture"
#endif
...
...
base_c/include/embb/base/c/internal/atomic/xor_assign.h
View file @
53832595
...
...
@@ -112,6 +112,28 @@ EMBB_DEFINE_XOR_ASSIGN(1, "b")
EMBB_DEFINE_XOR_ASSIGN
(
2
,
"h"
)
EMBB_DEFINE_XOR_ASSIGN
(
4
,
""
)
#elif defined(EMBB_PLATFORM_ARCH_TC)
#if defined(EMBB_PLATFORM_COMPILER_GNUC)
#define EMBB_DEFINE_XOR_ASSIGN(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \
EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_internal__atomic_xor_assign_, EMBB_PARAMETER_SIZE_BYTE)(\
EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, \
EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) value) { \
__asm__ __volatile__("lock xor" EMBB_ATOMIC_X86_SIZE_SUFFIX " %[value], %[value_p]\n\t" \
"dsync" \
: [value]"+r" (value) \
: [value_p]"r" (*pointer_to_value) \
: "memory"); \
}
#else
#error "No atomic fetch and store implementation found"
#endif
EMBB_DEFINE_XOR_ASSIGN
(
1
,
""
)
EMBB_DEFINE_XOR_ASSIGN
(
2
,
""
)
EMBB_DEFINE_XOR_ASSIGN
(
4
,
""
)
#else
#error "Unknown architecture"
#endif
...
...
base_c/include/embb/base/c/internal/platform.h
View file @
53832595
...
...
@@ -99,6 +99,7 @@ typedef pthread_cond_t embb_condition_t;
/* EMBB_PLATFORM_THREADING_POSIXTHREADS */
#elif defined EMBB_PLATFORM_THREADING_RTOSTASKS
#include <FreeRTOS/FreeRTOS.h>
#include <FreeRTOS/task.h>
#include <FreeRTOS/semphr.h>
...
...
@@ -112,7 +113,7 @@ typedef struct embb_thread_t {
struct
embb_internal_thread_arg_t
*
embb_internal_arg
;
}
embb_thread_t
;
typedef
Task
Status
_t
embb_thread_id_t
;
typedef
Task
Handle
_t
embb_thread_id_t
;
typedef
SemaphoreHandle_t
embb_mutex_t
;
typedef
SemaphoreHandle_t
embb_condition_t
;
// scm34681: implement FreeRTOS condition variable
...
...
base_c/src/thread.c
View file @
53832595
...
...
@@ -360,7 +360,7 @@ embb_thread_start_t func, void *arg) {
thread
->
embb_internal_arg
->
func
=
func
;
thread
->
embb_internal_arg
->
arg
=
arg
;
status
=
xTaskCreate
(
embb_internal_thread_start
,
// entry function
status
=
xTaskCreate
(
(
TaskFunction_t
)
embb_internal_thread_start
,
// entry function
0
,
// task name (not needed)
128
,
// stack size
thread
->
embb_internal_arg
,
// parameters
...
...
base_cpp/CMakeLists.txt
View file @
53832595
...
...
@@ -27,6 +27,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include
${
CMAKE_CURRENT_BINARY_DIR
}
/../base_c/include
)
## BUILD TARGETS
#
add_library
(
embb_base_cpp
${
EMBB_BASE_CPP_SOURCES
}
${
EMBB_BASE_CPP_HEADERS
}
)
...
...
base_cpp/include/embb/base/internal/platform.h
View file @
53832595
...
...
@@ -64,7 +64,23 @@ typedef embb_condition_t ConditionVariableType;
}
// namespace base
}
// namespace embb
#else // EMBB_PLATFORM_THREADING_POSIXTHREADS
// EMBB_PLATFORM_THREADING_POSIXTHREADS
#elif defined EMBB_PLATFORM_THREADING_RTOSTASKS
namespace
embb
{
namespace
base
{
namespace
internal
{
typedef
embb_thread_t
ThreadType
;
typedef
embb_thread_id_t
IDType
;
typedef
embb_mutex_t
MutexType
;
typedef
embb_condition_t
ConditionVariableType
;
}
// namespace internal
}
// namespace base
}
// namespace embb
#else //EMBB_PLATFORM_THREADING_RTOSTASKS
#error "No threading platform defined!"
...
...
base_cpp/src/thread.cc
View file @
53832595
...
...
@@ -61,6 +61,8 @@ void Thread::Join() {
Thread
::
ID
Thread
::
GetID
()
{
#if defined EMBB_PLATFORM_THREADING_WINTHREADS
return
Thread
::
ID
(
GetCurrentThreadId
());
#elif defined EMBB_PLATFORM_THREADING_RTOSTASKS
return
Thread
::
ID
(
rep_
.
embb_internal_handle
);
// scm34681: check if this works with rtos tasks
#elif defined EMBB_PLATFORM_THREADING_POSIXTHREADS
return
Thread
::
ID
(
rep_
.
embb_internal_handle
);
#endif
...
...
@@ -69,6 +71,8 @@ Thread::ID Thread::GetID() {
bool
operator
==
(
Thread
::
ID
lhs
,
Thread
::
ID
rhs
)
{
#if defined EMBB_PLATFORM_THREADING_WINTHREADS
return
lhs
.
id_
==
rhs
.
id_
;
#elif defined EMBB_PLATFORM_THREADING_RTOSTASKS
return
lhs
.
id_
==
rhs
.
id_
;
// scm34681 check if this works with rtos tasks
#else
return
pthread_equal
(
lhs
.
id_
,
rhs
.
id_
)
!=
0
;
#endif
...
...
@@ -77,6 +81,8 @@ bool operator==(Thread::ID lhs, Thread::ID rhs) {
bool
operator
!=
(
Thread
::
ID
lhs
,
Thread
::
ID
rhs
)
{
#if defined EMBB_PLATFORM_THREADING_WINTHREADS
return
lhs
.
id_
!=
rhs
.
id_
;
#elif defined EMBB_PLATFORM_THREADING_RTOSTASKS
return
lhs
.
id_
!=
rhs
.
id_
;
// scm34681 check if this works with rtos tasks
#else
return
pthread_equal
(
lhs
.
id_
,
rhs
.
id_
)
==
0
;
#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