summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spedfsched03/tasks_periodic.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-09-11 20:56:45 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-09-11 20:56:45 +0000
commit0d6aee4e35fc675f975a679dc1fd58d873d093e1 (patch)
tree29413772e49aa1f3749be945f3f9e19fe375a0ff /testsuites/sptests/spedfsched03/tasks_periodic.c
parent2011-09-11 Petr Benes <benesp16@fel.cvut.cz> (diff)
downloadrtems-0d6aee4e35fc675f975a679dc1fd58d873d093e1.tar.bz2
2011-09-11 Petr Benes <benesp16@fel.cvut.cz>
PR 1897/testing * Makefile.am, configure.ac: Add tests for Earliest Deadline First (EDF) Scheduling Algorithm implementation. * spedfsched01/.cvsignore, spedfsched01/Makefile.am, spedfsched01/init.c, spedfsched01/spedfsched01.doc, spedfsched01/spedfsched01.scn, spedfsched01/system.h, spedfsched01/task1.c, spedfsched02/.cvsignore, spedfsched02/Makefile.am, spedfsched02/getall.c, spedfsched02/init.c, spedfsched02/spedfsched02.doc, spedfsched02/spedfsched02.scn, spedfsched02/system.h, spedfsched02/task1.c, spedfsched03/.cvsignore, spedfsched03/Makefile.am, spedfsched03/edfparams.h, spedfsched03/init.c, spedfsched03/spedfsched03.doc, spedfsched03/spedfsched03.scn, spedfsched03/system.h, spedfsched03/tasks_aperiodic.c, spedfsched03/tasks_periodic.c: New files.
Diffstat (limited to '')
-rw-r--r--testsuites/sptests/spedfsched03/tasks_periodic.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/testsuites/sptests/spedfsched03/tasks_periodic.c b/testsuites/sptests/spedfsched03/tasks_periodic.c
new file mode 100644
index 0000000000..fa2fe7e8f4
--- /dev/null
+++ b/testsuites/sptests/spedfsched03/tasks_periodic.c
@@ -0,0 +1,82 @@
+/* Tasks_Periodic
+ *
+ * This routine serves as a test task for the EDF scheduler
+ * implementation.
+ *
+ * Input parameters:
+ * argument - task argument
+ *
+ * Output parameters: NONE
+ *
+ * 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$
+ */
+
+#include "system.h"
+
+rtems_task Tasks_Periodic(
+ rtems_task_argument argument
+)
+{
+ rtems_id rmid;
+ rtems_id test_rmid;
+ rtems_status_code status;
+
+ int start, stop, now;
+
+ status = rtems_rate_monotonic_create( argument, &rmid );
+ directive_failed( status, "rtems_rate_monotonic_create" );
+ put_name( Task_name[ argument ], FALSE );
+ printf( "- rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n",
+ rmid );
+
+ status = rtems_rate_monotonic_ident( argument, &test_rmid );
+ directive_failed( status, "rtems_rate_monotonic_ident" );
+ put_name( Task_name[ argument ], FALSE );
+ printf( "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n",
+ test_rmid );
+
+ if ( rmid != test_rmid ) {
+ printf( "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%"
+ PRIxrtems_id ")\n", rmid, test_rmid );
+ rtems_test_exit( 0 );
+ }
+
+ put_name( Task_name[ argument ], FALSE );
+ printf( "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n",
+ rmid, Periods[ argument ] );
+
+ status = rtems_task_wake_after( 2 + Phases[argument] );
+ directive_failed( status, "rtems_task_wake_after" );
+
+ while (FOREVER) {
+ if (rtems_rate_monotonic_period(rmid, Periods[argument])==RTEMS_TIMEOUT)
+ printf("P%" PRIdPTR " - Deadline miss\n", argument);
+
+ rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
+ printf("P%" PRIdPTR "-S ticks:%d\n", argument, start);
+ if ( start >= 2*HP_LENGTH ) break; /* stop */
+ /* active computing */
+
+ /* using periodic statistics */
+ while(FOREVER) {
+ rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now);
+ if (now >= start + Execution[argument]) break;
+ }
+ rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &stop);
+ printf("P%" PRIdPTR "-F ticks:%d\n", argument, stop);
+ }
+
+ /* delete period and SELF */
+ status = rtems_rate_monotonic_delete( rmid );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ printf("rtems_rate_monotonic_delete failed with status of %d.\n",status);
+ rtems_test_exit( 0 );
+ }
+ fflush(stdout);
+ puts( "*** END OF TEST EDF SCHEDULER 3 ***" );
+ rtems_test_exit( 0 );
+}