source: rtems-schedsim/schedsim/shell/shared/main_clocktick.c @ b38dbcc

Last change on this file since b38dbcc was b38dbcc, checked in by Joel Sherrill <joel.sherrill@…>, on May 14, 2014 at 2:55:21 PM

Many files: rm white space at EOL and EOF

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  Task Priority Shell Command Implmentation
3 *
4 *  COPYRIGHT (c) 1989-2013.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <stdio.h>
17
18#include <rtems.h>
19#include "shell.h"
20#include <rtems/stringto.h>
21#include <schedsim_shell.h>
22#include <rtems/error.h>
23
24int rtems_shell_main_clock_tick(
25  int   argc,
26  char *argv[]
27)
28{
29  rtems_status_code    status;
30  rtems_interval       ticks;
31  unsigned long        tmp;
32  rtems_interval       t;
33
34  CHECK_RTEMS_IS_UP();
35
36  if (argc != 2) {
37    fprintf( stderr, "%s: Usage ticks\n", argv[0] );
38    return -1;
39  }
40
41  if ( rtems_string_to_unsigned_long( argv[1], &tmp, NULL, 0) ) {
42    fprintf( stderr, "Argument (%s) is not a number\n", argv[2] );
43    return 1;
44  }
45
46  ticks = (rtems_interval) tmp;
47
48  /*
49   *  Now delete the task
50   */
51  for ( t=1 ; t<=ticks ; t++ ) {
52    printf( "ClockTick (%d) ...\n", t );
53    status = rtems_clock_tick();
54    if ( status != RTEMS_SUCCESSFUL ) {
55      fprintf(
56        stderr,
57        "Clock Tick (%s) returned %s\n",
58        argv[1],
59        rtems_status_text( status )
60      );
61      return -1;
62    }
63  }
64
65  return 0;
66}
67
68rtems_shell_cmd_t rtems_shell_CLOCK_TICK_Command = {
69  "clock_tick",                  /* name */
70  "clock_tick ticks",            /* usage */
71  "rtems",                       /* topic */
72  rtems_shell_main_clock_tick,   /* command */
73  NULL,                          /* alias */
74  NULL                           /* next */
75};
Note: See TracBrowser for help on using the repository browser.