[PATCH 3/9] score: Create mutex implementation header

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Jul 17 14:18:54 UTC 2013


Move implementation specific parts of coremutex.h and coremutex.inl into
new header file coremuteximpl.h.  The coremutex.h contains now only the
application visible API.
---
 cpukit/libnetworking/rtems/rtems_glue.c          |    1 +
 cpukit/posix/include/rtems/posix/muteximpl.h     |    1 +
 cpukit/posix/src/mutex.c                         |    2 +-
 cpukit/posix/src/mutexattrdestroy.c              |    2 +-
 cpukit/posix/src/mutexattrgetprioceiling.c       |    2 +-
 cpukit/posix/src/mutexattrgetprotocol.c          |    2 +-
 cpukit/posix/src/mutexattrgetpshared.c           |    2 +-
 cpukit/posix/src/mutexattrgettype.c              |    2 +-
 cpukit/posix/src/mutexattrinit.c                 |    2 +-
 cpukit/posix/src/mutexattrsetprioceiling.c       |    2 +-
 cpukit/posix/src/mutexattrsetprotocol.c          |    2 +-
 cpukit/posix/src/mutexattrsetpshared.c           |    2 +-
 cpukit/posix/src/mutexattrsettype.c              |    2 +-
 cpukit/posix/src/mutexdestroy.c                  |    2 +-
 cpukit/posix/src/mutexget.c                      |    2 +-
 cpukit/posix/src/mutexgetprioceiling.c           |    2 +-
 cpukit/posix/src/mutexinit.c                     |    2 +-
 cpukit/posix/src/mutexlock.c                     |    2 +-
 cpukit/posix/src/mutexlocksupp.c                 |    2 +-
 cpukit/posix/src/mutexsetprioceiling.c           |    2 +-
 cpukit/posix/src/mutextimedlock.c                |    2 +-
 cpukit/posix/src/mutextrylock.c                  |    2 +-
 cpukit/posix/src/mutexunlock.c                   |    2 +-
 cpukit/rtems/src/sem.c                           |    2 +-
 cpukit/rtems/src/semcreate.c                     |    2 +-
 cpukit/rtems/src/semdelete.c                     |    2 +-
 cpukit/rtems/src/semflush.c                      |    2 +-
 cpukit/rtems/src/semident.c                      |    2 +-
 cpukit/rtems/src/semobtain.c                     |    2 +-
 cpukit/rtems/src/semrelease.c                    |    2 +-
 cpukit/rtems/src/semtranslatereturncode.c        |    2 +-
 cpukit/score/Makefile.am                         |    2 +-
 cpukit/score/include/rtems/score/coremutex.h     |  329 +-------------
 cpukit/score/include/rtems/score/coremuteximpl.h |  531 ++++++++++++++++++++++
 cpukit/score/inline/rtems/score/coremutex.inl    |  235 ----------
 cpukit/score/preinstall.am                       |    8 +-
 cpukit/score/src/apimutexallocate.c              |    1 +
 cpukit/score/src/apimutexlock.c                  |    1 +
 cpukit/score/src/coremutex.c                     |    2 +-
 cpukit/score/src/coremutexflush.c                |    2 +-
 cpukit/score/src/coremutexseize.c                |    2 +-
 cpukit/score/src/coremutexseizeintr.c            |    2 +-
 cpukit/score/src/coremutexsurrender.c            |    2 +-
 43 files changed, 591 insertions(+), 586 deletions(-)
 create mode 100644 cpukit/score/include/rtems/score/coremuteximpl.h
 delete mode 100644 cpukit/score/inline/rtems/score/coremutex.inl

diff --git a/cpukit/libnetworking/rtems/rtems_glue.c b/cpukit/libnetworking/rtems/rtems_glue.c
index 61ac905..3412051 100644
--- a/cpukit/libnetworking/rtems/rtems_glue.c
+++ b/cpukit/libnetworking/rtems/rtems_glue.c
@@ -18,6 +18,7 @@
 #include <rtems/error.h>
 #include <rtems/rtems_bsdnet.h>
 #include <rtems/rtems/semimpl.h>
+#include <rtems/score/coremuteximpl.h>
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/domain.h>
diff --git a/cpukit/posix/include/rtems/posix/muteximpl.h b/cpukit/posix/include/rtems/posix/muteximpl.h
index 27ed0c7..d4673aa 100644
--- a/cpukit/posix/include/rtems/posix/muteximpl.h
+++ b/cpukit/posix/include/rtems/posix/muteximpl.h
@@ -16,6 +16,7 @@
  */
 
 #include <rtems/posix/mutex.h>
+#include <rtems/score/coremuteximpl.h>
 
 #ifndef _RTEMS_POSIX_MUTEXIMPL_H
 #define _RTEMS_POSIX_MUTEXIMPL_H
diff --git a/cpukit/posix/src/mutex.c b/cpukit/posix/src/mutex.c
index 860588f..31892db 100644
--- a/cpukit/posix/src/mutex.c
+++ b/cpukit/posix/src/mutex.c
@@ -24,7 +24,7 @@
 
 #include <rtems/system.h>
 #include <rtems/config.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #if defined(RTEMS_MULTIPROCESSING)
 #include <rtems/score/mpci.h>
diff --git a/cpukit/posix/src/mutexattrdestroy.c b/cpukit/posix/src/mutexattrdestroy.c
index c4e4d1b..3220638 100644
--- a/cpukit/posix/src/mutexattrdestroy.c
+++ b/cpukit/posix/src/mutexattrdestroy.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/posix/muteximpl.h>
 #include <rtems/posix/priority.h>
diff --git a/cpukit/posix/src/mutexattrgetprioceiling.c b/cpukit/posix/src/mutexattrgetprioceiling.c
index 5a805f6..7903b3f 100644
--- a/cpukit/posix/src/mutexattrgetprioceiling.c
+++ b/cpukit/posix/src/mutexattrgetprioceiling.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/posix/muteximpl.h>
 #include <rtems/posix/priority.h>
diff --git a/cpukit/posix/src/mutexattrgetprotocol.c b/cpukit/posix/src/mutexattrgetprotocol.c
index 5fb4945..46533a1 100644
--- a/cpukit/posix/src/mutexattrgetprotocol.c
+++ b/cpukit/posix/src/mutexattrgetprotocol.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/posix/muteximpl.h>
 #include <rtems/posix/priority.h>
diff --git a/cpukit/posix/src/mutexattrgetpshared.c b/cpukit/posix/src/mutexattrgetpshared.c
index d872325..63afe57 100644
--- a/cpukit/posix/src/mutexattrgetpshared.c
+++ b/cpukit/posix/src/mutexattrgetpshared.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/posix/muteximpl.h>
 #include <rtems/posix/priority.h>
diff --git a/cpukit/posix/src/mutexattrgettype.c b/cpukit/posix/src/mutexattrgettype.c
index 5baaf2a..97ea551 100644
--- a/cpukit/posix/src/mutexattrgettype.c
+++ b/cpukit/posix/src/mutexattrgettype.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/posix/muteximpl.h>
 #include <rtems/posix/priority.h>
diff --git a/cpukit/posix/src/mutexattrinit.c b/cpukit/posix/src/mutexattrinit.c
index 7cd1ca6..d862cdc 100644
--- a/cpukit/posix/src/mutexattrinit.c
+++ b/cpukit/posix/src/mutexattrinit.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/posix/muteximpl.h>
 #include <rtems/posix/priority.h>
