source: ada-examples/hello_world_ada/init.c @ 7efcefa

OARada-examples-4-10-branchada-examples-4-6-branchada-examples-4-7-branchada-examples-4-8-branchada-examples-4-9-branchrtems-4-5-branch ADA-EXAMPLES-BASE
Last change on this file since 7efcefa was 7efcefa, checked in by Joel Sherrill <joel.sherrill@…>, on 04/20/99 at 13:05:42

base GNAT/RTEMS examples

  • Property mode set to 100644
File size: 1.9 KB
Line 
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
18extern rtems_configuration_table  BSP_Configuration;
19
20#ifdef GNAT_PID
21#include <unistd.h>
22pid_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 
35void *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
46void *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
56#ifdef GNAT_MAIN_STACKSPACE
57  stacksize = GNAT_MAIN_STACKSPACE * 1024;
58#else
59#define GNAT_MAIN_STACKSPACE 0
60#endif
61
62  status = pthread_attr_setstacksize( &attr, stacksize );
63  assert( !status );
64
65  status = pthread_create( &thread_id, &attr, start_gnat_main, NULL );
66  assert( !status );
67
68  pthread_exit( 0 );
69
70  return 0;
71}
72
73/* configuration information */
74
75#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
76#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
77
78#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1)
79
80#define CONFIGURE_POSIX_INIT_THREAD_TABLE
81
82#define CONFIGURE_GNAT_RTEMS
83/*
84#define CONFIGURE_MAXIMUM_ADA_TASKS      20
85#define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
86
87#define CONFIGURE_MEMORY_OVERHEAD        (256 + GNAT_MAIN_STACKSPACE)
88*/
89
90#define CONFIGURE_INIT
91
92#include <confdefs.h>
93
Note: See TracBrowser for help on using the repository browser.