summaryrefslogtreecommitdiff
path: root/misc/bspcmdline/test.c
blob: 5d47f3d7dfde5dc572bbccb3cede0451f9aab353 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 *  Demonstrate accessing Boot Command Line provided by BSP
 *
 *  $Id$
 */

#include <bsp.h>
#include <rtems/bspcmdline.h>

#include <stdlib.h>
#include <stdio.h>

void print_arg(
  const char *param
)
{
  const char *p;
  char        value[80];
  size_t      length;

  printf( "\nLooking for param=(%s)\n", param );

  length = sizeof(value);
  p = rtems_bsp_cmdline_get_param( param, value, length );
  if ( !p ) {
    printf( "Did not locate param=(%s)\n", param );
    return;
  }

  p = rtems_bsp_cmdline_get_param_rhs( param, value, length );
  if ( !p ) {
    printf( "param=(%s) has no right hand side\n", param );
  } else {
    printf( "param=(%s) has right hand side of %s\n", param, p );
  }
  
}

rtems_task Init(
  rtems_task_argument ignored
)
{
  const char *bspcmdline;

  printf( "\n\n*** BSP Command Demonstration ***\n" );

  /*
   *  Let's see if this BSP provided one at all
   */
  bspcmdline = rtems_bsp_cmdline_get();
  if ( !bspcmdline ) {
    puts( "BSP does not have a boot command line" );
    goto demo_over;
  }

  printf( "BSP has a boot command line:\n" "%s\n", bspcmdline );

  /*
   *  The PC386 has some defined arguments.  Did we see any of those?
   */ 
  print_arg( "--console" );
  print_arg( "--ide" );
  print_arg( "--ide-show" );
  

demo_over:
  printf( "*** END OF BSP Command Line Demonstration ***\n" );
  exit( 0 );
}

/* configuration information */

/* NOTICE: the clock driver is explicitly disabled */
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_MAXIMUM_TASKS 1

#define CONFIGURE_INIT

#include <rtems/confdefs.h>

/* end of file */