diff --git a/cpukit/posix/src/mutexattrsetprioceiling.c b/cpukit/posix/src/mutexattrsetprioceiling.c
index 35ef93e..49935bb 100644
--- a/cpukit/posix/src/mutexattrsetprioceiling.c
+++ b/cpukit/posix/src/mutexattrsetprioceiling.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/posix/muteximpl.h>
 #include <rtems/posix/priority.h>
diff --git a/cpukit/posix/src/mutexattrsetprotocol.c b/cpukit/posix/src/mutexattrsetprotocol.c
index 50ce247..4718606 100644
--- a/cpukit/posix/src/mutexattrsetprotocol.c
+++ b/cpukit/posix/src/mutexattrsetprotocol.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/posix/muteximpl.h>
 #include <rtems/posix/priority.h>
diff --git a/cpukit/posix/src/mutexattrsetpshared.c b/cpukit/posix/src/mutexattrsetpshared.c
index a3a0963..9075094 100644
--- a/cpukit/posix/src/mutexattrsetpshared.c
+++ b/cpukit/posix/src/mutexattrsetpshared.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/posix/muteximpl.h>
 #include <rtems/posix/priority.h>
diff --git a/cpukit/posix/src/mutexattrsettype.c b/cpukit/posix/src/mutexattrsettype.c
index 58aad0b..43a977c 100644
--- a/cpukit/posix/src/mutexattrsettype.c
+++ b/cpukit/posix/src/mutexattrsettype.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/posix/muteximpl.h>
 #include <rtems/posix/priority.h>
diff --git a/cpukit/posix/src/mutexdestroy.c b/cpukit/posix/src/mutexdestroy.c
index 55a3abb..986ebb3 100644
--- a/cpukit/posix/src/mutexdestroy.c
+++ b/cpukit/posix/src/mutexdestroy.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/posix/muteximpl.h>
 #include <rtems/posix/priority.h>
diff --git a/cpukit/posix/src/mutexget.c b/cpukit/posix/src/mutexget.c
index 85c620a..ebfe8aa 100644
--- a/cpukit/posix/src/mutexget.c
+++ b/cpukit/posix/src/mutexget.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #if defined(RTEMS_MULTIPROCESSING)
 #include <rtems/score/mpci.h>
 #endif
diff --git a/cpukit/posix/src/mutexgetprioceiling.c b/cpukit/posix/src/mutexgetprioceiling.c
index 1e441a2..b276505 100644
--- a/cpukit/posix/src/mutexgetprioceiling.c
+++ b/cpukit/posix/src/mutexgetprioceiling.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #if defined(RTEMS_MULTIPROCESSING)
 #include <rtems/score/mpci.h>
diff --git a/cpukit/posix/src/mutexinit.c b/cpukit/posix/src/mutexinit.c
index 44ecad3..d4f188c 100644
--- a/cpukit/posix/src/mutexinit.c
+++ b/cpukit/posix/src/mutexinit.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/posix/muteximpl.h>
 #include <rtems/posix/priority.h>
diff --git a/cpukit/posix/src/mutexlock.c b/cpukit/posix/src/mutexlock.c
index cfcb460..7df3511 100644
--- a/cpukit/posix/src/mutexlock.c
+++ b/cpukit/posix/src/mutexlock.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #if defined(RTEMS_MULTIPROCESSING)
 #include <rtems/score/mpci.h>
diff --git a/cpukit/posix/src/mutexlocksupp.c b/cpukit/posix/src/mutexlocksupp.c
index 8d6484a..8b6274b 100644
--- a/cpukit/posix/src/mutexlocksupp.c
+++ b/cpukit/posix/src/mutexlocksupp.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #if defined(RTEMS_MULTIPROCESSING)
 #include <rtems/score/mpci.h>
diff --git a/cpukit/posix/src/mutexsetprioceiling.c b/cpukit/posix/src/mutexsetprioceiling.c
index 86ad134..90ac2a3 100644
--- a/cpukit/posix/src/mutexsetprioceiling.c
+++ b/cpukit/posix/src/mutexsetprioceiling.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #include <rtems/posix/muteximpl.h>
 #include <rtems/posix/priority.h>
diff --git a/cpukit/posix/src/mutextimedlock.c b/cpukit/posix/src/mutextimedlock.c
index 532f1bd..b054a3f 100644
--- a/cpukit/posix/src/mutextimedlock.c
+++ b/cpukit/posix/src/mutextimedlock.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #if defined(RTEMS_MULTIPROCESSING)
 #include <rtems/score/mpci.h>
diff --git a/cpukit/posix/src/mutextrylock.c b/cpukit/posix/src/mutextrylock.c
index 75d0482..2e65af0 100644
--- a/cpukit/posix/src/mutextrylock.c
+++ b/cpukit/posix/src/mutextrylock.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #if defined(RTEMS_MULTIPROCESSING)
 #include <rtems/score/mpci.h>
diff --git a/cpukit/posix/src/mutexunlock.c b/cpukit/posix/src/mutexunlock.c
index 50e16b4..a7dbd22 100644
--- a/cpukit/posix/src/mutexunlock.c
+++ b/cpukit/posix/src/mutexunlock.c
@@ -22,7 +22,7 @@
 #include <pthread.h>
 
 #include <rtems/system.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/watchdog.h>
 #if defined(RTEMS_MULTIPROCESSING)
 #include <rtems/score/mpci.h>
diff --git a/cpukit/rtems/src/sem.c b/cpukit/rtems/src/sem.c
index 47188e2..41bb763 100644
--- a/cpukit/rtems/src/sem.c
+++ b/cpukit/rtems/src/sem.c
@@ -27,7 +27,7 @@
 #include <rtems/score/object.h>
 #include <rtems/rtems/options.h>
 #include <rtems/rtems/semimpl.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/coresem.h>
 #include <rtems/score/states.h>
 #include <rtems/score/thread.h>
diff --git a/cpukit/rtems/src/semcreate.c b/cpukit/rtems/src/semcreate.c
index 60ce2cc..0f5bca4 100644
--- a/cpukit/rtems/src/semcreate.c
+++ b/cpukit/rtems/src/semcreate.c
@@ -26,7 +26,7 @@
 #include <rtems/score/object.h>
 #include <rtems/rtems/options.h>
 #include <rtems/rtems/semimpl.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/coresem.h>
 #include <rtems/score/states.h>
 #include <rtems/score/thread.h>
diff --git a/cpukit/rtems/src/semdelete.c b/cpukit/rtems/src/semdelete.c
index 0705292..0b9d298 100644
--- a/cpukit/rtems/src/semdelete.c
+++ b/cpukit/rtems/src/semdelete.c
@@ -26,7 +26,7 @@
 #include <rtems/score/object.h>
 #include <rtems/rtems/options.h>
 #include <rtems/rtems/semimpl.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/coresem.h>
 #include <rtems/score/states.h>
 #include <rtems/score/thread.h>
diff --git a/cpukit/rtems/src/semflush.c b/cpukit/rtems/src/semflush.c
index 0b5aaeb..10c3882 100644
--- a/cpukit/rtems/src/semflush.c
+++ b/cpukit/rtems/src/semflush.c
@@ -26,7 +26,7 @@
 #include <rtems/score/object.h>
 #include <rtems/rtems/options.h>
 #include <rtems/rtems/semimpl.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/coresem.h>
 #include <rtems/score/states.h>
 #include <rtems/score/thread.h>
diff --git a/cpukit/rtems/src/semident.c b/cpukit/rtems/src/semident.c
index df6f050..02edd7f 100644
--- a/cpukit/rtems/src/semident.c
+++ b/cpukit/rtems/src/semident.c
@@ -26,7 +26,7 @@
 #include <rtems/score/object.h>
 #include <rtems/rtems/options.h>
 #include <rtems/rtems/semimpl.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/coresem.h>
 #include <rtems/score/states.h>
 #include <rtems/score/thread.h>
