change log for rtems (2011-09-01)
rtems-vc at rtems.org
rtems-vc at rtems.org
Thu Sep 1 19:12:19 UTC 2011
*joel*:
2011-09-01 Petr Benes <benesp16 at fel.cvut.cz>
PR 1895/cpukit
* rtems/src/ratemoncancel.c, rtems/src/ratemondelete.c,
rtems/src/ratemonperiod.c, sapi/include/confdefs.h,
score/Makefile.am, score/include/rtems/score/scheduler.h,
score/include/rtems/score/schedulerpriority.h,
score/include/rtems/score/schedulersimple.h,
score/include/rtems/score/schedulersimplesmp.h,
score/inline/rtems/score/scheduler.inl,
score/inline/rtems/score/schedulerpriority.inl,
score/src/coremutexseize.c: Add priority_compare and release_job
hooks interfaces to scheduler interface.
* score/src/schedulerpriorityprioritycompare.c,
score/src/schedulerpriorityreleasejob.c: New files.
M 1.2911 cpukit/ChangeLog
M 1.12 cpukit/rtems/src/ratemoncancel.c
M 1.11 cpukit/rtems/src/ratemondelete.c
M 1.31 cpukit/rtems/src/ratemonperiod.c
M 1.170 cpukit/sapi/include/confdefs.h
M 1.108 cpukit/score/Makefile.am
M 1.8 cpukit/score/include/rtems/score/scheduler.h
M 1.11 cpukit/score/include/rtems/score/schedulerpriority.h
M 1.5 cpukit/score/include/rtems/score/schedulersimple.h
M 1.5 cpukit/score/include/rtems/score/schedulersimplesmp.h
M 1.6 cpukit/score/inline/rtems/score/scheduler.inl
M 1.7 cpukit/score/inline/rtems/score/schedulerpriority.inl
M 1.19 cpukit/score/src/coremutexseize.c
A 1.1 cpukit/score/src/schedulerpriorityprioritycompare.c
A 1.1 cpukit/score/src/schedulerpriorityreleasejob.c
diff -u rtems/cpukit/ChangeLog:1.2910 rtems/cpukit/ChangeLog:1.2911
--- rtems/cpukit/ChangeLog:1.2910 Mon Aug 29 16:31:17 2011
+++ rtems/cpukit/ChangeLog Thu Sep 1 13:13:53 2011
@@ -1,3 +1,19 @@
+2011-09-01 Petr Benes <benesp16 at fel.cvut.cz>
+
+ PR 1895/cpukit
+ * rtems/src/ratemoncancel.c, rtems/src/ratemondelete.c,
+ rtems/src/ratemonperiod.c, sapi/include/confdefs.h,
+ score/Makefile.am, score/include/rtems/score/scheduler.h,
+ score/include/rtems/score/schedulerpriority.h,
+ score/include/rtems/score/schedulersimple.h,
+ score/include/rtems/score/schedulersimplesmp.h,
+ score/inline/rtems/score/scheduler.inl,
+ score/inline/rtems/score/schedulerpriority.inl,
+ score/src/coremutexseize.c: Add priority_compare and release_job
+ hooks interfaces to scheduler interface.
+ * score/src/schedulerpriorityprioritycompare.c,
+ score/src/schedulerpriorityreleasejob.c: New files.
+
2011-08-29 Joel Sherrill <joel.sherrilL at OARcorp.com>
* rtems/include/rtems/rtems/tasks.h: Formatting.
diff -u rtems/cpukit/rtems/src/ratemoncancel.c:1.11 rtems/cpukit/rtems/src/ratemoncancel.c:1.12
--- rtems/cpukit/rtems/src/ratemoncancel.c:1.11 Sun Jul 24 18:55:10 2011
+++ rtems/cpukit/rtems/src/ratemoncancel.c Thu Sep 1 13:13:53 2011
@@ -53,6 +53,7 @@
}
(void) _Watchdog_Remove( &the_period->Timer );
the_period->state = RATE_MONOTONIC_INACTIVE;
+ _Scheduler_Release_job(the_period->owner, 0);
_Thread_Enable_dispatch();
return RTEMS_SUCCESSFUL;
diff -u rtems/cpukit/rtems/src/ratemondelete.c:1.10 rtems/cpukit/rtems/src/ratemondelete.c:1.11
--- rtems/cpukit/rtems/src/ratemondelete.c:1.10 Sun Jul 24 18:55:10 2011
+++ rtems/cpukit/rtems/src/ratemondelete.c Thu Sep 1 13:13:54 2011
@@ -51,6 +51,7 @@
(void) _Watchdog_Remove( &the_period->Timer );
the_period->state = RATE_MONOTONIC_INACTIVE;
_Rate_monotonic_Free( the_period );
+ _Scheduler_Release_job(the_period->owner, 0);
_Thread_Enable_dispatch();
return RTEMS_SUCCESSFUL;
diff -u rtems/cpukit/rtems/src/ratemonperiod.c:1.30 rtems/cpukit/rtems/src/ratemonperiod.c:1.31
--- rtems/cpukit/rtems/src/ratemonperiod.c:1.30 Sun Jul 24 18:55:10 2011
+++ rtems/cpukit/rtems/src/ratemonperiod.c Thu Sep 1 13:13:54 2011
@@ -143,6 +143,8 @@
_Timespec_Add_to( &the_period->cpu_usage_period_initiated, &ran );
}
#endif
+
+ _Scheduler_Release_job(the_period->owner, the_period->next_length);
}
void _Rate_monotonic_Update_statistics(
@@ -282,6 +284,8 @@
if ( the_period->state == RATE_MONOTONIC_INACTIVE ) {
_ISR_Enable( level );
+ the_period->next_length = length;
+
/*
* Baseline statistics information for the beginning of a period.
*/
@@ -295,8 +299,6 @@
NULL
);
- the_period->next_length = length;
-
_Watchdog_Insert_ticks( &the_period->Timer, length );
_Thread_Enable_dispatch();
return RTEMS_SUCCESSFUL;
@@ -353,6 +355,7 @@
the_period->next_length = length;
_Watchdog_Insert_ticks( &the_period->Timer, length );
+ _Scheduler_Release_job(the_period->owner, the_period->next_length);
_Thread_Enable_dispatch();
return RTEMS_TIMEOUT;
}
diff -u rtems/cpukit/sapi/include/confdefs.h:1.169 rtems/cpukit/sapi/include/confdefs.h:1.170
--- rtems/cpukit/sapi/include/confdefs.h:1.169 Wed Aug 17 04:14:09 2011
+++ rtems/cpukit/sapi/include/confdefs.h Thu Sep 1 13:13:54 2011
@@ -661,6 +661,9 @@
#if defined(CONFIGURE_SCHEDULER_USER)
#define CONFIGURE_SCHEDULER_ENTRY_POINTS \
CONFIGURE_SCHEDULER_USER_ENTRY_POINTS
+
+ #define CONFIGURE_SCHEDULER_MEMORY_FOR_SCHEDULER \
+ CONFIGURE_SCHEDULER_USER_MEMORY_FOR_SCHEDULER
#endif
/*
diff -u rtems/cpukit/score/Makefile.am:1.107 rtems/cpukit/score/Makefile.am:1.108
--- rtems/cpukit/score/Makefile.am:1.107 Mon Aug 22 13:26:07 2011
+++ rtems/cpukit/score/Makefile.am Thu Sep 1 13:13:54 2011
@@ -203,6 +203,8 @@
src/schedulerpriorityenqueuefirst.c \
src/schedulerpriorityextract.c \
src/schedulerpriorityfree.c \
+ src/schedulerpriorityprioritycompare.c \
+ src/schedulerpriorityreleasejob.c \
src/schedulerpriorityschedule.c \
src/schedulerpriorityunblock.c \
src/schedulerpriorityupdate.c \
diff -u rtems/cpukit/score/include/rtems/score/scheduler.h:1.7 rtems/cpukit/score/include/rtems/score/scheduler.h:1.8
--- rtems/cpukit/score/include/rtems/score/scheduler.h:1.7 Fri Jun 17 10:40:09 2011
+++ rtems/cpukit/score/include/rtems/score/scheduler.h Thu Sep 1 13:13:54 2011
@@ -77,8 +77,18 @@
/** extract a thread from the ready set */
void ( *extract )(Thread_Control *);
+ /**
+ * Compares two priorities (returns >0 for higher priority, 0 for equal
+ * and <0 for lower priority).
+ */
+ int ( *priority_compare )(Priority_Control, Priority_Control);
+
+ /** This routine is called upon release of a new job. */
+ void ( *release_job ) (Thread_Control *, uint32_t);
+
/** perform scheduler update actions required at each clock tick */
void ( *tick )(void);
+
} Scheduler_Operations;
/**
@@ -107,6 +117,20 @@
extern Scheduler_Control _Scheduler;
/**
+ * Macro testing whether @a p1 has lower priority than @a p2
+ * in the intuitive sense of priority.
+ */
+#define _Scheduler_Is_priority_lower_than( _p1, _p2 ) \
+ (_Scheduler_Priority_compare(_p1,_p2) < 0)
+
+/**
+ * Macro testing whether @a p1 has higher priority than @a p2
+ * in the intuitive sense of priority.
+ */
+#define _Scheduler_Is_priority_higher_than( _p1, _p2 ) \
+ (_Scheduler_Priority_compare(_p1,_p2) > 0)
+
+/**
* This routine initializes the scheduler to the policy chosen by the user
* through confdefs, or to the priority scheduler with ready chains by
* default.
diff -u rtems/cpukit/score/include/rtems/score/schedulerpriority.h:1.10 rtems/cpukit/score/include/rtems/score/schedulerpriority.h:1.11
--- rtems/cpukit/score/include/rtems/score/schedulerpriority.h:1.10 Fri Jun 17 09:31:45 2011
+++ rtems/cpukit/score/include/rtems/score/schedulerpriority.h Thu Sep 1 13:13:54 2011
@@ -38,18 +38,20 @@
*/
#define SCHEDULER_PRIORITY_ENTRY_POINTS \
{ \
- _Scheduler_priority_Initialize, /* initialize entry point */ \
- _Scheduler_priority_Schedule, /* schedule entry point */ \
- _Scheduler_priority_Yield, /* yield entry point */ \
- _Scheduler_priority_Block, /* block entry point */ \
- _Scheduler_priority_Unblock, /* unblock entry point */ \
- _Scheduler_priority_Allocate, /* allocate entry point */ \
- _Scheduler_priority_Free, /* free entry point */ \
- _Scheduler_priority_Update, /* update entry point */ \
- _Scheduler_priority_Enqueue, /* enqueue entry point */ \
- _Scheduler_priority_Enqueue_first, /* enqueue_first entry point */ \
- _Scheduler_priority_Extract, /* extract entry point */ \
- _Scheduler_priority_Tick /* tick entry point */ \
+ _Scheduler_priority_Initialize, /* initialize entry point */ \
+ _Scheduler_priority_Schedule, /* schedule entry point */ \
+ _Scheduler_priority_Yield, /* yield entry point */ \
+ _Scheduler_priority_Block, /* block entry point */ \
+ _Scheduler_priority_Unblock, /* unblock entry point */ \
+ _Scheduler_priority_Allocate, /* allocate entry point */ \
+ _Scheduler_priority_Free, /* free entry point */ \
+ _Scheduler_priority_Update, /* update entry point */ \
+ _Scheduler_priority_Enqueue, /* enqueue entry point */ \
+ _Scheduler_priority_Enqueue_first, /* enqueue_first entry point */ \
+ _Scheduler_priority_Extract, /* extract entry point */ \
+ _Scheduler_priority_Priority_compare, /* compares two priorities */ \
+ _Scheduler_priority_Release_job, /* new period of task */ \
+ _Scheduler_priority_Tick /* tick entry point */ \
}
/**
@@ -172,6 +174,30 @@
);
/**
+ * @brief Scheduler priority Priority compare
+ *
+ * This routine compares two priorities.
+ */
+int _Scheduler_priority_Priority_compare(
+ Priority_Control p1,
+ Priority_Control p2
+);
+
+/**
+ * @brief Scheduler priority Release job
+ *
+ * This routine is called when a new job of task is released.
+ *
+ * @param[in] the_thread is the owner of the job.
+ * @param[in] deadline of the new job from now. If equal to 0,
+ * the job was cancelled or deleted.
+ */
+void _Scheduler_priority_Release_job (
+ Thread_Control *the_thread,
+ uint32_t deadline
+);
+
+/**
* @brief Deterministic Priority Scheduler Tick Method
*
* This routine is invoked as part of processing each clock tick.
diff -u rtems/cpukit/score/include/rtems/score/schedulersimple.h:1.4 rtems/cpukit/score/include/rtems/score/schedulersimple.h:1.5
--- rtems/cpukit/score/include/rtems/score/schedulersimple.h:1.4 Fri Jun 17 09:31:45 2011
+++ rtems/cpukit/score/include/rtems/score/schedulersimple.h Thu Sep 1 13:13:54 2011
@@ -35,18 +35,20 @@
*/
#define SCHEDULER_SIMPLE_ENTRY_POINTS \
{ \
- _Scheduler_simple_Initialize, /* initialize entry point */ \
- _Scheduler_simple_Schedule, /* schedule entry point */ \
- _Scheduler_simple_Yield, /* yield entry point */ \
- _Scheduler_simple_Block, /* block entry point */ \
- _Scheduler_simple_Unblock, /* unblock entry point */ \
- _Scheduler_simple_Allocate, /* allocate entry point */ \
- _Scheduler_simple_Free, /* free entry point */ \
- _Scheduler_simple_Update, /* update entry point */ \
- _Scheduler_simple_Enqueue, /* enqueue entry point */ \
- _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \
- _Scheduler_simple_Extract, /* extract entry point */ \
- _Scheduler_priority_Tick /* tick entry point */ \
+ _Scheduler_simple_Initialize, /* initialize entry point */ \
+ _Scheduler_simple_Schedule, /* schedule entry point */ \
+ _Scheduler_simple_Yield, /* yield entry point */ \
+ _Scheduler_simple_Block, /* block entry point */ \
+ _Scheduler_simple_Unblock, /* unblock entry point */ \
+ _Scheduler_simple_Allocate, /* allocate entry point */ \
+ _Scheduler_simple_Free, /* free entry point */ \
+ _Scheduler_simple_Update, /* update entry point */ \
+ _Scheduler_simple_Enqueue, /* enqueue entry point */ \
+ _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \
+ _Scheduler_simple_Extract, /* extract entry point */ \
+ _Scheduler_priority_Priority_compare, /* compares two priorities */ \
+ _Scheduler_priority_Release_job, /* new period of task */ \
+ _Scheduler_priority_Tick /* tick entry point */ \
}
/**
diff -u rtems/cpukit/score/include/rtems/score/schedulersimplesmp.h:1.4 rtems/cpukit/score/include/rtems/score/schedulersimplesmp.h:1.5
--- rtems/cpukit/score/include/rtems/score/schedulersimplesmp.h:1.4 Tue Jun 28 15:31:36 2011
+++ rtems/cpukit/score/include/rtems/score/schedulersimplesmp.h Thu Sep 1 13:13:54 2011
@@ -40,24 +40,27 @@
#include <rtems/score/scheduler.h>
#include <rtems/score/schedulersimple.h>
+#include <rtems/score/schedulerpriority.h>
/**
* Entry points for Scheduler Simple SMP
*/
#define SCHEDULER_SIMPLE_SMP_ENTRY_POINTS \
{ \
- _Scheduler_simple_Initialize, /* initialize entry point */ \
- _Scheduler_simple_smp_Schedule, /* schedule entry point */ \
- _Scheduler_simple_Yield, /* yield entry point */ \
- _Scheduler_simple_smp_Block, /* block entry point */ \
- _Scheduler_simple_smp_Unblock, /* unblock entry point */ \
- _Scheduler_simple_Allocate, /* allocate entry point */ \
- _Scheduler_simple_Free, /* free entry point */ \
- _Scheduler_simple_Update, /* update entry point */ \
- _Scheduler_simple_Enqueue, /* enqueue entry point */ \
- _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \
- _Scheduler_simple_Extract, /* extract entry point */ \
- _Scheduler_simple_smp_Tick /* tick entry point */ \
+ _Scheduler_simple_Initialize, /* initialize entry point */ \
+ _Scheduler_simple_smp_Schedule, /* schedule entry point */ \
+ _Scheduler_simple_Yield, /* yield entry point */ \
+ _Scheduler_simple_smp_Block, /* block entry point */ \
+ _Scheduler_simple_smp_Unblock, /* unblock entry point */ \
+ _Scheduler_simple_Allocate, /* allocate entry point */ \
+ _Scheduler_simple_Free, /* free entry point */ \
+ _Scheduler_simple_Update, /* update entry point */ \
+ _Scheduler_simple_Enqueue, /* enqueue entry point */ \
+ _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \
+ _Scheduler_simple_Extract, /* extract entry point */ \
+ _Scheduler_priority_Priority_compare, /* compares two priorities */ \
+ _Scheduler_priority_Release_job, /* new period of task */ \
+ _Scheduler_simple_smp_Tick /* tick entry point */ \
}
/**
diff -u rtems/cpukit/score/inline/rtems/score/scheduler.inl:1.5 rtems/cpukit/score/inline/rtems/score/scheduler.inl:1.6
--- rtems/cpukit/score/inline/rtems/score/scheduler.inl:1.5 Fri Jun 17 09:31:46 2011
+++ rtems/cpukit/score/inline/rtems/score/scheduler.inl Thu Sep 1 13:13:54 2011
@@ -159,6 +159,32 @@
_Scheduler.Operations.extract( the_thread );
}
+/**
+ * @brief Scheduler Priority compare
+ *
+ * This routine compares two priorities.
+ */
+RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
+ Priority_Control p1,
+ Priority_Control p2
+)
+{
+ return _Scheduler.Operations.priority_compare(p1, p2);
+}
+
+/**
+ * @brief Scheduler Release job
+ *
+ * This routine is called when a new period of task is issued.
+ */
+RTEMS_INLINE_ROUTINE void _Scheduler_Release_job(
+ Thread_Control *the_thread,
+ uint32_t length
+)
+{
+ _Scheduler.Operations.release_job(the_thread, length);
+}
+
/** @brief Scheduler Method Invoked at Each Clock Tick
*
* This method is invoked at each clock tick to allow the scheduler
diff -u rtems/cpukit/score/inline/rtems/score/schedulerpriority.inl:1.6 rtems/cpukit/score/inline/rtems/score/schedulerpriority.inl:1.7
--- rtems/cpukit/score/inline/rtems/score/schedulerpriority.inl:1.6 Mon Apr 18 17:01:47 2011
+++ rtems/cpukit/score/inline/rtems/score/schedulerpriority.inl Thu Sep 1 13:13:54 2011
@@ -185,6 +185,23 @@
);
}
+/**
+ * @brief Scheduler priority Priority compare body
+ *
+ * This routine implements priority comparison for priority-based
+ * scheduling.
+ *
+ * @return >0 for higher priority, 0 for equal and <0 for lower priority.
+ */
+RTEMS_INLINE_ROUTINE int _Scheduler_priority_Priority_compare_body(
+ Priority_Control p1,
+ Priority_Control p2
+)
+{
+ /* High priority in priority scheduler is represented by low numbers. */
+ return ( p2 - p1 );
+}
+
/**@}*/
#endif
diff -u rtems/cpukit/score/src/coremutexseize.c:1.18 rtems/cpukit/score/src/coremutexseize.c:1.19
--- rtems/cpukit/score/src/coremutexseize.c:1.18 Sun Jul 24 18:55:13 2011
+++ rtems/cpukit/score/src/coremutexseize.c Thu Sep 1 13:13:54 2011
@@ -60,7 +60,9 @@
executing = _Thread_Executing;
if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) {
- if ( the_mutex->holder->current_priority > executing->current_priority ) {
+ if ( _Scheduler_Is_priority_higher_than(
+ executing->current_priority,
+ the_mutex->holder->current_priority)) {
_Thread_Change_priority(
the_mutex->holder,
executing->current_priority,
diff -u /dev/null rtems/cpukit/score/src/schedulerpriorityprioritycompare.c:1.1
--- /dev/null Thu Sep 1 14:12:17 2011
+++ rtems/cpukit/score/src/schedulerpriorityprioritycompare.c Thu Sep 1 13:13:54 2011
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/config.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/schedulerpriority.h>
+
+int _Scheduler_priority_Priority_compare(
+ Priority_Control p1,
+ Priority_Control p2
+)
+{
+ return _Scheduler_priority_Priority_compare_body( p1, p2 );
+}
diff -u /dev/null rtems/cpukit/score/src/schedulerpriorityreleasejob.c:1.1
--- /dev/null Thu Sep 1 14:12:17 2011
+++ rtems/cpukit/score/src/schedulerpriorityreleasejob.c Thu Sep 1 13:13:54 2011
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2011 Petr Benes.
+ * 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.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/config.h>
+#include <rtems/score/scheduler.h>
+#include <rtems/score/schedulerpriority.h>
+
+void _Scheduler_priority_Release_job(
+ Thread_Control *the_thread,
+ uint32_t deadline
+)
+{
+ return;
+}
*joel*:
2011-09-01 Joel Sherrill <joel.sherrilL at OARcorp.com>
PR 1895/cpukit
* score/src/coretodmsecstoticks.c, score/src/coretodusectoticks.c,
score/src/timespectoticks.c: Ensure time conversions to ticks do not
ignore partial tick and return 1 less than desired.
M 1.2912 cpukit/ChangeLog
M 1.2 cpukit/score/src/coretodmsecstoticks.c
M 1.2 cpukit/score/src/coretodusectoticks.c
M 1.4 cpukit/score/src/timespectoticks.c
diff -u rtems/cpukit/ChangeLog:1.2911 rtems/cpukit/ChangeLog:1.2912
--- rtems/cpukit/ChangeLog:1.2911 Thu Sep 1 13:13:53 2011
+++ rtems/cpukit/ChangeLog Thu Sep 1 13:24:46 2011
@@ -1,3 +1,10 @@
+2011-09-01 Joel Sherrill <joel.sherrilL at OARcorp.com>
+
+ PR 1895/cpukit
+ * score/src/coretodmsecstoticks.c, score/src/coretodusectoticks.c,
+ score/src/timespectoticks.c: Ensure time conversions to ticks do not
+ ignore partial tick and return 1 less than desired.
+
2011-09-01 Petr Benes <benesp16 at fel.cvut.cz>
PR 1895/cpukit
diff -u rtems/cpukit/score/src/coretodmsecstoticks.c:1.1 rtems/cpukit/score/src/coretodmsecstoticks.c:1.2
--- rtems/cpukit/score/src/coretodmsecstoticks.c:1.1 Tue Dec 16 14:53:33 2008
+++ rtems/cpukit/score/src/coretodmsecstoticks.c Thu Sep 1 13:24:47 2011
@@ -1,4 +1,4 @@
-/* COPYRIGHT (c) 1989-2008.
+/* COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -21,5 +21,18 @@
uint32_t milliseconds
)
{
- return (milliseconds / rtems_configuration_get_milliseconds_per_tick());
+ uint32_t ticks;
+ uint32_t milliseconds_per_tick;
+
+ /**
+ * We should ensure the ticks not be truncated by integer division. We
+ * need to have it be greater than or equal to the requested time. It
+ * should not be shorter.
+ */
+ milliseconds_per_tick = rtems_configuration_get_milliseconds_per_tick();
+ ticks = milliseconds / milliseconds_per_tick;
+ if ( (milliseconds % milliseconds_per_tick) != 0 )
+ ticks += 1;
+
+ return ticks;
}
diff -u rtems/cpukit/score/src/coretodusectoticks.c:1.1 rtems/cpukit/score/src/coretodusectoticks.c:1.2
--- rtems/cpukit/score/src/coretodusectoticks.c:1.1 Tue Dec 16 14:53:34 2008
+++ rtems/cpukit/score/src/coretodusectoticks.c Thu Sep 1 13:24:47 2011
@@ -1,4 +1,4 @@
-/* COPYRIGHT (c) 1989-2008.
+/* COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -21,5 +21,18 @@
uint32_t microseconds
)
{
- return (microseconds / rtems_configuration_get_microseconds_per_tick());
+ uint32_t ticks;
+ uint32_t microseconds_per_tick;
+
+ /**
+ * We should ensure the ticks not be truncated by integer division. We
+ * need to have it be greater than or equal to the requested time. It
+ * should not be shorter.
+ */
+ microseconds_per_tick = rtems_configuration_get_microseconds_per_tick();
+ ticks = microseconds / microseconds_per_tick;
+ if ( (microseconds % microseconds_per_tick) != 0 )
+ ticks += 1;
+
+ return ticks;
}
diff -u rtems/cpukit/score/src/timespectoticks.c:1.3 rtems/cpukit/score/src/timespectoticks.c:1.4
--- rtems/cpukit/score/src/timespectoticks.c:1.3 Sun Nov 29 07:51:52 2009
+++ rtems/cpukit/score/src/timespectoticks.c Thu Sep 1 13:24:47 2011
@@ -35,16 +35,22 @@
)
{
uint32_t ticks;
+ uint32_t nanoseconds_per_tick;
if ( (time->tv_sec == 0) && (time->tv_nsec == 0) )
return 0;
- ticks = time->tv_sec * TOD_TICKS_PER_SECOND;
+ /**
+ * We should ensure the ticks not be truncated by integer division. We
+ * need to have it be greater than or equal to the requested time. It
+ * should not be shorter.
+ */
+ ticks = time->tv_sec * TOD_TICKS_PER_SECOND;
+ nanoseconds_per_tick = rtems_configuration_get_nanoseconds_per_tick();
+ ticks += time->tv_nsec / nanoseconds_per_tick;
- ticks += time->tv_nsec / rtems_configuration_get_nanoseconds_per_tick();
+ if ( (time->tv_nsec % nanoseconds_per_tick) != 0 )
+ ticks += 1;
- if (ticks)
- return ticks;
-
- return 1;
+ return ticks;
}
*joel* (on branch rtems-4-10-branch):
2011-09-01 Joel Sherrill <joel.sherrilL at OARcorp.com>
PR 1895/cpukit
* posix/src/mqueuerecvsupp.c, posix/src/pthreadjoin.c,
score/src/coretodmsecstoticks.c, score/src/coretodusectoticks.c,
score/src/timespectoticks.c: Ensure time conversions to ticks do not
ignore partial tick and return 1 less than desired.
M 1.2346.2.102 cpukit/ChangeLog
M 1.18.2.1 cpukit/posix/src/mqueuerecvsupp.c
M 1.8.4.4 cpukit/posix/src/pthreadjoin.c
M 1.1.2.1 cpukit/score/src/coretodmsecstoticks.c
M 1.1.2.1 cpukit/score/src/coretodusectoticks.c
M 1.3.2.1 cpukit/score/src/timespectoticks.c
diff -u rtems/cpukit/ChangeLog:1.2346.2.101 rtems/cpukit/ChangeLog:1.2346.2.102
--- rtems/cpukit/ChangeLog:1.2346.2.101 Sun Jul 31 17:40:41 2011
+++ rtems/cpukit/ChangeLog Thu Sep 1 13:24:54 2011
@@ -1,3 +1,11 @@
+2011-09-01 Joel Sherrill <joel.sherrilL at OARcorp.com>
+
+ PR 1895/cpukit
+ * posix/src/mqueuerecvsupp.c, posix/src/pthreadjoin.c,
+ score/src/coretodmsecstoticks.c, score/src/coretodusectoticks.c,
+ score/src/timespectoticks.c: Ensure time conversions to ticks do not
+ ignore partial tick and return 1 less than desired.
+
2011-07-31 Joel Sherrill <joel.sherrilL at OARcorp.com>
PR 1855/cpukit
diff -u rtems/cpukit/posix/src/mqueuerecvsupp.c:1.18 rtems/cpukit/posix/src/mqueuerecvsupp.c:1.18.2.1
--- rtems/cpukit/posix/src/mqueuerecvsupp.c:1.18 Tue Feb 3 04:10:48 2009
+++ rtems/cpukit/posix/src/mqueuerecvsupp.c Thu Sep 1 13:24:57 2011
@@ -11,7 +11,7 @@
* This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open
* time.
*
- * COPYRIGHT (c) 1989-2008.
+ * COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -105,8 +105,11 @@
);
_Thread_Enable_dispatch();
- *msg_prio =
- _POSIX_Message_queue_Priority_from_core(_Thread_Executing->Wait.count);
+ if (msg_prio) {
+ *msg_prio = _POSIX_Message_queue_Priority_from_core(
+ _Thread_Executing->Wait.count
+ );
+ }
if ( !_Thread_Executing->Wait.return_code )
return length_out;
diff -u rtems/cpukit/posix/src/pthreadjoin.c:1.8.4.3 rtems/cpukit/posix/src/pthreadjoin.c:1.8.4.4
--- rtems/cpukit/posix/src/pthreadjoin.c:1.8.4.3 Sun Jul 31 17:40:43 2011
+++ rtems/cpukit/posix/src/pthreadjoin.c Thu Sep 1 13:24:57 2011
@@ -55,20 +55,21 @@
if ( the_thread->current_state ==
(STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_TRANSIENT) ) {
- return_pointer = the_thread->Wait.return_argument;
- _Thread_Clear_state(
- the_thread,
- (STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_TRANSIENT)
- );
+ return_pointer = the_thread->Wait.return_argument;
+ _Thread_Clear_state(
+ the_thread,
+ (STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_TRANSIENT)
+ );
+ _Thread_Enable_dispatch();
} else {
- _Thread_Executing->Wait.return_argument = &return_pointer;
+ _Thread_Executing->Wait.return_argument = &return_pointer;
_Thread_queue_Enter_critical_section( &api->Join_List );
_Thread_queue_Enqueue( &api->Join_List, WATCHDOG_NO_TIMEOUT );
- }
- _Thread_Enable_dispatch();
+ _Thread_Enable_dispatch();
- if ( _Thread_Executing->Wait.return_code == EINTR )
- goto on_EINTR;
+ if ( _Thread_Executing->Wait.return_code == EINTR )
+ goto on_EINTR;
+ }
if ( value_ptr )
*value_ptr = return_pointer;
diff -u rtems/cpukit/score/src/coretodmsecstoticks.c:1.1 rtems/cpukit/score/src/coretodmsecstoticks.c:1.1.2.1
--- rtems/cpukit/score/src/coretodmsecstoticks.c:1.1 Tue Dec 16 14:53:33 2008
+++ rtems/cpukit/score/src/coretodmsecstoticks.c Thu Sep 1 13:24:57 2011
@@ -1,4 +1,4 @@
-/* COPYRIGHT (c) 1989-2008.
+/* COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -21,5 +21,18 @@
uint32_t milliseconds
)
{
- return (milliseconds / rtems_configuration_get_milliseconds_per_tick());
+ uint32_t ticks;
+ uint32_t milliseconds_per_tick;
+
+ /**
+ * We should ensure the ticks not be truncated by integer division. We
+ * need to have it be greater than or equal to the requested time. It
+ * should not be shorter.
+ */
+ milliseconds_per_tick = rtems_configuration_get_milliseconds_per_tick();
+ ticks = milliseconds / milliseconds_per_tick;
+ if ( (milliseconds % milliseconds_per_tick) != 0 )
+ ticks += 1;
+
+ return ticks;
}
diff -u rtems/cpukit/score/src/coretodusectoticks.c:1.1 rtems/cpukit/score/src/coretodusectoticks.c:1.1.2.1
--- rtems/cpukit/score/src/coretodusectoticks.c:1.1 Tue Dec 16 14:53:34 2008
+++ rtems/cpukit/score/src/coretodusectoticks.c Thu Sep 1 13:24:57 2011
@@ -1,4 +1,4 @@
-/* COPYRIGHT (c) 1989-2008.
+/* COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -21,5 +21,18 @@
uint32_t microseconds
)
{
- return (microseconds / rtems_configuration_get_microseconds_per_tick());
+ uint32_t ticks;
+ uint32_t microseconds_per_tick;
+
+ /**
+ * We should ensure the ticks not be truncated by integer division. We
+ * need to have it be greater than or equal to the requested time. It
+ * should not be shorter.
+ */
+ microseconds_per_tick = rtems_configuration_get_microseconds_per_tick();
+ ticks = microseconds / microseconds_per_tick;
+ if ( (microseconds % microseconds_per_tick) != 0 )
+ ticks += 1;
+
+ return ticks;
}
diff -u rtems/cpukit/score/src/timespectoticks.c:1.3 rtems/cpukit/score/src/timespectoticks.c:1.3.2.1
--- rtems/cpukit/score/src/timespectoticks.c:1.3 Sun Nov 29 07:51:52 2009
+++ rtems/cpukit/score/src/timespectoticks.c Thu Sep 1 13:24:57 2011
@@ -35,16 +35,22 @@
)
{
uint32_t ticks;
+ uint32_t nanoseconds_per_tick;
if ( (time->tv_sec == 0) && (time->tv_nsec == 0) )
return 0;
- ticks = time->tv_sec * TOD_TICKS_PER_SECOND;
+ /**
+ * We should ensure the ticks not be truncated by integer division. We
+ * need to have it be greater than or equal to the requested time. It
+ * should not be shorter.
+ */
+ ticks = time->tv_sec * TOD_TICKS_PER_SECOND;
+ nanoseconds_per_tick = rtems_configuration_get_nanoseconds_per_tick();
+ ticks += time->tv_nsec / nanoseconds_per_tick;
- ticks += time->tv_nsec / rtems_configuration_get_nanoseconds_per_tick();
+ if ( (time->tv_nsec % nanoseconds_per_tick) != 0 )
+ ticks += 1;
- if (ticks)
- return ticks;
-
- return 1;
+ return ticks;
}
--
Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110901/36bd75b9/attachment-0001.html>
More information about the vc
mailing list