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