diff --git a/cpukit/rtems/src/semobtain.c b/cpukit/rtems/src/semobtain.c
index 3891782..7197496 100644
--- a/cpukit/rtems/src/semobtain.c
+++ b/cpukit/rtems/src/semobtain.c
@@ -26,7 +26,7 @@
 #include <rtems/score/object.h>
 #include <rtems/rtems/options.h>
 #include <rtems/rtems/semimpl.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/coresem.h>
 #include <rtems/score/states.h>
 #include <rtems/score/thread.h>
diff --git a/cpukit/rtems/src/semrelease.c b/cpukit/rtems/src/semrelease.c
index be3f7d0..760f4d4 100644
--- a/cpukit/rtems/src/semrelease.c
+++ b/cpukit/rtems/src/semrelease.c
@@ -41,7 +41,7 @@
 #include <rtems/score/object.h>
 #include <rtems/rtems/options.h>
 #include <rtems/rtems/semimpl.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/coresem.h>
 #include <rtems/score/states.h>
 #include <rtems/score/thread.h>
diff --git a/cpukit/rtems/src/semtranslatereturncode.c b/cpukit/rtems/src/semtranslatereturncode.c
index 531a904..cd06883 100644
--- a/cpukit/rtems/src/semtranslatereturncode.c
+++ b/cpukit/rtems/src/semtranslatereturncode.c
@@ -26,7 +26,7 @@
 #include <rtems/score/object.h>
 #include <rtems/rtems/options.h>
 #include <rtems/rtems/semimpl.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/coresem.h>
 #include <rtems/score/states.h>
 #include <rtems/score/thread.h>
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 98ed6ea..8722c6e 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -24,6 +24,7 @@ include_rtems_score_HEADERS += include/rtems/score/copyrt.h
 include_rtems_score_HEADERS += include/rtems/score/corebarrier.h
 include_rtems_score_HEADERS += include/rtems/score/coremsg.h
 include_rtems_score_HEADERS += include/rtems/score/coremutex.h
+include_rtems_score_HEADERS += include/rtems/score/coremuteximpl.h
 include_rtems_score_HEADERS += include/rtems/score/coresem.h
 include_rtems_score_HEADERS += include/rtems/score/heap.h
 include_rtems_score_HEADERS += include/rtems/score/protectedheap.h
@@ -87,7 +88,6 @@ include_rtems_score_HEADERS += inline/rtems/score/address.inl
 include_rtems_score_HEADERS += inline/rtems/score/chain.inl
 include_rtems_score_HEADERS += inline/rtems/score/corebarrier.inl
 include_rtems_score_HEADERS += inline/rtems/score/coremsg.inl
-include_rtems_score_HEADERS += inline/rtems/score/coremutex.inl
 include_rtems_score_HEADERS += inline/rtems/score/coresem.inl
 include_rtems_score_HEADERS += inline/rtems/score/heap.inl
 include_rtems_score_HEADERS += inline/rtems/score/isr.inl
diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h
index f6c377c..bf0ac1e 100644
--- a/cpukit/score/include/rtems/score/coremutex.h
+++ b/cpukit/score/include/rtems/score/coremutex.h
@@ -1,12 +1,12 @@
 /**
- *  @file  rtems/score/coremutex.h
+ * @file
  *
- *  @brief Constants and Structures Associated with the Mutex Handler
+ * @brief CORE Mutex API
  *
- *  This include file contains all the constants and structures associated
- *  with the Mutex Handler.  A mutex is an enhanced version of the standard
- *  Dijkstra binary semaphore used to provide synchronization and mutual
- *  exclusion capabilities.
+ * This include file contains all the constants and structures associated with
+ * the Mutex Handler.  A mutex is an enhanced version of the standard Dijkstra
+ * binary semaphore used to provide synchronization and mutual exclusion
+ * capabilities.
  */
 
 /*
@@ -20,19 +20,6 @@
 
 #ifndef _RTEMS_SCORE_COREMUTEX_H
 #define _RTEMS_SCORE_COREMUTEX_H
-/**
- *  @defgroup ScoreMutex Mutex Handler
- *
- *  @ingroup Score
- *
- *  This handler encapsulates functionality which provides the foundation
- *  Mutex services used in all of the APIs supported by RTEMS.
- */
-/**@{*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
 
 #include <rtems/score/thread.h>
 #include <rtems/score/threadq.h>
@@ -41,16 +28,19 @@ extern "C" {
 #include <rtems/score/interr.h>
 #include <rtems/score/sysstate.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
- *  @brief Callout which provides to support global/multiprocessor operations.
+ *  @defgroup ScoreMutex Mutex Handler
  *
- *  The following type defines the callout which the API provides
- *  to support global/multiprocessor operations on mutexes.
+ *  @ingroup Score
+ *
+ *  This handler encapsulates functionality which provides the foundation
+ *  Mutex services used in all of the APIs supported by RTEMS.
  */
