source: rtems-schedsim/schedsim/shell/shared/main_taskwakeafter.c @ d8918c1

Last change on this file since d8918c1 was d8918c1, checked in by Joel Sherrill <joel.sherrill@…>, on 05/26/14 at 19:01:06

Misc so more scenarios run

  • Property mode set to 100644
File size: 1.7 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_task_wake_after(
25  int   argc,
26  char *argv[]
27)
28{
29  rtems_status_code    status;
30  rtems_interval       ticks;
31  unsigned long        tmp;
32  rtems_id             self;
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  self = get_thread_executing()->Object.id,
48
49  /*
50   *  Now sleep
51   */
52  printf( "Task (0x%08x) sleeping for %d ticks\n", self, ticks );
53
54  status = rtems_task_wake_after( ticks );
55  if ( status != RTEMS_SUCCESSFUL ) {
56    fprintf(
57      stderr,
58      "Task Wake After (%s) returned %s\n",
59      argv[1],
60      rtems_status_text( status )
61    );
62    return -1;
63  }
64
65  return 0;
66}
67
68rtems_shell_cmd_t rtems_shell_TASK_WAKE_AFTER_Command = {
69  "task_wake_after",                  /* name */
70  "task_wake_after ticks",            /* usage */
71  "rtems",                            /* topic */
72  rtems_shell_main_task_wake_after,   /* command */
73  NULL,                               /* alias */
74  NULL                                /* next */
75};
Note: See TracBrowser for help on using the repository browser.