[committed, PATCH 1/3] RTEMS: Add set/get name <sys/lock.h> functions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[committed, PATCH 1/3] RTEMS: Add set/get name <sys/lock.h> functions

Sebastian Huber-4
Add inline functions to set/get the name.

Signed-off-by: Sebastian Huber <[hidden email]>
---
 newlib/libc/sys/rtems/include/sys/lock.h | 72 +++++++++++++++++++++++++++++++-
 1 file changed, 71 insertions(+), 1 deletion(-)

diff --git a/newlib/libc/sys/rtems/include/sys/lock.h b/newlib/libc/sys/rtems/include/sys/lock.h
index ec3415a52..f2666ed31 100644
--- a/newlib/libc/sys/rtems/include/sys/lock.h
+++ b/newlib/libc/sys/rtems/include/sys/lock.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 embedded brains GmbH.  All rights reserved.
+ * Copyright (c) 2015, 2017 embedded brains GmbH.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -119,6 +119,20 @@ _Mutex_Initialize_named(struct _Mutex_Control *_mutex, const char *_name)
  *_mutex = _init;
 }
 
+static __inline void
+_Mutex_Set_name(struct _Mutex_Control *_mutex, const char *_name)
+{
+
+ _mutex->_Queue._name = _name;
+}
+
+static __inline const char *
+_Mutex_Get_name(const struct _Mutex_Control *_mutex)
+{
+
+ return (_mutex->_Queue._name);
+}
+
 void _Mutex_Acquire(struct _Mutex_Control *);
 
 int _Mutex_Acquire_timed(struct _Mutex_Control *, const struct timespec *);
@@ -152,6 +166,20 @@ _Mutex_recursive_Initialize_named(struct _Mutex_recursive_Control *_mutex,
  *_mutex = _init;
 }
 