-typedef void ( *CORE_mutex_API_mp_support_callout )(
-                 Thread_Control *,
-                 Objects_Id
-             );
+/**@{*/
 
 /**
  *  @brief The blocking disciplines for a mutex.
@@ -73,60 +63,6 @@ typedef enum {
 }   CORE_mutex_Disciplines;
 
 /**
- *  @brief The possible Mutex handler return statuses.
- *
- *  This enumerated type defines the possible Mutex handler return statuses.
- */
-typedef enum {
-  /** This status indicates that the operation completed successfully. */
-  CORE_MUTEX_STATUS_SUCCESSFUL,
-  /** This status indicates that the calling task did not want to block
-   *  and the operation was unable to complete immediately because the
-   *  resource was unavailable.
-   */
-  CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT,
-#if defined(RTEMS_POSIX_API)
-  /** This status indicates that an attempt was made to relock a mutex
-   *  for which nesting is not configured.
-   */
-  CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED,
-#endif
-  /** This status indicates that an attempt was made to release a mutex
-   *  by a thread other than the thread which locked it.
-   */
-  CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE,
-  /** This status indicates that the thread was blocked waiting for an
-   *  operation to complete and the mutex was deleted.
-   */
-  CORE_MUTEX_WAS_DELETED,
-  /** This status indicates that the calling task was willing to block
-   *  but the operation was unable to complete within the time allotted
-   *  because the resource never became available.
-   */
-  CORE_MUTEX_TIMEOUT,
-
-#if defined(__RTEMS_STRICT_ORDER_MUTEX__)
-  /** This status indicates that a thread not release the mutex which has
-   *  the priority inheritance property in a right order.
-   */
-  CORE_MUTEX_RELEASE_NOT_ORDER,
-#endif
-
-  /** This status indicates that a thread of logically greater importance
-   *  than the ceiling priority attempted to lock this mutex.
-   */
-  CORE_MUTEX_STATUS_CEILING_VIOLATED
-
-}   CORE_mutex_Status;
-
-/**
- *  @brief The last status value.
- *
- *  This is the last status value.
- */
-#define CORE_MUTEX_STATUS_LAST CORE_MUTEX_STATUS_CEILING_VIOLATED
-
-/**
  *  @brief The possible behaviors for lock nesting.
  *
  *  This enumerated type defines the possible behaviors for
@@ -162,16 +98,6 @@ typedef enum {
 }  CORE_mutex_Nesting_behaviors;
 
 /**
- *  This is the value of a mutex when it is unlocked.
- */
-#define CORE_MUTEX_UNLOCKED 1
-
-/**
- *  This is the value of a mutex when it is locked.
- */
-#define CORE_MUTEX_LOCKED   0
-
-/**
  *  @brief The control block used to manage attributes of each mutex.
  *
  *  The following defines the control block used to manage the
@@ -253,232 +179,11 @@ typedef struct {
 
 }   CORE_mutex_Control;
 
-/**
- *  @brief Initializes the mutex based on the parameters passed.
- *
- *  This routine initializes the mutex based on the parameters passed.
- *
- *  @param[in] the_mutex is the mutex to initalize
- *  @param[in] the_mutex_attributes is the attributes associated with this
- *         mutex instance
- *  @param[in] initial_lock is the initial value of the mutex
- *
- *  @retval This method returns CORE_MUTEX_STATUS_SUCCESSFUL if successful.
- */
-CORE_mutex_Status _CORE_mutex_Initialize(
-  CORE_mutex_Control           *the_mutex,
-  CORE_mutex_Attributes        *the_mutex_attributes,
-  uint32_t                      initial_lock
-);
-
-#ifndef __RTEMS_APPLICATION__
-/**
- *  @brief Attempt to receive a unit from the_mutex.
- *
- *  This routine attempts to receive a unit from the_mutex.
- *  If a unit is available or if the wait flag is false, then the routine
- *  returns.  Otherwise, the calling task is blocked until a unit becomes
- *  available.
- *
- *  @param[in] the_mutex is the mutex to attempt to lock
- *  @param[in] level is the interrupt level
- *
- *  @retval This routine returns 0 if "trylock" can resolve whether or not
- *  the mutex is immediately obtained or there was an error attempting to
- *  get it.  It returns 1 to indicate that the caller cannot obtain
- *  the mutex and will have to block to do so.
- *
- *  @note  For performance reasons, this routine is implemented as
- *         a macro that uses two support routines.
- */
-
-RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
-  CORE_mutex_Control  *the_mutex,
-  ISR_Level            level
-);
-
-#if defined(__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__)
-  /**
-   *  @brief Interrupt trylock CORE mutex seize.
-   *
-   *  When doing test coverage analysis or trying to minimize the code
-   *  space for RTEMS, it is often helpful to not inline this method
-   *  multiple times.  It is fairly large and has a high branch complexity
-   *  which makes it harder to get full binary test coverage.
-   *
-   *  @param[in] the_mutex will attempt to lock
-   *  @param[in] level_p is the interrupt level
-   */
-  int _CORE_mutex_Seize_interrupt_trylock(
-    CORE_mutex_Control  *the_mutex,
-    ISR_Level            level
-  );
-#else
-  /**
-   *  The default is to favor speed and inlining this definitely saves
-   *  a few instructions.  This is very important for mutex performance.
-   *
-   *  @param[in] _mutex will attempt to lock
-   *  @param[in] _level is the interrupt level
-   */
-  #define _CORE_mutex_Seize_interrupt_trylock( _mutex, _level ) \
-     _CORE_mutex_Seize_interrupt_trylock_body( _mutex, _level )
-#endif
-
-/**
- *  @brief Performs the blocking portion of a mutex obtain.
- *
- *  This routine performs the blocking portion of a mutex obtain.
- *  It is an actual subroutine and is not implemented as something
- *  that may be inlined.
- *
- *  @param[in] the_mutex is the mutex to attempt to lock
- *  @param[in] timeout is the maximum number of ticks to block
- */
-void _CORE_mutex_Seize_interrupt_blocking(
-  CORE_mutex_Control  *the_mutex,
-  Watchdog_Interval    timeout
-);
-/**
- *  @brief Verifies that a mutex blocking seize is performed safely.
- *
- *  This macro is to verify that a mutex blocking seize is
- *  performed from a safe system state.  For example, one
- *  cannot block inside an isr.
- *
- *  @retval this method returns true if dispatch is in an unsafe state.
- */
-#ifdef RTEMS_SMP
-  #define _CORE_mutex_Check_dispatch_for_seize(_wait) 0
-#else
-  #define _CORE_mutex_Check_dispatch_for_seize(_wait) \
-      (!_Thread_Dispatch_is_enabled() \
-        && (_wait) \
-        && (_System_state_Get() >= SYSTEM_STATE_BEGIN_MULTITASKING))
-#endif
-
-/**
- *  @brief Attempt to obtain the mutex.
- *
- *  This routine attempts to obtain the mutex.  If the mutex is available,
- *  then it will return immediately.  Otherwise, it will invoke the
- *  support routine @a _Core_mutex_Seize_interrupt_blocking.
- *
- *  @param[in] _the_mutex is the mutex to attempt to lock
- *  @param[in] _id is the Id of the owning API level Semaphore object
- *  @param[in] _wait is true if the thread is willing to wait
- *  @param[in] _timeout is the maximum number of ticks to block
- *  @param[in] _level is a temporary variable used to contain the ISR
- *         disable level cookie
- *
- *  @note If the mutex is called from an interrupt service routine,
- *        with context switching disabled, or before multitasking,
- *        then a fatal error is generated.
- *
- *  The logic on this routine is as follows:
- *
- *  * If incorrect system state
- *      return an error
- *  * If mutex is available without any contention or blocking
- *      obtain it with interrupts disabled and returned
- *  * If the caller is willing to wait
- *      then they are blocked.
- */
-#define _CORE_mutex_Seize_body( \
-  _the_mutex, _id, _wait, _timeout, _level ) \
-  do { \
-    if ( _CORE_mutex_Check_dispatch_for_seize(_wait) ) { \
-        _Internal_error_Occurred( \
-           INTERNAL_ERROR_CORE, \
-           false, \
-           INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE \
-           ); \
-    } \
-    if ( _CORE_mutex_Seize_interrupt_trylock( _the_mutex, _level ) ) {  \
-      if ( !(_wait) ) { \
-        _ISR_Enable( _level ); \
-        _Thread_Executing->Wait.return_code = \
-          CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT; \
-      } else { \
-        _Thread_queue_Enter_critical_section( &(_the_mutex)->Wait_queue ); \
-        _Thread_Executing->Wait.queue = &(_the_mutex)->Wait_queue; \
-        _Thread_Executing->Wait.id    = _id; \
-        _Thread_Disable_dispatch(); \
-        _ISR_Enable( _level ); \
-       _CORE_mutex_Seize_interrupt_blocking( _the_mutex, _timeout ); \
-      } \
-    } \
-  } while (0)
-
-/**
- *  This method is used to obtain a core mutex.
- *
- *  @param[in] _the_mutex is the mutex to attempt to lock
- *  @param[in] _id is the Id of the owning API level Semaphore object
- *  @param[in] _wait is true if the thread is willing to wait
- *  @param[in] _timeout is the maximum number of ticks to block
- *  @param[in] _level is a temporary variable used to contain the ISR
- *         disable level cookie
- */
-#if defined(__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__)
-  void _CORE_mutex_Seize(
-    CORE_mutex_Control  *_the_mutex,
-    Objects_Id           _id,
-    bool                 _wait,
-    Watchdog_Interval    _timeout,
-    ISR_Level            _level
-  );
-#else
-  #define _CORE_mutex_Seize( _the_mutex, _id, _wait, _timeout, _level ) \
-     _CORE_mutex_Seize_body( _the_mutex, _id, _wait, _timeout, _level )
-#endif
-
-/**
- *  @brief Frees a unit to the mutex.
- *
- *  This routine frees a unit to the mutex.  If a task was blocked waiting for
- *  a unit from this mutex, then that task will be readied and the unit
- *  given to that task.  Otherwise, the unit will be returned to the mutex.
- *
- *  @param[in] the_mutex is the mutex to surrender
- *  @param[in] id is the id of the RTEMS Object associated with this mutex
- *  @param[in] api_mutex_mp_support is the routine that will be called when
- *         unblocking a remote mutex
- *
- *  @retval an indication of whether the routine succeeded or failed
- */
-CORE_mutex_Status _CORE_mutex_Surrender(
-  CORE_mutex_Control                *the_mutex,
-  Objects_Id                         id,
-  CORE_mutex_API_mp_support_callout  api_mutex_mp_support
-);
-
-/**
- *  @brief Flush all waiting threads.
- *
- *  This routine assists in the deletion of a mutex by flushing the associated
- *  wait queue.
- *
- *  @param[in] the_mutex is the mutex to flush
- *  @param[in] remote_extract_callout is the routine to invoke when a remote
- *         thread is extracted
- *  @param[in] status is the status value which each unblocked thread will
- *         return to its caller.
- */
-void _CORE_mutex_Flush(
-  CORE_mutex_Control         *the_mutex,
-  Thread_queue_Flush_callout  remote_extract_callout,
-  uint32_t                    status
-);
-
-#include <rtems/score/coremutex.inl>
-#endif
+/**@}*/
 
 #ifdef __cplusplus
 }
 #endif
 
