Changeset ac6e5c7 in rtems-schedsim


Ignore:
Timestamp:
May 17, 2011, 7:31:16 PM (8 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
master
Children:
aebb1ca
Parents:
f40778b
Message:

2011-05-17 Joel Sherrill <joel.sherrill@…>

  • Makefile.am: Merge and update code. Simulators for Deterministic Priority and SMP Simple Schedulers now work.
  • run_scenarios: New file.
Location:
schedsim/shell
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • schedsim/shell/ChangeLog

    rf40778b rac6e5c7  
     12011-05-17      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * Makefile.am: Merge and update code. Simulators for Deterministic
     4        Priority and SMP Simple Schedulers now work.
     5        * run_scenarios: New file.
     6
    172011-04-07      Joel Sherrill <joel.sherrill@oarcorp.com>
    28
  • schedsim/shell/Makefile.am

    rf40778b rac6e5c7  
    55ACLOCAL_AMFLAGS = -I ./../aclocal
    66
    7 SUBDIRS = shared schedsim_priority
     7SUBDIRS = shared schedsim_priority
     8DIST_SUBDIRS = shared schedsim_priority
    89
    9 DIST_SUBDIRS = shared schedsim_priority
     10if HAS_SMP
     11SUBDIRS += schedsim_smpsimple
     12DIST_SUBDIRS += schedsim_smpsimple
     13endif
    1014
    1115include $(top_srcdir)/../automake/subdirs.am
  • schedsim/shell/shared/Makefile.am

    rf40778b rac6e5c7  
    99cpukitdir=@rtems_srcdir@/cpukit
    1010libschedsim_a_CPPFLAGS  = -D__RTEMS_VIOLATE_KERNEL_VISIBILITY__
     11libschedsim_a_CPPFLAGS += -I$(top_builddir)/score/include
    1112libschedsim_a_CPPFLAGS += -I$(srcdir)/sched_cpu
    1213libschedsim_a_CPPFLAGS += -I$(srcdir)/../../rtems
  • schedsim/shell/shared/lookup_task.c

    rf40778b rac6e5c7  
    3838
    3939  if ( string[0] != '0' ) {
     40    if ( !strcmp( string, "SELF" ) ) {
     41      *id = _Thread_Executing->Object.id;
     42      return 0;
     43    }
    4044    memset( name, '\0', sizeof(name) );
    4145    strncpy( name, string, 4 );
  • schedsim/shell/shared/main_clocktick.c

    rf40778b rac6e5c7  
    5252   */
    5353  for ( t=1 ; t<=ticks ; t++ ) {
    54     fprintf( stderr, "ClockTick (%d) ...\n", t );
     54    printf( "ClockTick (%d) ...\n", t );
    5555    status = rtems_clock_tick();
    5656    if ( status != RTEMS_SUCCESSFUL ) {
  • schedsim/shell/shared/main_rtemsinit.c

    rf40778b rac6e5c7  
    2121#include "shell.h"
    2222#include <schedsim_shell.h>
     23#include <rtems/stringto.h>
     24
     25#if defined(RTEMS_SMP)
     26  #include <rtems/score/smp.h>
     27#endif
    2328
    2429int rtems_shell_main_rtems_init(
     
    2732)
    2833{
     34#if defined(RTEMS_SMP)
     35  long cpus;
     36
     37  if ( argc >= 2 ) {
     38    if ( rtems_string_to_long(argv[1], &cpus, NULL, 0) ) {
     39      printf( "Number of CPUs argument (%s) is not a number\n", argv[1] );
     40      return -1;
     41    }
     42    rtems_configuration_smp_maximum_processors = cpus;
     43  }
     44#endif
     45
    2946  //
    3047  // Initialize RTEMS
     
    3653rtems_shell_cmd_t rtems_shell_RTEMS_INIT_Command = {
    3754  "rtems_init",                 /* name */
    38   "rtems_init",                 /* usage */
     55  "rtems_init [cpus]",          /* usage */
    3956  "rtems",                      /* topic */
    4057  rtems_shell_main_rtems_init,  /* command */
  • schedsim/shell/shared/main_taskcreate.c

    rf40778b rac6e5c7  
    1818#include <stdio.h>
    1919
     20#define __need_getopt_newlib
     21#include <newlib/getopt.h>
     22
    2023#include <rtems.h>
    2124#include "shell.h"
     
    2326#include <schedsim_shell.h>
    2427#include <rtems/error.h>
     28
     29static void print_mode(
     30  const char *prefix,
     31  rtems_mode  mode
     32)
     33{
     34  printf(
     35    "%sPreemption: %s Timeslicing: %s\n",
     36    prefix,
     37    ((mode & RTEMS_NO_PREEMPT) ? "no" : "yes"),
     38    ((mode & RTEMS_TIMESLICE) ? "yes" : "no")
     39  );
     40}
    2541
    2642rtems_task dummy_task(
     
    3955  rtems_status_code  status;
    4056  long               priority;
     57  rtems_mode         mode;
     58  rtems_mode         mask;
     59  struct getopt_data getopt_reent;
     60  char               option;
     61  int                arg;
    4162 
    4263  CHECK_RTEMS_IS_UP();
    4364
    44   if (argc != 3) {
    45     fprintf( stderr, "%s: Usage name priority\n", argv[0] );
     65  mode = 0;
     66  mask = 0;
     67  memset(&getopt_reent, 0, sizeof(getopt_data));
     68  while ( (option = getopt_r( argc, argv, "tTpP", &getopt_reent)) != -1 ) {
     69    switch (option) {
     70      case 't':
     71        mask |= RTEMS_TIMESLICE_MASK;
     72        mode  = (mode & ~RTEMS_TIMESLICE_MASK) | RTEMS_NO_TIMESLICE;
     73        break;
     74      case 'T':
     75        mask |= RTEMS_TIMESLICE_MASK;
     76        mode  = (mode & ~RTEMS_TIMESLICE_MASK) | RTEMS_TIMESLICE;
     77        break;
     78      case 'p':
     79        mask |= RTEMS_PREEMPT_MASK;
     80        mode  = (mode & ~RTEMS_PREEMPT_MASK) | RTEMS_NO_PREEMPT;
     81        break;
     82      case 'P':
     83        mask |= RTEMS_PREEMPT_MASK;
     84        mode  = (mode & ~RTEMS_PREEMPT_MASK) | RTEMS_PREEMPT;
     85        break;
     86      default:
     87        fprintf( stderr, "%s: Usage [-tTpP]\n", argv[0] );
     88        return -1;
     89    }
     90  }
     91
     92  print_mode( "Creating task with:  ", mode );
     93
     94  /*
     95   *  Rest of arguments
     96   */
     97  arg = getopt_reent.optind;
     98  if ((argc - arg) != 2) {
     99    fprintf( stderr, "%s: Usage [args] name priority\n", argv[0] );
    46100    return -1;
    47101  }
    48102
    49   if ( rtems_string_to_long(argv[2], &priority, NULL, 0) ) {
     103  if ( rtems_string_to_long(argv[arg+1], &priority, NULL, 0) ) {
    50104    printf( "Seconds argument (%s) is not a number\n", argv[1] );
    51105    return -1;
     
    56110   */
    57111  memset( name, '\0', sizeof(name) );
    58   strncpy( name, argv[1], 4 );
     112  strncpy( name, argv[arg], 4 );
    59113
    60114  status = rtems_task_create(
     
    62116    (rtems_task_priority) priority,
    63117    RTEMS_MINIMUM_STACK_SIZE,
    64     RTEMS_DEFAULT_MODES,
     118    mode,
    65119    RTEMS_DEFAULT_ATTRIBUTES,
    66120    &id
     
    70124      stderr,
    71125      "Task Create(%s) returned %s\n",
    72       argv[1],
     126      name,
    73127      rtems_status_text( status )
    74128    );
     
    78132  printf(
    79133    "Task (%s) created: id=0x%08x, priority=%ld\n",
    80     argv[1],
     134    name,
    81135    id,
    82136    priority
     
    85139  printf(
    86140    "Task (%s) starting: id=0x%08x, priority=%ld\n",
    87     argv[1],
     141    name,
    88142    id,
    89143    priority
     
    95149      stderr,
    96150      "Task Start(%s) returned %s\n",
    97       argv[1],
     151      name,
    98152      rtems_status_text( status )
    99153    );
  • schedsim/shell/shared/main_taskmode.c

    rf40778b rac6e5c7  
    2727#include <rtems/error.h>
    2828
    29 void print_mode(
     29static void print_mode(
    3030  const char *prefix,
    3131  rtems_mode  mode
    3232)
    3333{
    34   fprintf(
    35     stderr,
     34  printf(
    3635    "%sPreemption: %s Timeslicing: %s\n",
    3736    prefix,
Note: See TracChangeset for help on using the changeset viewer.