source: rtems-testing/gcc/rtems_gccgo_init.c @ fa26552

4.11
Last change on this file since fa26552 was 71e69ab, checked in by Joel Sherrill <joel.sherrill@…>, on Dec 7, 2010 at 9:09:31 PM

2010-12-07 Joel Sherrill <joel.sherrill@…>

  • do_one, test_driver, testsuite/ada/acats/Makefile.rtems:
  • Makefile.rtems_gccgoinit, gccgo_status, networkconfig.h, rtems_gccgo_init.c: New files.
  • Property mode set to 100644
File size: 3.7 KB
Line 
1/*
2 *  Init for Go testing.
3 */
4
5#include <bsp.h>
6
7#include <stdlib.h>
8
9#include <rtems/rtems_bsdnet.h>
10#include <sys/socket.h>
11#include <netinet/in.h>
12#include "networkconfig.h"
13
14/*
15 * Set up first argument
16 */
17static int   argc     = 1;
18static char  arg0[20] = "rtems";
19static char *argv[20] = { arg0 };
20
21#if defined(MAIN_USE_REQUIRES_COMMAND_LINE)
22
23#define COMMAND_LINE_MAXIMUM 200
24
25#include <stdio.h>
26#include <ctype.h>
27
28void parse_arguments(
29  char   *buffer,
30  size_t  maximum_length
31)
32{
33  char   *cp;
34  char   *linebuf = buffer;
35  size_t  length;
36
37  for (;;) {
38
39    #if defined(MAIN_COMMAND_LINE)
40      strncpy (linebuf, MAIN_COMMAND_LINE, maximum_length);
41    #else
42      /*
43       * Read a line
44       */
45      printf (">>> %s ", argv[0]);
46      fflush (stdout);
47      fgets (linebuf, maximum_length, stdin);
48
49      length = strnlen( linebuf, maximum_length );
50      if ( linebuf[length - 1] == '\n' || linebuf[length - 1] == '\r' ) {
51         linebuf[length - 1] = '\0';
52      }
53    #endif
54
55    /*
56     * Break line into arguments
57     */
58    cp = linebuf;
59    for (;;) {
60      while (isspace (*cp))
61        *cp++ = '\0';
62      if (*cp == '\0')
63        break;
64      if (argc >= ((sizeof argv / sizeof argv[0]) - 1)) {
65        printf ("Too many arguments.\n");
66        argc = 0;
67        break;
68      }
69      argv[argc++] = cp;
70      while (!isspace (*cp)) {
71        if (*cp == '\0')
72          break;
73        cp++;
74      }
75    }
76    if (argc > 1) {
77      argv[argc] = NULL;
78      break;
79    }
80    printf ("You must give some arguments!\n");
81  }
82
83  #if defined(DEBUG_COMMAND_LINE_ARGUMENTS)
84    {
85      int   i;
86      for (i=0; i<argc ; i++ ) {
87        printf( "argv[%d] = ***%s***\n", i, argv[i] );
88      }
89      printf( "\n" );
90    }
91  #endif
92}
93
94
95#endif
96
97int main( int, char ** );
98
99void *POSIX_Init(
100  void *argument
101)
102{
103  //printk("Initializing Network\n");
104  rtems_bsdnet_initialize_network ();
105  //rtems_bsdnet_show_inet_routes ();
106#if defined(MAIN_USE_REQUIRES_COMMAND_LINE)
107  char command_line[ COMMAND_LINE_MAXIMUM ];
108  parse_arguments( command_line, COMMAND_LINE_MAXIMUM );
109#endif
110
111  main(argc, argv);
112  exit(0);
113  return 0;
114}
115
116#if defined(__mips__)
117/* GCC sometimes expects this on the mips */
118void _flush_cache()
119{
120}
121
122/* configuration information */
123
124/* NOTICE: the clock driver is explicitly disabled */
125#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
126#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
127
128#define CONFIGURE_POSIX_INIT_THREAD_TABLE
129// Works with 32 Mb too, this is faster
130//#define CONFIGURE_EXECUTIVE_RAM_SIZE (5 * 1024 * 1024)
131#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 500
132#define CONFIGURE_MAXIMUM_POSIX_THREADS 400
133#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES  500
134#define CONFIGURE_MAXIMUM_TASK_VARIABLES (2 * 400)
135#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE (32 * 1024)
136#define CONFIGURE_MINIMUM_TASK_STACK_SIZE (4 * 1024)
137//#define CONFIGURE_MEMORY_OVERHEAD (4 * 1024)
138
139//#define CONFIGURE_MICROSECONDS_PER_TICK 1000
140#define CONFIGURE_TICKS_PER_TIMESLICE   50
141#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1000)
142
143#define CONFIGURE_MAXIMUM_TASKS 20
144#define CONFIGURE_MAXIMUM_SEMAPHORES 20
145//#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES    20
146
147#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
148#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
149
150#define CONFIGURE_PIPES_ENABLED TRUE
151#define CONFIGURE_MAXIMUM_PIPES 20
152//#define CONFIGURE_MAXIMUM_BARRIERS 20
153
154#define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY TRUE
155//#define BSP_ZERO_WORKSPACE_AUTOMATICALLY 1
156#define CONFIGURE_UNIFIED_WORK_AREAS
157//#define CONFIGURE_MALLOC_DIRTY
158//#define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY 1
159#define CONFIGURE_STACK_CHECKER_ENABLED TRUE
160
161#define CONFIGURE_INIT
162
163#include <rtems/confdefs.h>
164
165/* end of file */
Note: See TracBrowser for help on using the repository browser.