summaryrefslogtreecommitdiff
path: root/ACE/ace/Rtems_init.c
blob: 389169d7a329262f4533e9e5f97bd0220a535596 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216

#if defined (ACE_HAS_RTEMS)

#define RTEMS_BSP_NETWORK_DRIVER_NAME "ne1"
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_ne_driver_attach
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 256

#define CONFIGURE_MAXIMUM_POSIX_THREADS 100
#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 300
#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 300
#define CONFIGURE_MAXIMUM_POSIX_KEYS 100
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 100
#define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 10
#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 300
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT Init
#define CONFIGURE_MEMORY_FOR_POSIX (10*1024)
#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE (10*1024)

#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER

#define CONFIGURE_EXECUTIVE_RAM_SIZE (512*1024)

#define CONFIGURE_MICROSECONDS_PER_TICK 10000

#define CONFIGURE_MAXIMUM_SEMAPHORES    100
#define CONFIGURE_MAXIMUM_TASKS         100
#define CONFIGURE_INIT_TASK_PRIORITY 120
#define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \
                                           RTEMS_NO_TIMESLICE | \
                                           RTEMS_NO_ASR | \
                                           RTEMS_INTERRUPT_LEVEL(0))

#include <bsp.h>

char *rtems_progname;

#define CONFIGURE_INIT

rtems_task Init (rtems_task_argument argument);

#include <confdefs.h>

#include <stdio.h>

#if !defined (ACE_LACKS_NETWORKING)

#include <rtems/rtems_bsdnet.h>

/*
 * Network configuration
 *
 ************************************************************
 * EDIT THIS FILE TO REFLECT YOUR NETWORK CONFIGURATION     *
 * BEFORE RUNNING ANY RTEMS PROGRAMS WHICH USE THE NETWORK! *
 ************************************************************
 */

#ifndef _RTEMS_NETWORKCONFIG_H_
#define _RTEMS_NETWORKCONFIG_H_

#ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
#warning "RTEMS_BSP_NETWORK_DRIVER_NAME is not defined"
#define RTEMS_BSP_NETWORK_DRIVER_NAME "no_network1"
#endif

#ifndef RTEMS_BSP_NETWORK_DRIVER_ATTACH
#warning "RTEMS_BSP_NETWORK_DRIVER_ATTACH is not defined"
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH 0
#endif

/* #define RTEMS_USE_BOOTP */

#include <bsp.h>

/*
 * Define RTEMS_SET_ETHERNET_ADDRESS if you want to specify the
 * Ethernet address here.  If RTEMS_SET_ETHERNET_ADDRESS is not
 * defined the driver will choose an address.
 */
#define RTEMS_SET_ETHERNET_ADDRESS
#if (defined (RTEMS_SET_ETHERNET_ADDRESS))
static char ethernet_address[6] = { 0x00, 0x80, 0x7F, 0x22, 0x61, 0x77 };

#endif

#define RTEMS_USE_LOOPBACK

#ifdef RTEMS_USE_LOOPBACK
/*
 * Loopback interface
 */
int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig *, int);

#ifdef RTEMS_USE_LOOPBACK_ONLY
static struct rtems_bsdnet_ifconfig netdriver_config = {
#else
static struct rtems_bsdnet_ifconfig loopback_config = {
#endif
  "lo0",                    /* name */
  rtems_bsdnet_loopattach,  /* attach function */
  0,                        /* link to next interface */
  "127.0.0.1",              /* IP address */
  "255.0.0.0",              /* IP net mask */
};
#endif

/*
 * Default network interface
 */
#ifndef RTEMS_USE_LOOPBACK_ONLY
static struct rtems_bsdnet_ifconfig netdriver_config = {
  RTEMS_BSP_NETWORK_DRIVER_NAME,    /* name */
  RTEMS_BSP_NETWORK_DRIVER_ATTACH,  /* attach function */

#ifdef RTEMS_USE_LOOPBACK
  &loopback_config,  /* link to next interface */
#else
  0,                 /* No more interfaces */
#endif

#if (defined (RTEMS_USE_BOOTP))
  0,        /* BOOTP supplies IP address */
  0,        /* BOOTP supplies IP net mask */
#else
  "XXX.YYY.ZZZ.XYZ",   /* IP address */
  "255.255.255.0",     /* IP net mask */
#endif /* !RTEMS_USE_BOOTP */

#if (defined (RTEMS_SET_ETHERNET_ADDRESS))
  ethernet_address,    /* Ethernet hardware address */
#else
  0,                   /* Driver supplies hardware address */
#endif
  0                    /* Use default driver parameters */
};
#endif

/*
 * Network configuration
 */
struct rtems_bsdnet_config rtems_bsdnet_config = {
  &netdriver_config,

#if (defined (RTEMS_USE_BOOTP))
  rtems_bsdnet_do_bootp,
#else
  0,
#endif

  0,      /* Default network task priority */
  0,      /* Default mbuf capacity */
  0,      /* Default mbuf cluster capacity */

#if (!defined (RTEMS_USE_BOOTP))
  "rtems_host",       /* Host name */
  "nodomain.com",     /* Domain name */
  "XXX.YYY.ZZZ.1",    /* Gateway */
  "XXX.YYY.ZZZ.1",    /* Log host */
  {"XXX.YYY.ZZZ.1" }, /* Name server(s) */
  {"XXX.YYY.ZZZ.1" }, /* NTP server(s) */

  /*
  *  A real example -- DO NOT USE THIS YOURSELF!!!
  */

#if 0
  "dy4",             /* Host name */
  "NOT_oarcorp.com", /* Domain name */
  "192.168.1.2",     /* Gateway */
  "192.168.1.2",     /* Log host */
  {"192.168.1.2" },  /* Name server(s) */
  {"192.168.1.2" },  /* NTP server(s) */
#endif
#endif /* !RTEMS_USE_BOOTP */

};

/*
 * For TFTP test application
 */
#if (defined (RTEMS_USE_BOOTP))
#define RTEMS_TFTP_TEST_HOST_NAME "BOOTP_HOST"
#define RTEMS_TFTP_TEST_FILE_NAME "BOOTP_FILE"
#else
#define RTEMS_TFTP_TEST_HOST_NAME "XXX.YYY.ZZZ.XYZ"
#define RTEMS_TFTP_TEST_FILE_NAME "tftptest"
#endif

#endif /* _RTEMS_NETWORKCONFIG_H_ */

#endif /* ACE_LACKS_NETWORKING */

extern int main (int, char *[]);

/*
 * RTEMS Startup Task
 */
rtems_task
Init (rtems_task_argument not_used)
{
  int retval = 0;
#if !defined (ACE_LACKS_NETWORKING)
  retval = rtems_bsdnet_initialize_network ();
#endif /* ACE_LACKS_NETWORKING */
  if (retval == 0)
    {
      retval = main (0, 0);
    }
}

#elif !defined (__GNUC__) && !defined (__INTEL_COMPILER)
/* Make compilers stop complaining about an empty translation unit */
static int shut_up_compiler = 0;
#endif /* ACE_HAS_RTEMS */