+static __inline void
+_Mutex_recursive_Set_name(struct _Mutex_recursive_Control *_mutex, const char *_name)
+{
+
+ _mutex->_Mutex._Queue._name = _name;
+}
+
+static __inline const char *
+_Mutex_recursive_Get_name(const struct _Mutex_recursive_Control *_mutex)
+{
+
+ return (_mutex->_Mutex._Queue._name);
+}
+
 void _Mutex_recursive_Acquire(struct _Mutex_recursive_Control *);
 
 int _Mutex_recursive_Acquire_timed(struct _Mutex_recursive_Control *,
@@ -185,6 +213,20 @@ _Condition_Initialize_named(struct _Condition_Control *_cond,
  *_cond = _init;
 }
 
+static __inline void
+_Condition_Set_name(struct _Condition_Control *_condition, const char *_name)
+{
+
+ _condition->_Queue._name = _name;
+}
+
+static __inline const char *
+_Condition_Get_name(const struct _Condition_Control *_condition)
+{
+
+ return (_condition->_Queue._name);
+}
+
 void _Condition_Wait(struct _Condition_Control *, struct _Mutex_Control *);
 
 int _Condition_Wait_timed(struct _Condition_Control *,
@@ -226,6 +268,20 @@ _Semaphore_Initialize_named(struct _Semaphore_Control *_semaphore,
  *_semaphore = _init;
 }
 
+static __inline void
+_Semaphore_Set_name(struct _Semaphore_Control *_semaphore, const char *_name)
+{
+
+ _semaphore->_Queue._name = _name;
+}
+
+static __inline const char *
+_Semaphore_Get_name(const struct _Semaphore_Control *_semaphore)
+{
+
+ return (_semaphore->_Queue._name);
+}
+
 void _Semaphore_Wait(struct _Semaphore_Control *);
 
 void _Semaphore_Post(struct _Semaphore_Control *);
@@ -253,6 +309,20 @@ _Futex_Initialize_named(struct _Futex_Control *_futex, const char *_name)
  *_futex = _init;
 }
 
+static __inline void
+_Futex_Set_name(struct _Futex_Control *_futex, const char *_name)
+{
+
+ _futex->_Queue._name = _name;
+}
+
+static __inline const char *
+_Futex_Get_name(const struct _Futex_Control *_futex)
+{
+
+ return (_futex->_Queue._name);
+}
+
 int _Futex_Wait(struct _Futex_Control *, int *, int);
 
 int _Futex_Wake(struct _Futex_Control *, int);
--
2.12.3

Reply | Threaded
Open this post in threaded view
|

[committed, PATCH 2/3] RTEMS: Timed wait by ticks <sys/lock.h> functions

Sebastian Huber-4
Declare timed wait by ticks functions.

Signed-off-by: Sebastian Huber <[hidden email]>
---
 newlib/libc/sys/rtems/include/sys/lock.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/sys/lock.h b/newlib/libc/sys/rtems/include/sys/lock.h
index f2666ed31..85b0cd8c4 100644
--- a/newlib/libc/sys/rtems/include/sys/lock.h
+++ b/newlib/libc/sys/rtems/include/sys/lock.h
@@ -137,6 +137,8 @@ void _Mutex_Acquire(struct _Mutex_Control *);
 
 int _Mutex_Acquire_timed(struct _Mutex_Control *, const struct timespec *);
 
+int _Mutex_Acquire_timed_ticks(struct _Mutex_Control *, __uint32_t);
+
 int _Mutex_Try_acquire(struct _Mutex_Control *);
 
 void _Mutex_Release(struct _Mutex_Control *);
@@ -185,6 +187,9 @@ void _Mutex_recursive_Acquire(struct _Mutex_recursive_Control *);
 int _Mutex_recursive_Acquire_timed(struct _Mutex_recursive_Control *,
     const struct timespec *);
 
+int _Mutex_recursive_Acquire_timed_ticks(struct _Mutex_recursive_Control *,
+    __uint32_t);
+
 int _Mutex_recursive_Try_acquire(struct _Mutex_recursive_Control *);
 
 void _Mutex_recursive_Release(struct _Mutex_recursive_Control *);
@@ -232,12 +237,18 @@ void _Condition_Wait(struct _Condition_Control *, struct _Mutex_Control *);
 int _Condition_Wait_timed(struct _Condition_Control *,
     struct _Mutex_Control *, const struct timespec *);
 
+int _Condition_Wait_timed_ticks(struct _Condition_Control *,
+    struct _Mutex_Control *, __uint32_t);
+
 void _Condition_Wait_recursive(struct _Condition_Control *,
     struct _Mutex_recursive_Control *);
 
 int _Condition_Wait_recursive_timed(struct _Condition_Control *,
     struct _Mutex_recursive_Control *, const struct timespec *);
 
+int _Condition_Wait_recursive_timed_ticks(struct _Condition_Control *,
+    struct _Mutex_recursive_Control *, __uint32_t);
+
 void _Condition_Signal(struct _Condition_Control *);
 
 void _Condition_Broadcast(struct _Condition_Control *);
@@ -284,6 +295,11 @@ _Semaphore_Get_name(const struct _Semaphore_Control *_semaphore)
 
 void _Semaphore_Wait(struct _Semaphore_Control *);
 
+int _Semaphore_Wait_timed(struct _Semaphore_Control *,
+    const struct timespec *);
+
+int _Semaphore_Wait_timed_ticks(struct _Semaphore_Control *, __uint32_t);
+
 void _Semaphore_Post(struct _Semaphore_Control *);
 
 static __inline void
--
2.12.3

Reply | Threaded
Open this post in threaded view
|

[committed, PATCH 3/3] RTEMS: Add semaphore <sys/lock.h> functions

Sebastian Huber-4
In reply to this post by Sebastian Huber-4
Declare semaphore try wait and post binary functions.

Signed-off-by: Sebastian Huber <[hidden email]>
---
 newlib/libc/sys/rtems/include/sys/lock.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/sys/lock.h b/newlib/libc/sys/rtems/include/sys/lock.h
index 85b0cd8c4..d6169025b 100644
--- a/newlib/libc/sys/rtems/include/sys/lock.h
+++ b/newlib/libc/sys/rtems/include/sys/lock.h
@@ -300,8 +300,12 @@ int _Semaphore_Wait_timed(struct _Semaphore_Control *,
 
 int _Semaphore_Wait_timed_ticks(struct _Semaphore_Control *, __uint32_t);
 
+int _Semaphore_Try_wait(struct _Semaphore_Control *);
+
 void _Semaphore_Post(struct _Semaphore_Control *);
 
+void _Semaphore_Post_binary(struct _Semaphore_Control *);
+
 static __inline void
 _Semaphore_Destroy(struct _Semaphore_Control *_semaphore)
 {
--
2.12.3