summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-04-22 21:29:21 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-04-23 08:55:43 +0200
commit9f10911d2b653859f7199eaed5a85a24803711dc (patch)
tree3dcee8b9f5ad179e8a82b852c7ad5837d30abbb0 /cpukit/score
parentscore: Fix priority message queue insert (diff)
downloadrtems-9f10911d2b653859f7199eaed5a85a24803711dc.tar.bz2
score: Delete Thread_queue_Control::state
Use a parameter for _Thread_queue_Enqueue() instead to reduce memory usage.
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/include/rtems/score/coresemimpl.h8
-rw-r--r--cpukit/score/include/rtems/score/threadq.h4
-rw-r--r--cpukit/score/include/rtems/score/threadqimpl.h4
-rw-r--r--cpukit/score/src/corebarrier.c2
-rw-r--r--cpukit/score/src/corebarrierwait.c8
-rw-r--r--cpukit/score/src/coremsg.c2
-rw-r--r--cpukit/score/src/coremsgseize.c8
-rw-r--r--cpukit/score/src/coremsgsubmit.c2
-rw-r--r--cpukit/score/src/coremutex.c1
-rw-r--r--cpukit/score/src/coremutexseize.c8
-rw-r--r--cpukit/score/src/corerwlock.c2
-rw-r--r--cpukit/score/src/corerwlockobtainread.c2
-rw-r--r--cpukit/score/src/corerwlockobtainwrite.c2
-rw-r--r--cpukit/score/src/coresem.c2
-rw-r--r--cpukit/score/src/coresemseize.c7
-rw-r--r--cpukit/score/src/mpci.c5
-rw-r--r--cpukit/score/src/threadq.c2
-rw-r--r--cpukit/score/src/threadqenqueue.c5
18 files changed, 46 insertions, 28 deletions
diff --git a/cpukit/score/include/rtems/score/coresemimpl.h b/cpukit/score/include/rtems/score/coresemimpl.h
index 99303d7aa3..6a3a212f34 100644
--- a/cpukit/score/include/rtems/score/coresemimpl.h
+++ b/cpukit/score/include/rtems/score/coresemimpl.h
@@ -22,6 +22,7 @@
#include <rtems/score/coresem.h>
#include <rtems/score/threaddispatch.h>
#include <rtems/score/threadqimpl.h>
+#include <rtems/score/statesimpl.h>
#ifdef __cplusplus
extern "C" {
@@ -238,7 +239,12 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Seize_isr_disable(
executing->Wait.id = id;
_ISR_lock_ISR_enable( lock_context );
- _Thread_queue_Enqueue( &the_semaphore->Wait_queue, executing, timeout );
+ _Thread_queue_Enqueue(
+ &the_semaphore->Wait_queue,
+ executing,
+ STATES_WAITING_FOR_SEMAPHORE,
+ timeout
+ );
_Thread_Enable_dispatch();
}
diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h
index 6dcdf41aaa..00b9221356 100644
--- a/cpukit/score/include/rtems/score/threadq.h
+++ b/cpukit/score/include/rtems/score/threadq.h
@@ -66,10 +66,6 @@ typedef struct {
Thread_blocking_operation_States sync_state;
/** This field indicates the thread queue's blocking discipline. */
Thread_queue_Disciplines discipline;
- /** This indicates the blocking state for threads waiting on this
- * thread queue.
- */
- States_Control state;
/** This is the status value returned to threads which timeout while
* waiting on this thread queue.
*/
diff --git a/cpukit/score/include/rtems/score/threadqimpl.h b/cpukit/score/include/rtems/score/threadqimpl.h
index 57bdf054b9..c1bd902f33 100644
--- a/cpukit/score/include/rtems/score/threadqimpl.h
+++ b/cpukit/score/include/rtems/score/threadqimpl.h
@@ -71,6 +71,7 @@ Thread_Control *_Thread_queue_Dequeue(
*
* @param[in] the_thread_queue pointer to threadq
* @param[in] the_thread the thread to enqueue
+ * @param[in] state is the new state of the thread
* @param[in] timeout interval to wait
*
* - INTERRUPT LATENCY:
@@ -79,6 +80,7 @@ Thread_Control *_Thread_queue_Dequeue(
void _Thread_queue_Enqueue(
Thread_queue_Control *the_thread_queue,
Thread_Control *the_thread,
+ States_Control state,
Watchdog_Interval timeout
);
@@ -170,13 +172,11 @@ void _Thread_queue_Flush(
*
* @param[in] the_thread_queue is the pointer to a threadq header
* @param[in] the_discipline is the queueing discipline
- * @param[in] state is the state of waiting threads
* @param[in] timeout_status is the return on a timeout
*/
void _Thread_queue_Initialize(
Thread_queue_Control *the_thread_queue,
Thread_queue_Disciplines the_discipline,
- States_Control state,
uint32_t timeout_status
);
diff --git a/cpukit/score/src/corebarrier.c b/cpukit/score/src/corebarrier.c
index fe2a2e9aad..2035961b92 100644
--- a/cpukit/score/src/corebarrier.c
+++ b/cpukit/score/src/corebarrier.c
@@ -19,7 +19,6 @@
#endif
#include <rtems/score/corebarrierimpl.h>
-#include <rtems/score/statesimpl.h>
#include <rtems/score/threadqimpl.h>
void _CORE_barrier_Initialize(
@@ -34,7 +33,6 @@ void _CORE_barrier_Initialize(
_Thread_queue_Initialize(
&the_barrier->Wait_queue,
THREAD_QUEUE_DISCIPLINE_FIFO,
- STATES_WAITING_FOR_BARRIER,
CORE_BARRIER_TIMEOUT
);
}
diff --git a/cpukit/score/src/corebarrierwait.c b/cpukit/score/src/corebarrierwait.c
index 3fedb31363..6267ae67c0 100644
--- a/cpukit/score/src/corebarrierwait.c
+++ b/cpukit/score/src/corebarrierwait.c
@@ -20,6 +20,7 @@
#include <rtems/score/corebarrierimpl.h>
#include <rtems/score/isrlevel.h>
+#include <rtems/score/statesimpl.h>
#include <rtems/score/threadqimpl.h>
void _CORE_barrier_Wait(
@@ -51,5 +52,10 @@ void _CORE_barrier_Wait(
executing->Wait.id = id;
_ISR_Enable( level );
- _Thread_queue_Enqueue( &the_barrier->Wait_queue, executing, timeout );
+ _Thread_queue_Enqueue(
+ &the_barrier->Wait_queue,
+ executing,
+ STATES_WAITING_FOR_BARRIER,
+ timeout
+ );
}
diff --git a/cpukit/score/src/coremsg.c b/cpukit/score/src/coremsg.c
index fc1ca451b1..0790221eb9 100644
--- a/cpukit/score/src/coremsg.c
+++ b/cpukit/score/src/coremsg.c
@@ -19,7 +19,6 @@
#endif
#include <rtems/score/coremsgimpl.h>
-#include <rtems/score/statesimpl.h>
#include <rtems/score/wkspace.h>
/*
@@ -113,7 +112,6 @@ bool _CORE_message_queue_Initialize(
&the_message_queue->Wait_queue,
_CORE_message_queue_Is_priority( the_message_queue_attributes ) ?
THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
- STATES_WAITING_FOR_MESSAGE,
CORE_MESSAGE_QUEUE_STATUS_TIMEOUT
);
diff --git a/cpukit/score/src/coremsgseize.c b/cpukit/score/src/coremsgseize.c
index e4a4270013..db8d558ca6 100644
--- a/cpukit/score/src/coremsgseize.c
+++ b/cpukit/score/src/coremsgseize.c
@@ -23,6 +23,7 @@
#include <rtems/score/isr.h>
#include <rtems/score/coremsgimpl.h>
#include <rtems/score/thread.h>
+#include <rtems/score/statesimpl.h>
#include <rtems/score/wkspace.h>
void _CORE_message_queue_Seize(
@@ -121,5 +122,10 @@ void _CORE_message_queue_Seize(
/* Wait.count will be filled in with the message priority */
_ISR_Enable( level );
- _Thread_queue_Enqueue( &the_message_queue->Wait_queue, executing, timeout );
+ _Thread_queue_Enqueue(
+ &the_message_queue->Wait_queue,
+ executing,
+ STATES_WAITING_FOR_MESSAGE,
+ timeout
+ );
}
diff --git a/cpukit/score/src/coremsgsubmit.c b/cpukit/score/src/coremsgsubmit.c
index 4ee41b83e2..4437856b17 100644
--- a/cpukit/score/src/coremsgsubmit.c
+++ b/cpukit/score/src/coremsgsubmit.c
@@ -22,6 +22,7 @@
#include <rtems/score/coremsgimpl.h>
#include <rtems/score/objectimpl.h>
#include <rtems/score/isr.h>
+#include <rtems/score/statesimpl.h>
#include <rtems/score/wkspace.h>
CORE_message_queue_Status _CORE_message_queue_Submit(
@@ -133,6 +134,7 @@ CORE_message_queue_Status _CORE_message_queue_Submit(
_Thread_queue_Enqueue(
&the_message_queue->Wait_queue,
executing,
+ STATES_WAITING_FOR_MESSAGE,
timeout
);
}
diff --git a/cpukit/score/src/coremutex.c b/cpukit/score/src/coremutex.c
index 949aa703ba..b5e8a5ed4b 100644
--- a/cpukit/score/src/coremutex.c
+++ b/cpukit/score/src/coremutex.c
@@ -84,7 +84,6 @@ CORE_mutex_Status _CORE_mutex_Initialize(
&the_mutex->Wait_queue,
_CORE_mutex_Is_fifo( the_mutex_attributes ) ?
THREAD_QUEUE_DISCIPLINE_FIFO : THREAD_QUEUE_DISCIPLINE_PRIORITY,
- STATES_WAITING_FOR_MUTEX,
CORE_MUTEX_TIMEOUT
);
diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c
index 2f9c8da523..d49b566471 100644
--- a/cpukit/score/src/coremutexseize.c
+++ b/cpukit/score/src/coremutexseize.c
@@ -22,6 +22,7 @@
#include <rtems/score/isr.h>
#include <rtems/score/coremuteximpl.h>
#include <rtems/score/schedulerimpl.h>
+#include <rtems/score/statesimpl.h>
#include <rtems/score/thread.h>
#if defined(__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__)
@@ -63,7 +64,12 @@ void _CORE_mutex_Seize_interrupt_blocking(
);
}
- _Thread_queue_Enqueue( &the_mutex->Wait_queue, executing, timeout );
+ _Thread_queue_Enqueue(
+ &the_mutex->Wait_queue,
+ executing,
+ STATES_WAITING_FOR_MUTEX,
+ timeout
+ );
_Thread_Enable_dispatch();
}
diff --git a/cpukit/score/src/corerwlock.c b/cpukit/score/src/corerwlock.c
index 0c66f52238..0d47db4b23 100644
--- a/cpukit/score/src/corerwlock.c
+++ b/cpukit/score/src/corerwlock.c
@@ -19,7 +19,6 @@
#endif
#include <rtems/score/corerwlockimpl.h>
-#include <rtems/score/statesimpl.h>
#include <rtems/score/threadqimpl.h>
void _CORE_RWLock_Initialize(
@@ -38,7 +37,6 @@ void _CORE_RWLock_Initialize(
_Thread_queue_Initialize(
&the_rwlock->Wait_queue,
THREAD_QUEUE_DISCIPLINE_FIFO,
- STATES_WAITING_FOR_RWLOCK,
CORE_RWLOCK_TIMEOUT
);
}
diff --git a/cpukit/score/src/corerwlockobtainread.c b/cpukit/score/src/corerwlockobtainread.c
index f3851b4fd3..203680f6dc 100644
--- a/cpukit/score/src/corerwlockobtainread.c
+++ b/cpukit/score/src/corerwlockobtainread.c
@@ -20,6 +20,7 @@
#include <rtems/score/corerwlockimpl.h>
#include <rtems/score/threadqimpl.h>
+#include <rtems/score/statesimpl.h>
#include <rtems/score/watchdog.h>
void _CORE_RWLock_Obtain_for_reading(
@@ -87,6 +88,7 @@ void _CORE_RWLock_Obtain_for_reading(
_Thread_queue_Enqueue(
&the_rwlock->Wait_queue,
executing,
+ STATES_WAITING_FOR_RWLOCK,
timeout
);
diff --git a/cpukit/score/src/corerwlockobtainwrite.c b/cpukit/score/src/corerwlockobtainwrite.c
index ea7d25c0e3..3499bcd4c8 100644
--- a/cpukit/score/src/corerwlockobtainwrite.c
+++ b/cpukit/score/src/corerwlockobtainwrite.c
@@ -20,6 +20,7 @@
#include <rtems/score/corerwlockimpl.h>
#include <rtems/score/threadqimpl.h>
+#include <rtems/score/statesimpl.h>
#include <rtems/score/watchdog.h>
void _CORE_RWLock_Obtain_for_writing(
@@ -77,6 +78,7 @@ void _CORE_RWLock_Obtain_for_writing(
_Thread_queue_Enqueue(
&the_rwlock->Wait_queue,
executing,
+ STATES_WAITING_FOR_RWLOCK,
timeout
);
diff --git a/cpukit/score/src/coresem.c b/cpukit/score/src/coresem.c
index 32b34583d0..eb1ba7e283 100644
--- a/cpukit/score/src/coresem.c
+++ b/cpukit/score/src/coresem.c
@@ -19,7 +19,6 @@
#endif
#include <rtems/score/coresemimpl.h>
-#include <rtems/score/statesimpl.h>
void _CORE_semaphore_Initialize(
CORE_semaphore_Control *the_semaphore,
@@ -35,7 +34,6 @@ void _CORE_semaphore_Initialize(
&the_semaphore->Wait_queue,
_CORE_semaphore_Is_priority( the_semaphore_attributes ) ?
THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
- STATES_WAITING_FOR_SEMAPHORE,
CORE_SEMAPHORE_TIMEOUT
);
}
diff --git a/cpukit/score/src/coresemseize.c b/cpukit/score/src/coresemseize.c
index d991af69d6..9c0db96204 100644
--- a/cpukit/score/src/coresemseize.c
+++ b/cpukit/score/src/coresemseize.c
@@ -63,6 +63,11 @@ void _CORE_semaphore_Seize(
executing->Wait.queue = &the_semaphore->Wait_queue;
executing->Wait.id = id;
_ISR_Enable( level );
- _Thread_queue_Enqueue( &the_semaphore->Wait_queue, executing, timeout );
+ _Thread_queue_Enqueue(
+ &the_semaphore->Wait_queue,
+ executing,
+ STATES_WAITING_FOR_SEMAPHORE,
+ timeout
+ );
}
#endif
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index a2acf89424..9b623b253f 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -83,7 +83,6 @@ void _MPCI_Handler_initialization(
_Thread_queue_Initialize(
&_MPCI_Remote_blocked_threads,
THREAD_QUEUE_DISCIPLINE_FIFO,
- STATES_WAITING_FOR_RPC_REPLY,
timeout_status
);
}
@@ -219,12 +218,10 @@ uint32_t _MPCI_Send_request_packet (
_Thread_queue_Enqueue(
&_MPCI_Remote_blocked_threads,
executing,
+ STATES_WAITING_FOR_RPC_REPLY | extra_state,
the_packet->timeout
);
- executing->current_state =
- _States_Set( extra_state, executing->current_state );
-
_Thread_Enable_dispatch();
return executing->Wait.return_code;
diff --git a/cpukit/score/src/threadq.c b/cpukit/score/src/threadq.c
index 1f416ba473..bdd380d188 100644
--- a/cpukit/score/src/threadq.c
+++ b/cpukit/score/src/threadq.c
@@ -47,11 +47,9 @@ RBTree_Compare_result _Thread_queue_Compare_priority(
void _Thread_queue_Initialize(
Thread_queue_Control *the_thread_queue,
Thread_queue_Disciplines the_discipline,
- States_Control state,
uint32_t timeout_status
)
{
- the_thread_queue->state = state;
the_thread_queue->discipline = the_discipline;
the_thread_queue->timeout_status = timeout_status;
the_thread_queue->sync_state = THREAD_BLOCKING_OPERATION_SYNCHRONIZED;
diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index 904855156b..5c237560f4 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -104,6 +104,7 @@ static void _Thread_queue_Requeue_priority(
void _Thread_queue_Enqueue(
Thread_queue_Control *the_thread_queue,
Thread_Control *the_thread,
+ States_Control state,
Watchdog_Interval timeout
)
{
@@ -112,13 +113,13 @@ void _Thread_queue_Enqueue(
#if defined(RTEMS_MULTIPROCESSING)
if ( _Thread_MP_Is_receive( the_thread ) && the_thread->receive_packet )
- the_thread = _Thread_MP_Allocate_proxy( the_thread_queue->state );
+ the_thread = _Thread_MP_Allocate_proxy( state );
else
#endif
/*
* Set the blocking state for this thread queue in the thread.
*/
- _Thread_Set_state( the_thread, the_thread_queue->state );
+ _Thread_Set_state( the_thread, state );
/*
* If the thread wants to timeout, then schedule its timer.