1 | /* |
---|
2 | * COPYRIGHT (c) 1989-1997. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * Copyright assigned to U.S. Government, 1994. |
---|
5 | * |
---|
6 | * The license and distribution terms for this file may be found in |
---|
7 | * the file LICENSE in this distribution or at |
---|
8 | * http://www.OARcorp.com/rtems/license.html. |
---|
9 | * |
---|
10 | * $Id$ |
---|
11 | */ |
---|
12 | |
---|
13 | #include <bsp.h> |
---|
14 | |
---|
15 | #include <assert.h> |
---|
16 | #include <pthread.h> |
---|
17 | |
---|
18 | #include <stdio.h> |
---|
19 | #include <rtems/rtems_bsdnet.h> |
---|
20 | #include "../networkconfig.h" |
---|
21 | |
---|
22 | #ifdef GNAT_PID |
---|
23 | #include <unistd.h> |
---|
24 | pid_t getpid() |
---|
25 | { |
---|
26 | return GNAT_PID; |
---|
27 | } |
---|
28 | #endif |
---|
29 | |
---|
30 | /* |
---|
31 | * By having the POSIX_Init thread create a second thread just |
---|
32 | * to invoke gnat_main, we can override all default attributes |
---|
33 | * of the "Ada environment task". Otherwise, we would be |
---|
34 | * stuck with the defaults set by RTEMS. |
---|
35 | */ |
---|
36 | |
---|
37 | void *start_gnat_main( void * argument ) |
---|
38 | { |
---|
39 | extern int gnat_main ( int argc, char **argv, char **envp ); |
---|
40 | |
---|
41 | (void) gnat_main ( 0, 0, 0 ); |
---|
42 | |
---|
43 | exit( 0 ); |
---|
44 | |
---|
45 | return 0; |
---|
46 | } |
---|
47 | |
---|
48 | #define GNAT_MAIN_STACKSPACE (32*1024) |
---|
49 | |
---|
50 | void *POSIX_Init( void *argument ) |
---|
51 | { |
---|
52 | pthread_t thread_id; |
---|
53 | pthread_attr_t attr; |
---|
54 | int status; |
---|
55 | |
---|
56 | rtems_bsdnet_initialize_network (); |
---|
57 | |
---|
58 | status = pthread_attr_init( &attr ); |
---|
59 | assert( !status ); |
---|
60 | |
---|
61 | #ifdef GNAT_MAIN_STACKSPACE |
---|
62 | status = pthread_attr_setstacksize( &attr, GNAT_MAIN_STACKSPACE ); |
---|
63 | assert( !status ); |
---|
64 | #endif |
---|
65 | |
---|
66 | status = pthread_create( &thread_id, &attr, start_gnat_main, NULL ); |
---|
67 | assert( !status ); |
---|
68 | |
---|
69 | pthread_exit( 0 ); |
---|
70 | |
---|
71 | return 0; |
---|
72 | } |
---|
73 | |
---|
74 | /* configuration information */ |
---|
75 | |
---|
76 | #define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER |
---|
77 | #define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER |
---|
78 | |
---|
79 | /* |
---|
80 | #define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1) |
---|
81 | */ |
---|
82 | |
---|
83 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE |
---|
84 | |
---|
85 | #define CONFIGURE_EXECUTIVE_RAM_SIZE (384*1024) |
---|
86 | #define CONFIGURE_INIT_TASK_STACK_SIZE (10*1024) |
---|
87 | #define CONFIGURE_INIT_TASK_PRIORITY 120 |
---|
88 | #define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \ |
---|
89 | RTEMS_NO_TIMESLICE | \ |
---|
90 | RTEMS_NO_ASR | \ |
---|
91 | RTEMS_INTERRUPT_LEVEL(0)) |
---|
92 | |
---|
93 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 20 |
---|
94 | #define CONFIGURE_MAXIMUM_POSIX_KEYS 20 |
---|
95 | #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 30 |
---|
96 | #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 20 |
---|
97 | |
---|
98 | #define CONFIGURE_INIT |
---|
99 | |
---|
100 | #include <confdefs.h> |
---|
101 | |
---|