[PATCH 05/12] score: _Priority_bit_map_Handler_initialization()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Aug 13 13:42:50 UTC 2013


Delete _Priority_bit_map_Handler_initialization() and rely on BSS
initialization.  Move definition of _Priority_Major_bit_map and
_Priority_Bit_map to separate file.  Move definition of __log2table also
to this file.
---
 cpukit/sapi/src/exinit.c                           |    2 -
 cpukit/score/Makefile.am                           |    1 +
 .../score/include/rtems/score/prioritybitmapimpl.h |   35 +--------------
 cpukit/score/src/prioritybitmap.c                  |   48 ++++++++++++++++++++
 cpukit/score/src/schedulerpriority.c               |    6 ---
 5 files changed, 50 insertions(+), 42 deletions(-)
 create mode 100644 cpukit/score/src/prioritybitmap.c

diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c
index bfcfa7c..10c1559 100644
--- a/cpukit/sapi/src/exinit.c
+++ b/cpukit/sapi/src/exinit.c
@@ -45,7 +45,6 @@
 #include <rtems/score/interr.h>
 #include <rtems/score/isr.h>
 #include <rtems/score/priority.h>
-#include <rtems/score/prioritybitmapimpl.h>
 #include <rtems/score/schedulerimpl.h>
 #include <rtems/score/threadimpl.h>
 #include <rtems/score/todimpl.h>
@@ -128,7 +127,6 @@ void rtems_initialize_data_structures(void)
   _API_Mutex_Initialization( 1 );
   _API_Mutex_Allocate( &_RTEMS_Allocator_Mutex );
 
-  _Priority_bit_map_Handler_initialization();
   _Watchdog_Handler_initialization();
   _TOD_Handler_initialization();
 
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index a725ffc..c6954f6 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -178,6 +178,7 @@ libscore_a_SOURCES += src/objectallocate.c src/objectclose.c \
     src/objectactivecount.c
 
 ## SCHEDULER_C_FILES
+libscore_a_SOURCES += src/prioritybitmap.c
 libscore_a_SOURCES += src/scheduler.c
 libscore_a_SOURCES += src/schedulerdefaultallocatefree.c
 libscore_a_SOURCES += src/schedulerdefaultreleasejob.c
diff --git a/cpukit/score/include/rtems/score/prioritybitmapimpl.h b/cpukit/score/include/rtems/score/prioritybitmapimpl.h
index e2db034..27be57e 100644
--- a/cpukit/score/include/rtems/score/prioritybitmapimpl.h
+++ b/cpukit/score/include/rtems/score/prioritybitmapimpl.h
@@ -20,6 +20,7 @@
 #define _RTEMS_SCORE_PRIORITYBITMAPIMPL_H
 
 #include <rtems/score/prioritybitmap.h>
+#include <rtems/score/priority.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -57,28 +58,7 @@ extern Priority_bit_map_Control
  *  a highly optimized bit scan without the use of special CPU
  *  instructions.
  */
-#ifndef SCORE_INIT
 extern const unsigned char __log2table[256];
-#else
-const unsigned char __log2table[256] = {
-    7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
-    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-#endif
 
 #endif
 
@@ -218,19 +198,6 @@ RTEMS_INLINE_ROUTINE uint32_t   _Priority_Bits_index (
 extern Priority_bit_map_Control _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT;
 
 /**
- * This routine performs the initialization necessary for this handler.
- */
-
-RTEMS_INLINE_ROUTINE void _Priority_bit_map_Handler_initialization( void )
-{
-  int index;
-
-  _Priority_Major_bit_map = 0;
-  for ( index=0 ; index <16 ; index++ )
-     _Priority_Bit_map[ index ] = 0;
-}
-
-/**
  * This routine uses the_priority_map to update the priority
  * bit maps to indicate that a thread has been readied.
  */
diff --git a/cpukit/score/src/prioritybitmap.c b/cpukit/score/src/prioritybitmap.c
new file mode 100644
index 0000000..f0e79d8
--- /dev/null
+++ b/cpukit/score/src/prioritybitmap.c
@@ -0,0 +1,48 @@
+/*
+ * @file
+ *
+ * @brief Priority Bit Map Implementation
+ *
+ * @ingroup ScorePriorityBitmap
+ */
+
+/*
+ *  Copyright (C) 2010 Gedare Bloom.
+ *  Copyright (C) 2011 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.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/prioritybitmapimpl.h>
+
+Priority_bit_map_Control          _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT;
+
+/* Instantiate any global variables needed by the priority scheduler */
+volatile Priority_bit_map_Control _Priority_Major_bit_map;
+
+#if ( CPU_USE_GENERIC_BITFIELD_DATA == TRUE )
+const unsigned char __log2table[256] = {
+    7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
+    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+#endif
diff --git a/cpukit/score/src/schedulerpriority.c b/cpukit/score/src/schedulerpriority.c
index ab17063..e36a44b 100644
--- a/cpukit/score/src/schedulerpriority.c
+++ b/cpukit/score/src/schedulerpriority.c
@@ -21,11 +21,6 @@
 #include <rtems/score/schedulerpriorityimpl.h>
 #include <rtems/score/wkspace.h>
 
-/* Instantiate any global variables needed by the priority scheduler */
-volatile Priority_bit_map_Control _Priority_Major_bit_map;
-
-Priority_bit_map_Control          _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT;
-
 void _Scheduler_priority_Initialize(void)
 {
   /* allocate ready queue structures */
@@ -34,7 +29,6 @@ void _Scheduler_priority_Initialize(void)
   );
 
   _Scheduler_priority_Ready_queue_initialize( ready_queues );
-  _Priority_bit_map_Handler_initialization();
 
   _Scheduler.information = ready_queues;
 }
-- 
1.7.7




More information about the devel mailing list