-/**@}*/
-
 #endif
 /*  end of include file */
diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h b/cpukit/score/include/rtems/score/coremuteximpl.h
new file mode 100644
index 0000000..69be9ac
--- /dev/null
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -0,0 +1,531 @@
+/**
+ * @file
+ *
+ * @ingroup ScoreMutex
+ *
+ * @brief CORE Mutex Implementation
+ */
+
+/*
+ *  COPYRIGHT (c) 1989-2009.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ */
+
+#ifndef _RTEMS_SCORE_COREMUTEXIMPL_H
+#define _RTEMS_SCORE_COREMUTEXIMPL_H
+
+#include <rtems/score/coremutex.h>
+#include <rtems/score/threaddispatch.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup ScoreMutex
+ */
+/**@{**/
+
+/**
+ *  @brief Callout which provides to support global/multiprocessor operations.
+ *
+ *  The following type defines the callout which the API provides
+ *  to support global/multiprocessor operations on mutexes.
+ */
+typedef void ( *CORE_mutex_API_mp_support_callout )(
+                 Thread_Control *,
+                 Objects_Id
+             );
+
+/**
+ *  @brief The possible Mutex handler return statuses.
+ *
+ *  This enumerated type defines the possible Mutex handler return statuses.
+ */
+typedef enum {
+  /** This status indicates that the operation completed successfully. */
+  CORE_MUTEX_STATUS_SUCCESSFUL,
+  /** This status indicates that the calling task did not want to block
+   *  and the operation was unable to complete immediately because the
+   *  resource was unavailable.
+   */
+  CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT,
+#if defined(RTEMS_POSIX_API)
+  /** This status indicates that an attempt was made to relock a mutex
+   *  for which nesting is not configured.
+   */
+  CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED,
+#endif
+  /** This status indicates that an attempt was made to release a mutex
+   *  by a thread other than the thread which locked it.
+   */
+  CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE,
+  /** This status indicates that the thread was blocked waiting for an
+   *  operation to complete and the mutex was deleted.
+   */
+  CORE_MUTEX_WAS_DELETED,
+  /** This status indicates that the calling task was willing to block
+   *  but the operation was unable to complete within the time allotted
+   *  because the resource never became available.
+   */
+  CORE_MUTEX_TIMEOUT,
+
+#if defined(__RTEMS_STRICT_ORDER_MUTEX__)
+  /** This status indicates that a thread not release the mutex which has
+   *  the priority inheritance property in a right order.
+   */
+  CORE_MUTEX_RELEASE_NOT_ORDER,
+#endif
+
+  /** This status indicates that a thread of logically greater importance
+   *  than the ceiling priority attempted to lock this mutex.
+   */
+  CORE_MUTEX_STATUS_CEILING_VIOLATED
+
+}   CORE_mutex_Status;
+
+/**
+ *  @brief The last status value.
+ *
+ *  This is the last status value.
+ */
+#define CORE_MUTEX_STATUS_LAST CORE_MUTEX_STATUS_CEILING_VIOLATED
+
+/**
+ *  This is the value of a mutex when it is unlocked.
+ */
+#define CORE_MUTEX_UNLOCKED 1
+
+/**
+ *  This is the value of a mutex when it is locked.
+ */
+#define CORE_MUTEX_LOCKED   0
+
+/**
+ *  @brief Initializes the mutex based on the parameters passed.
+ *
+ *  This routine initializes the mutex based on the parameters passed.
+ *
+ *  @param[in] the_mutex is the mutex to initalize
+ *  @param[in] the_mutex_attributes is the attributes associated with this
+ *         mutex instance
+ *  @param[in] initial_lock is the initial value of the mutex
+ *
+ *  @retval This method returns CORE_MUTEX_STATUS_SUCCESSFUL if successful.
+ */
+CORE_mutex_Status _CORE_mutex_Initialize(
+  CORE_mutex_Control           *the_mutex,
+  CORE_mutex_Attributes        *the_mutex_attributes,
+  uint32_t                      initial_lock
+);
+
+/**
+ *  @brief Attempt to receive a unit from the_mutex.
+ *
+ *  This routine attempts to receive a unit from the_mutex.
+ *  If a unit is available or if the wait flag is false, then the routine
+ *  returns.  Otherwise, the calling task is blocked until a unit becomes
+ *  available.
+ *
+ *  @param[in] the_mutex is the mutex to attempt to lock
+ *  @param[in] level is the interrupt level
+ *
+ *  @retval This routine returns 0 if "trylock" can resolve whether or not
+ *  the mutex is immediately obtained or there was an error attempting to
+ *  get it.  It returns 1 to indicate that the caller cannot obtain
+ *  the mutex and will have to block to do so.
+ *
+ *  @note  For performance reasons, this routine is implemented as
+ *         a macro that uses two support routines.
+ */
+
+RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
+  CORE_mutex_Control  *the_mutex,
+  ISR_Level            level
+);
+
+#if defined(__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__)
+  /**
+   *  @brief Interrupt trylock CORE mutex seize.
+   *
+   *  When doing test coverage analysis or trying to minimize the code
+   *  space for RTEMS, it is often helpful to not inline this method
+   *  multiple times.  It is fairly large and has a high branch complexity
+   *  which makes it harder to get full binary test coverage.
+   *
+   *  @param[in] the_mutex will attempt to lock
+   *  @param[in] level_p is the interrupt level
+   */
+  int _CORE_mutex_Seize_interrupt_trylock(
+    CORE_mutex_Control  *the_mutex,
+    ISR_Level            level
+  );
+#else
+  /**
+   *  The default is to favor speed and inlining this definitely saves
+   *  a few instructions.  This is very important for mutex performance.
+   *
+   *  @param[in] _mutex will attempt to lock
+   *  @param[in] _level is the interrupt level
+   */
+  #define _CORE_mutex_Seize_interrupt_trylock( _mutex, _level ) \
+     _CORE_mutex_Seize_interrupt_trylock_body( _mutex, _level )
+#endif
+
+/**
+ *  @brief Performs the blocking portion of a mutex obtain.
+ *
+ *  This routine performs the blocking portion of a mutex obtain.
+ *  It is an actual subroutine and is not implemented as something
+ *  that may be inlined.
+ *
+ *  @param[in] the_mutex is the mutex to attempt to lock
+ *  @param[in] timeout is the maximum number of ticks to block
+ */
+void _CORE_mutex_Seize_interrupt_blocking(
+  CORE_mutex_Control  *the_mutex,
+  Watchdog_Interval    timeout
+);
+/**
+ *  @brief Verifies that a mutex blocking seize is performed safely.
+ *
+ *  This macro is to verify that a mutex blocking seize is
+ *  performed from a safe system state.  For example, one
+ *  cannot block inside an isr.
+ *
+ *  @retval this method returns true if dispatch is in an unsafe state.
+ */
+#ifdef RTEMS_SMP
+  #define _CORE_mutex_Check_dispatch_for_seize(_wait) 0
+#else
+  #define _CORE_mutex_Check_dispatch_for_seize(_wait) \
+      (!_Thread_Dispatch_is_enabled() \
+        && (_wait) \
+        && (_System_state_Get() >= SYSTEM_STATE_BEGIN_MULTITASKING))
+#endif
+
+/**
+ *  @brief Attempt to obtain the mutex.
+ *
+ *  This routine attempts to obtain the mutex.  If the mutex is available,
+ *  then it will return immediately.  Otherwise, it will invoke the
+ *  support routine @a _Core_mutex_Seize_interrupt_blocking.
+ *
+ *  @param[in] _the_mutex is the mutex to attempt to lock
+ *  @param[in] _id is the Id of the owning API level Semaphore object
+ *  @param[in] _wait is true if the thread is willing to wait
+ *  @param[in] _timeout is the maximum number of ticks to block
+ *  @param[in] _level is a temporary variable used to contain the ISR
+ *         disable level cookie
+ *
+ *  @note If the mutex is called from an interrupt service routine,
+ *        with context switching disabled, or before multitasking,
+ *        then a fatal error is generated.
+ *
+ *  The logic on this routine is as follows:
+ *
+ *  * If incorrect system state
+ *      return an error
+ *  * If mutex is available without any contention or blocking
+ *      obtain it with interrupts disabled and returned
+ *  * If the caller is willing to wait
+ *      then they are blocked.
+ */
+#define _CORE_mutex_Seize_body( \
+  _the_mutex, _id, _wait, _timeout, _level ) \
+  do { \
+    if ( _CORE_mutex_Check_dispatch_for_seize(_wait) ) { \
+        _Internal_error_Occurred( \
+           INTERNAL_ERROR_CORE, \
+           false, \
+           INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE \
+           ); \
+    } \
+    if ( _CORE_mutex_Seize_interrupt_trylock( _the_mutex, _level ) ) {  \
+      if ( !(_wait) ) { \
+        _ISR_Enable( _level ); \
+        _Thread_Executing->Wait.return_code = \
+          CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT; \
+      } else { \
+        _Thread_queue_Enter_critical_section( &(_the_mutex)->Wait_queue ); \
+        _Thread_Executing->Wait.queue = &(_the_mutex)->Wait_queue; \
+        _Thread_Executing->Wait.id    = _id; \
+        _Thread_Disable_dispatch(); \
+        _ISR_Enable( _level ); \
+       _CORE_mutex_Seize_interrupt_blocking( _the_mutex, _timeout ); \
+      } \
+    } \
+  } while (0)
+
+/**
+ *  This method is used to obtain a core mutex.
+ *
+ *  @param[in] _the_mutex is the mutex to attempt to lock
+ *  @param[in] _id is the Id of the owning API level Semaphore object
+ *  @param[in] _wait is true if the thread is willing to wait
+ *  @param[in] _timeout is the maximum number of ticks to block
+ *  @param[in] _level is a temporary variable used to contain the ISR
+ *         disable level cookie
+ */
+#if defined(__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__)
+  void _CORE_mutex_Seize(
+    CORE_mutex_Control  *_the_mutex,
+    Objects_Id           _id,
+    bool                 _wait,
+    Watchdog_Interval    _timeout,
+    ISR_Level            _level
+  );
+#else
+  #define _CORE_mutex_Seize( _the_mutex, _id, _wait, _timeout, _level ) \
+     _CORE_mutex_Seize_body( _the_mutex, _id, _wait, _timeout, _level )
+#endif
+
+/**
+ *  @brief Frees a unit to the mutex.
+ *
+ *  This routine frees a unit to the mutex.  If a task was blocked waiting for
+ *  a unit from this mutex, then that task will be readied and the unit
+ *  given to that task.  Otherwise, the unit will be returned to the mutex.
+ *
+ *  @param[in] the_mutex is the mutex to surrender
+ *  @param[in] id is the id of the RTEMS Object associated with this mutex
+ *  @param[in] api_mutex_mp_support is the routine that will be called when
+ *         unblocking a remote mutex
+ *
+ *  @retval an indication of whether the routine succeeded or failed
+ */
+CORE_mutex_Status _CORE_mutex_Surrender(
+  CORE_mutex_Control                *the_mutex,
+  Objects_Id                         id,
+  CORE_mutex_API_mp_support_callout  api_mutex_mp_support
+);
+
+/**
+ *  @brief Flush all waiting threads.
+ *
+ *  This routine assists in the deletion of a mutex by flushing the associated
+ *  wait queue.
+ *
+ *  @param[in] the_mutex is the mutex to flush
+ *  @param[in] remote_extract_callout is the routine to invoke when a remote
+ *         thread is extracted
+ *  @param[in] status is the status value which each unblocked thread will
+ *         return to its caller.
+ */
+void _CORE_mutex_Flush(
+  CORE_mutex_Control         *the_mutex,
+  Thread_queue_Flush_callout  remote_extract_callout,
+  uint32_t                    status
+);
+
+/**
+ * @brief Is mutex locked.
+ *
+ * This routine returns true if the mutex specified is locked and false
+ * otherwise.
+ *
+ * @param[in] the_mutex is the mutex to check.
+ *
+ * @retval true The mutex is locked.
+ * @retval false The mutex is not locked.
+ */
+RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_locked(
+  CORE_mutex_Control  *the_mutex
+)
+{
+  return the_mutex->lock == CORE_MUTEX_LOCKED;
+}
+
+/**
+ * @brief Does core mutex use FIFO blocking.
+ *
+ * This routine returns true if the mutex's wait discipline is FIFO and false
+ * otherwise.
+ *
+ * @param[in] the_attribute is the attribute set of the mutex.
+ *
+ * @retval true The mutex is using FIFO blocking order.
+ * @retval false The mutex is not using FIFO blocking order.
+ */
+RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_fifo(
+  CORE_mutex_Attributes *the_attribute
+)
+{
+  return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_FIFO;
+}
+
+/**
+ * @brief Doex core mutex use priority blocking.
+ *
+ * This routine returns true if the mutex's wait discipline is PRIORITY and
+ * false otherwise.
+ *
+ * @param[in] the_attribute is the attribute set of the mutex.
+ *
+ * @retval true The mutex is using priority blocking order.
+ * @retval false The mutex is not using priority blocking order.
+ *
+ */
+RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_priority(
+  CORE_mutex_Attributes *the_attribute
+)
+{
+  return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY;
+}
+
+/**
+ * @brief Does mutex use priority inheritance.
+ *
+ * This routine returns true if the mutex's wait discipline is
+ * INHERIT_PRIORITY and false otherwise.
+ *
+ * @param[in] the_attribute is the attribute set of the mutex.
+ *
+ * @retval true The mutex is using priority inheritance.
+ * @retval false The mutex is not using priority inheritance.
+ */
+RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_inherit_priority(
+  CORE_mutex_Attributes *the_attribute
+)
+{
+  return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
+}
+
+/**
+ * @brief Does mutex use priority ceiling.
+ *
+ * This routine returns true if the mutex's wait discipline is
+ * PRIORITY_CEILING and false otherwise.
+ *
+ * @param[in] the_attribute is the attribute set of the mutex.
+ *
+ * @retval true The mutex is using priority ceiling.
+ * @retval false The mutex is not using priority ceiling.
+ */
+RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_priority_ceiling(
+  CORE_mutex_Attributes *the_attribute
+)
+{
+  return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING;
+}
+
+/*
+ *  Seize Mutex with Quick Success Path
+ *
+ *  NOTE: There is no MACRO version of this routine.  A body is in
+ *  coremutexseize.c that is duplicated from the .inl by hand.
+ *
+ *  NOTE: The Doxygen for this routine is in the .h file.
+ */
+
+RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
+  CORE_mutex_Control  *the_mutex,
+  ISR_Level            level
+)
+{
+  Thread_Control   *executing;
+
+  /* disabled when you get here */
+
+  executing = _Thread_Executing;
+  executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL;
+  if ( !_CORE_mutex_Is_locked( the_mutex ) ) {
+    the_mutex->lock       = CORE_MUTEX_LOCKED;
+    the_mutex->holder     = executing;
+    the_mutex->holder_id  = executing->Object.id;
+    the_mutex->nest_count = 1;
+    if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
+         _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ){
+
+#ifdef __RTEMS_STRICT_ORDER_MUTEX__
+       _Chain_Prepend_unprotected( &executing->lock_mutex,
+                                   &the_mutex->queue.lock_queue );
+       the_mutex->queue.priority_before = executing->current_priority;
+#endif
+
+      executing->resource_count++;
+    }
+
+    if ( !_CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
+      _ISR_Enable( level );
+      return 0;
+    } /* else must be CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING
+       *
+       * we possibly bump the priority of the current holder -- which
+       * happens to be _Thread_Executing.
+       */
+    {
+      Priority_Control  ceiling;
+      Priority_Control  current;
+
+      ceiling = the_mutex->Attributes.priority_ceiling;
+      current = executing->current_priority;
+      if ( current == ceiling ) {
+        _ISR_Enable( level );
+        return 0;
+      }
+
+      if ( current > ceiling ) {
+        _Thread_Disable_dispatch();
+        _ISR_Enable( level );
+        _Thread_Change_priority(
+          the_mutex->holder,
+          the_mutex->Attributes.priority_ceiling,
+         false
+        );
+        _Thread_Enable_dispatch();
+        return 0;
+      }
+      /* if ( current < ceiling ) */ {
+        executing->Wait.return_code = CORE_MUTEX_STATUS_CEILING_VIOLATED;
+        the_mutex->lock       = CORE_MUTEX_UNLOCKED;
+        the_mutex->nest_count = 0;     /* undo locking above */
+        executing->resource_count--;   /* undo locking above */
+        _ISR_Enable( level );
+        return 0;
+      }
+    }
+    return 0;
+  }
+
+  /*
+   *  At this point, we know the mutex was not available.  If this thread
+   *  is the thread that has locked the mutex, let's see if we are allowed
+   *  to nest access.
+   */
+  if ( _Thread_Is_executing( the_mutex->holder ) ) {
+    switch ( the_mutex->Attributes.lock_nesting_behavior ) {
+      case CORE_MUTEX_NESTING_ACQUIRES:
+        the_mutex->nest_count++;
+        _ISR_Enable( level );
+        return 0;
+      #if defined(RTEMS_POSIX_API)
+        case CORE_MUTEX_NESTING_IS_ERROR:
+          executing->Wait.return_code = CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED;
+          _ISR_Enable( level );
+          return 0;
+      #endif
+      case CORE_MUTEX_NESTING_BLOCKS:
+        break;
+    }
+  }
+
+  /*
+   *  The mutex is not available and the caller must deal with the possibility
+   *  of blocking.
+   */
+  return 1;
+}
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/coremutex.inl b/cpukit/score/inline/rtems/score/coremutex.inl
deleted file mode 100644
index 591cded..0000000
--- a/cpukit/score/inline/rtems/score/coremutex.inl
+++ /dev/null
@@ -1,235 +0,0 @@
-/**
- * @file
- *
- * @brief Inlined Routines Associated with the CORE Mutexes
- *
- * This include file contains all of the inlined routines associated
- * with the CORE mutexes.
- */
-
-/*
- *  COPYRIGHT (c) 1989-2009.
- *  On-Line Applications Research Corporation (OAR).
- *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.com/license/LICENSE.
- */
-
-#ifndef _RTEMS_SCORE_COREMUTEX_H
-# error "Never use <rtems/score/coremutex.inl> directly; include <rtems/score/coremutex.h> instead."
-#endif
-
-#ifndef _RTEMS_SCORE_COREMUTEX_INL
-#define _RTEMS_SCORE_COREMUTEX_INL
-
-#include <rtems/score/threaddispatch.h>
-
-/**
- * @addtogroup ScoreMutex
- */
-/**@{**/
-
-/**
- * @brief Is mutex locked.
- *
- * This routine returns true if the mutex specified is locked and false
- * otherwise.
- *
- * @param[in] the_mutex is the mutex to check.
- *
- * @retval true The mutex is locked.
- * @retval false The mutex is not locked.
- */
-RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_locked(
-  CORE_mutex_Control  *the_mutex
-)
-{
-  return the_mutex->lock == CORE_MUTEX_LOCKED;
-}
-
-/**
- * @brief Does core mutex use FIFO blocking.
- *
- * This routine returns true if the mutex's wait discipline is FIFO and false
- * otherwise.
- *
- * @param[in] the_attribute is the attribute set of the mutex.
- *
- * @retval true The mutex is using FIFO blocking order.
- * @retval false The mutex is not using FIFO blocking order.
- */
-RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_fifo(
-  CORE_mutex_Attributes *the_attribute
-)
-{
-  return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_FIFO;
-}
-
-/**
- * @brief Doex core mutex use priority blocking.
- *
- * This routine returns true if the mutex's wait discipline is PRIORITY and
- * false otherwise.
- *
- * @param[in] the_attribute is the attribute set of the mutex.
- *
- * @retval true The mutex is using priority blocking order.
- * @retval false The mutex is not using priority blocking order.
- *
- */
-RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_priority(
-  CORE_mutex_Attributes *the_attribute
-)
-{
-  return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY;
-}
-
-/**
- * @brief Does mutex use priority inheritance.
- *
- * This routine returns true if the mutex's wait discipline is
- * INHERIT_PRIORITY and false otherwise.
- *
- * @param[in] the_attribute is the attribute set of the mutex.
- *
- * @retval true The mutex is using priority inheritance.
- * @retval false The mutex is not using priority inheritance.
- */
-RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_inherit_priority(
-  CORE_mutex_Attributes *the_attribute
-)
-{
-  return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
-}
-
-/**
- * @brief Does mutex use priority ceiling.
- *
- * This routine returns true if the mutex's wait discipline is
- * PRIORITY_CEILING and false otherwise.
- *
- * @param[in] the_attribute is the attribute set of the mutex.
- *
- * @retval true The mutex is using priority ceiling.
- * @retval false The mutex is not using priority ceiling.
- */
-RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_priority_ceiling(
-  CORE_mutex_Attributes *the_attribute
-)
-{
-  return the_attribute->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING;
-}
-
-/*
- *  Seize Mutex with Quick Success Path
- *
- *  NOTE: There is no MACRO version of this routine.  A body is in
- *  coremutexseize.c that is duplicated from the .inl by hand.
- *
- *  NOTE: The Doxygen for this routine is in the .h file.
- */
-
-RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
-  CORE_mutex_Control  *the_mutex,
-  ISR_Level            level
-)
-{
-  Thread_Control   *executing;
-
-  /* disabled when you get here */
-
-  executing = _Thread_Executing;
-  executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL;
-  if ( !_CORE_mutex_Is_locked( the_mutex ) ) {
-    the_mutex->lock       = CORE_MUTEX_LOCKED;
-    the_mutex->holder     = executing;
-    the_mutex->holder_id  = executing->Object.id;
-    the_mutex->nest_count = 1;
-    if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
-         _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ){
-
-#ifdef __RTEMS_STRICT_ORDER_MUTEX__
-       _Chain_Prepend_unprotected( &executing->lock_mutex,
-                                   &the_mutex->queue.lock_queue );
-       the_mutex->queue.priority_before = executing->current_priority;
-#endif
-
-      executing->resource_count++;
-    }
-
-    if ( !_CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
-      _ISR_Enable( level );
-      return 0;
-    } /* else must be CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING
-       *
-       * we possibly bump the priority of the current holder -- which
-       * happens to be _Thread_Executing.
-       */
-    {
-      Priority_Control  ceiling;
-      Priority_Control  current;
-
-      ceiling = the_mutex->Attributes.priority_ceiling;
-      current = executing->current_priority;
-      if ( current == ceiling ) {
-        _ISR_Enable( level );
-        return 0;
-      }
-
-      if ( current > ceiling ) {
-        _Thread_Disable_dispatch();
-        _ISR_Enable( level );
-        _Thread_Change_priority(
-          the_mutex->holder,
-          the_mutex->Attributes.priority_ceiling,
-         false
-        );
-        _Thread_Enable_dispatch();
-        return 0;
-      }
-      /* if ( current < ceiling ) */ {
-        executing->Wait.return_code = CORE_MUTEX_STATUS_CEILING_VIOLATED;
-        the_mutex->lock       = CORE_MUTEX_UNLOCKED;
-        the_mutex->nest_count = 0;     /* undo locking above */
-        executing->resource_count--;   /* undo locking above */
-        _ISR_Enable( level );
-        return 0;
-      }
-    }
-    return 0;
-  }
-
-  /*
-   *  At this point, we know the mutex was not available.  If this thread
-   *  is the thread that has locked the mutex, let's see if we are allowed
-   *  to nest access.
-   */
-  if ( _Thread_Is_executing( the_mutex->holder ) ) {
-    switch ( the_mutex->Attributes.lock_nesting_behavior ) {
-      case CORE_MUTEX_NESTING_ACQUIRES:
-        the_mutex->nest_count++;
-        _ISR_Enable( level );
-        return 0;
-      #if defined(RTEMS_POSIX_API)
-        case CORE_MUTEX_NESTING_IS_ERROR:
-          executing->Wait.return_code = CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED;
-          _ISR_Enable( level );
-          return 0;
-      #endif
-      case CORE_MUTEX_NESTING_BLOCKS:
-        break;
-    }
-  }
-
-  /*
-   *  The mutex is not available and the caller must deal with the possibility
-   *  of blocking.
-   */
-  return 1;
-}
-
-/** @} */
-
-#endif
-/* end of include file */
diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am
index 130be84..5d880f1 100644
--- a/cpukit/score/preinstall.am
+++ b/cpukit/score/preinstall.am
@@ -79,6 +79,10 @@ $(PROJECT_INCLUDE)/rtems/score/coremutex.h: include/rtems/score/coremutex.h $(PR
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/coremutex.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/coremutex.h
 
+$(PROJECT_INCLUDE)/rtems/score/coremuteximpl.h: include/rtems/score/coremuteximpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/coremuteximpl.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/coremuteximpl.h
+
 $(PROJECT_INCLUDE)/rtems/score/coresem.h: include/rtems/score/coresem.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/coresem.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/coresem.h
@@ -279,10 +283,6 @@ $(PROJECT_INCLUDE)/rtems/score/coremsg.inl: inline/rtems/score/coremsg.inl $(PRO
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/coremsg.inl
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/coremsg.inl
 
-$(PROJECT_INCLUDE)/rtems/score/coremutex.inl: inline/rtems/score/coremutex.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/coremutex.inl
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/coremutex.inl
-
 $(PROJECT_INCLUDE)/rtems/score/coresem.inl: inline/rtems/score/coresem.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/coresem.inl
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/coresem.inl
diff --git a/cpukit/score/src/apimutexallocate.c b/cpukit/score/src/apimutexallocate.c
index eb92772..a736e2b 100644
--- a/cpukit/score/src/apimutexallocate.c
+++ b/cpukit/score/src/apimutexallocate.c
@@ -20,6 +20,7 @@
 
 #include <rtems/system.h>
 #include <rtems/score/apimutex.h>
+#include <rtems/score/coremuteximpl.h>
 
 void _API_Mutex_Allocate(
   API_Mutex_Control **the_mutex
diff --git a/cpukit/score/src/apimutexlock.c b/cpukit/score/src/apimutexlock.c
index 174c858..c5a2e42 100644
--- a/cpukit/score/src/apimutexlock.c
+++ b/cpukit/score/src/apimutexlock.c
@@ -21,6 +21,7 @@
 
 #include <rtems/system.h>
 #include <rtems/score/apimutex.h>
+#include <rtems/score/coremuteximpl.h>
 
 void _API_Mutex_Lock(
   API_Mutex_Control *the_mutex
diff --git a/cpukit/score/src/coremutex.c b/cpukit/score/src/coremutex.c
index 951bec6..a39b4ef 100644
--- a/cpukit/score/src/coremutex.c
+++ b/cpukit/score/src/coremutex.c
@@ -20,7 +20,7 @@
 
 #include <rtems/system.h>
 #include <rtems/score/isr.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/states.h>
 #include <rtems/score/thread.h>
 #include <rtems/score/threadq.h>
diff --git a/cpukit/score/src/coremutexflush.c b/cpukit/score/src/coremutexflush.c
index d05dd54..5aec9e5 100644
--- a/cpukit/score/src/coremutexflush.c
+++ b/cpukit/score/src/coremutexflush.c
@@ -20,7 +20,7 @@
 
 #include <rtems/system.h>
 #include <rtems/score/isr.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/states.h>
 #include <rtems/score/thread.h>
 #include <rtems/score/threadq.h>
diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c
index b6465b2..098d6f2 100644
--- a/cpukit/score/src/coremutexseize.c
+++ b/cpukit/score/src/coremutexseize.c
@@ -20,7 +20,7 @@
 
 #include <rtems/system.h>
 #include <rtems/score/isr.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/states.h>
 #include <rtems/score/thread.h>
 #include <rtems/score/threadq.h>
diff --git a/cpukit/score/src/coremutexseizeintr.c b/cpukit/score/src/coremutexseizeintr.c
index b3b7c96..f31d2fb 100644
--- a/cpukit/score/src/coremutexseizeintr.c
+++ b/cpukit/score/src/coremutexseizeintr.c
@@ -20,7 +20,7 @@
 
 #include <rtems/system.h>
 #include <rtems/score/isr.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/states.h>
 #include <rtems/score/thread.h>
 #include <rtems/score/threadq.h>
diff --git a/cpukit/score/src/coremutexsurrender.c b/cpukit/score/src/coremutexsurrender.c
index a30bbb7..12f84d3 100644
--- a/cpukit/score/src/coremutexsurrender.c
+++ b/cpukit/score/src/coremutexsurrender.c
@@ -20,7 +20,7 @@
 
 #include <rtems/system.h>
 #include <rtems/score/isr.h>
-#include <rtems/score/coremutex.h>
+#include <rtems/score/coremuteximpl.h>
 #include <rtems/score/states.h>
 #include <rtems/score/thread.h>
 #include <rtems/score/threadq.h>
-- 
1.7.7




More information about the devel mailing list