<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for examples-v2 (2010-12-17)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-12-17 Joel Sherrill <joel.sherrill@oarcorp.com>
* ChangeLog, schedsim_priority/Makefile, schedsim_priority/README,
schedsim_priority/config.c, schedsim_priority/printheir_executing.c,
schedsim_priority/schedsim.cc,
schedsim_priority/wrap_thread_dispatch.c: New files.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/schedsim/ChangeLog?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">schedsim/ChangeLog</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/schedsim/schedsim_priority/Makefile?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">schedsim/schedsim_priority/Makefile</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/schedsim/schedsim_priority/README?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">schedsim/schedsim_priority/README</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/schedsim/schedsim_priority/config.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">schedsim/schedsim_priority/config.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/schedsim/schedsim_priority/printheir_executing.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">schedsim/schedsim_priority/printheir_executing.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/schedsim/schedsim_priority/schedsim.cc?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">schedsim/schedsim_priority/schedsim.cc</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/schedsim/schedsim_priority/wrap_thread_dispatch.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">schedsim/schedsim_priority/wrap_thread_dispatch.c</font></td></tr>
</table>
<pre>
<font color='#006600'>diff -u /dev/null examples-v2/schedsim/ChangeLog:1.1
--- /dev/null Fri Dec 17 10:10:07 2010
+++ examples-v2/schedsim/ChangeLog Fri Dec 17 09:53:17 2010
</font><font color='#997700'>@@ -0,0 +1,7 @@
</font><font color='#000088'>+2010-12-17 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * ChangeLog, schedsim_priority/Makefile, schedsim_priority/README,
+ schedsim_priority/config.c, schedsim_priority/printheir_executing.c,
+ schedsim_priority/schedsim.cc,
+ schedsim_priority/wrap_thread_dispatch.c: New files.
+
</font>
<font color='#006600'>diff -u /dev/null examples-v2/schedsim/schedsim_priority/Makefile:1.1
--- /dev/null Fri Dec 17 10:10:07 2010
+++ examples-v2/schedsim/schedsim_priority/Makefile Fri Dec 17 09:53:17 2010
</font><font color='#997700'>@@ -0,0 +1,17 @@
</font><font color='#000088'>+#
+# $Id$
+#
+
+PREFIX=/home/jennifer/rtems-head-work/bsp-install/
+OBJS = config.o printheir_executing.o schedsim.o wrap_thread_dispatch.o
+CPPFLAGS = -I${PREFIX}/include/schedsim
+LDFLAGS = -L${PREFIX}/lib
+LDFLAGS += -Wl,--wrap=_Thread_Dispatch
+
+all: schedsim
+
+schedsim: $(OBJS)
+ g++ -o schedsim $(OBJS) $(LDFLAGS) -lschedsim -lrtems
+
+clean:
+ rm -f *.o schedsim
</font>
<font color='#006600'>diff -u /dev/null examples-v2/schedsim/schedsim_priority/README:1.1
--- /dev/null Fri Dec 17 10:10:07 2010
+++ examples-v2/schedsim/schedsim_priority/README Fri Dec 17 09:53:17 2010
</font><font color='#997700'>@@ -0,0 +1,6 @@
</font><font color='#000088'>+#
+# $Id$
+#
+
+This is an example of how to build a custom RTEMS Scheduler Simulator
+instance for evaluation of new scheduling algorithms.
</font>
<font color='#006600'>diff -u /dev/null examples-v2/schedsim/schedsim_priority/config.c:1.1
--- /dev/null Fri Dec 17 10:10:07 2010
+++ examples-v2/schedsim/schedsim_priority/config.c Fri Dec 17 09:53:17 2010
</font><font color='#997700'>@@ -0,0 +1,7 @@
</font><font color='#000088'>+#include <rtems.h>
+
+#define CONFIGURE_INIT
+#define CONFIGURE_MAXIMUM_TASKS 1000
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1000
+#include <rtems/confdefs.h>
+
</font>
<font color='#006600'>diff -u /dev/null examples-v2/schedsim/schedsim_priority/printheir_executing.c:1.1
--- /dev/null Fri Dec 17 10:10:07 2010
+++ examples-v2/schedsim/schedsim_priority/printheir_executing.c Fri Dec 17 09:53:17 2010
</font><font color='#997700'>@@ -0,0 +1,31 @@
</font><font color='#000088'>+/*
+ * printheir_executing
+ *
+ * COPYRIGHT (c) 1989-2010.
+ * 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$
+ */
+
+#include <stdio.h>
+#include <rtems.h>
+
+void PRINT_EXECUTING() {
+ printf(
+ " Thread Executing: 0x%08x priority=%ld\n",
+ _Thread_Executing->Object.id,
+ (long) _Thread_Executing->current_priority
+ );
+}
+
+void PRINT_HEIR() {
+ printf(<span style="background-color: #FF0000"> </span>
+ " Thread Heir: 0x%08x priority=%ld\n",<span style="background-color: #FF0000"> </span>
+ _Thread_Heir->Object.id,<span style="background-color: #FF0000"> </span>
+ (long) _Thread_Heir->current_priority<span style="background-color: #FF0000"> </span>
+ );
+}
</font>
<font color='#006600'>diff -u /dev/null examples-v2/schedsim/schedsim_priority/schedsim.cc:1.1
--- /dev/null Fri Dec 17 10:10:07 2010
+++ examples-v2/schedsim/schedsim_priority/schedsim.cc Fri Dec 17 09:53:17 2010
</font><font color='#997700'>@@ -0,0 +1,169 @@
</font><font color='#000088'>+/*
+ * COPYRIGHT (c) 1989-2010.
+ * 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$
+ */
+
+#include <newlib/getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "shell.h"
+#include "rtems_sched.h"
+
+/*
+ * Variables to control global behavior
+ */
+int verbose = 0;
+const char *progname;
+const char *scriptname;
+
+FILE *Script;
+int ScriptFileLine = 0;
+
+/*
+ * Print program usage message
+ */
+void usage()
+{
+ fprintf(
+ stderr,
+ "Usage: %s [-v] script\n"
+ "\n"
+ " -v - enable verbose output\n",
+ progname
+ );
+ exit( -1 );
+}
+
+#define RTEMS_SHELL_MAXIMUM_ARGUMENTS (128)
+
+void ProcessScript(
+ FILE *script
+)
+{
+ char buffer[512];
+ char *cStatus;
+ char *c;
+ size_t length;
+ int argc;
+ char *argv[RTEMS_SHELL_MAXIMUM_ARGUMENTS];
+ rtems_shell_cmd_t *shell_cmd;
+<span style="background-color: #FF0000"> </span>
+<span style="background-color: #FF0000"> </span>
+ while ( 1 ) {
+ cStatus = fgets( buffer, sizeof(buffer), script );
+ if ( cStatus == NULL )
+ break;
+
+ // If the last line does not have a CR, then we don't want to
+ // arbitrarily clobber an = instead of a \n.
+ length = strlen(buffer);
+ if ( buffer[ length - 1] == '\n' )
+ buffer[ length - 1] = '\0';
+
+ if ( verbose )
+ fprintf( stderr, "%d: %s\n", ++ScriptFileLine, buffer );
+
+ if ( buffer[0] == '#' )
+ continue;
+
+ for ( c = buffer ; *c ; c++ ) {
+ if (!isblank((int)*c))
+ break;
+ }
+
+
+ if (!strcmp(c,"bye") || !strcmp(c,"exit")) {
+ return;
+ }<span style="background-color: #FF0000"> </span>
+
+ if (rtems_shell_make_args(c, &argc, argv, RTEMS_SHELL_MAXIMUM_ARGUMENTS)) {
+ fprintf(stderr, "Error parsing arguments\n" );
+ continue;
+ }
+
+ shell_cmd = rtems_shell_lookup_cmd(argv[0]);
+ if ( !shell_cmd ) {
+ fprintf(stderr, "%s is unknown command\n", c );
+ continue;
+ }
+
+ shell_cmd->command(argc, argv);
+ }
+}
+
+int main(
+ int argc,
+ char **argv
+)
+{
+ int opt;
+ progname = argv[0];
+<span style="background-color: #FF0000"> </span>
+ while ((opt = getopt(argc, argv, "v")) != -1) {
+ switch (opt) {
+ case 'v': verbose = 1; break;
+ default: /* '?' */
+ usage();
+ }
+ }
+
+ if ( optind >= argc ) {
+ fprintf( stderr, "no script to process\n" );
+ usage();
+ }
+
+ scriptname = argv[ optind ];
+
+ if ( verbose ) {
+ fprintf(
+ stderr,
+ "Script File : %s\n"
+ "verbose : %d\n",
+ scriptname,
+ verbose
+ );
+ }
+
+ //
+ // Initialize the command interpreter
+ //
+ rtems_shell_initialize_command_set();
+
+ //
+ // Open the script file
+ //<span style="background-color: #FF0000"> </span>
+ Script = fopen( scriptname, "r" );
+ if ( !Script ) {
+ fprintf( stderr, "Unable to open script file (%s)\n", scriptname );
+ exit( -1 );
+ }
+
+ //
+ // Process the Script
+ //
+ ProcessScript( Script );
+
+ //
+ // Open the script file
+ //<span style="background-color: #FF0000"> </span>
+ (void) fclose( Script );
+
+ //
+ // Just in case something throws
+ //
+ try {
+ } catch (...) {
+ exit(-1);
+ }
+
+ return 0;
+}
</font>
<font color='#006600'>diff -u /dev/null examples-v2/schedsim/schedsim_priority/wrap_thread_dispatch.c:1.1
--- /dev/null Fri Dec 17 10:10:07 2010
+++ examples-v2/schedsim/schedsim_priority/wrap_thread_dispatch.c Fri Dec 17 09:53:17 2010
</font><font color='#997700'>@@ -0,0 +1,42 @@
</font><font color='#000088'>+/*
+ * Thread Dispatch Wrapper Implmentation
+ *
+ * COPYRIGHT (c) 1989-2010.
+ * 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$
+ */
+
+#include "shell.h"
+#include <schedsim_shell.h>
+
+#include <stdio.h>
+#include <rtems.h>
+
+Thread_Control *last_heir = NULL;
+Thread_Control *last_executing = NULL;
+
+extern void __real__Thread_Dispatch(void);
+
+void check_heir_and_executing(void)
+{
+ if ( last_heir != _Thread_Heir )<span style="background-color: #FF0000"> </span>
+ PRINT_HEIR();
+
+ if ( last_executing != _Thread_Executing )
+ PRINT_EXECUTING();
+
+ last_heir = _Thread_Heir;
+ last_executing = _Thread_Executing;
+}
+
+void __wrap__Thread_Dispatch(void)
+{
+ check_heir_and_executing();
+ __real__Thread_Dispatch();
+ check_heir_and_executing();
+}
</font></pre>
<p> </p>
<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>