[7efcefa] | 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 | extern rtems_configuration_table BSP_Configuration; |
---|
| 19 | |
---|
| 20 | #ifdef GNAT_PID |
---|
| 21 | #include <unistd.h> |
---|
| 22 | pid_t getpid() |
---|
| 23 | { |
---|
| 24 | return GNAT_PID; |
---|
| 25 | } |
---|
| 26 | #endif |
---|
| 27 | |
---|
| 28 | /* |
---|
| 29 | * By having the POSIX_Init thread create a second thread just |
---|
| 30 | * to invoke gnat_main, we can override all default attributes |
---|
| 31 | * of the "Ada environment task". Otherwise, we would be |
---|
| 32 | * stuck with the defaults set by RTEMS. |
---|
| 33 | */ |
---|
| 34 | |
---|
| 35 | void *start_gnat_main( void * argument ) |
---|
| 36 | { |
---|
| 37 | extern int gnat_main ( int argc, char **argv, char **envp ); |
---|
| 38 | |
---|
| 39 | (void) gnat_main ( 0, 0, 0 ); |
---|
| 40 | |
---|
| 41 | exit( 0 ); |
---|
| 42 | |
---|
| 43 | return 0; |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | void *POSIX_Init( void *argument ) |
---|
| 47 | { |
---|
| 48 | pthread_t thread_id; |
---|
| 49 | pthread_attr_t attr; |
---|
| 50 | size_t stacksize = _ada_pthread_minimum_stack_size(); |
---|
| 51 | int status; |
---|
| 52 | |
---|
| 53 | status = pthread_attr_init( &attr ); |
---|
| 54 | assert( !status ); |
---|
| 55 | |
---|
[a1affab] | 56 | #define GNAT_MAIN_STACKSPACE 100 |
---|
[7efcefa] | 57 | #ifdef GNAT_MAIN_STACKSPACE |
---|
| 58 | stacksize = GNAT_MAIN_STACKSPACE * 1024; |
---|
| 59 | #else |
---|
| 60 | #define GNAT_MAIN_STACKSPACE 0 |
---|
| 61 | #endif |
---|
| 62 | |
---|
| 63 | status = pthread_attr_setstacksize( &attr, stacksize ); |
---|
| 64 | assert( !status ); |
---|
| 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 | #define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1) |
---|
| 80 | |
---|
| 81 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE |
---|
| 82 | |
---|
[a1affab] | 83 | #define CONFIGURE_MAXIMUM_SEMAPHORES 10 |
---|
[7efcefa] | 84 | #define CONFIGURE_GNAT_RTEMS |
---|
| 85 | /* |
---|
| 86 | #define CONFIGURE_MAXIMUM_ADA_TASKS 20 |
---|
| 87 | #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0 |
---|
| 88 | |
---|
| 89 | #define CONFIGURE_MEMORY_OVERHEAD (256 + GNAT_MAIN_STACKSPACE) |
---|
| 90 | */ |
---|
| 91 | |
---|
| 92 | #define CONFIGURE_INIT |
---|
| 93 | |
---|
| 94 | #include <confdefs.h> |
---|
| 95 | |
---|