source: rtems/c/src/lib/libbsp/i386/ts_386ex/tools/ts_1325_ada/init.c @ df49c60

4.104.114.84.95
Last change on this file since df49c60 was df49c60, checked in by Joel Sherrill <joel.sherrill@…>, on 06/12/00 at 15:00:15

Merged from 4.5.0-beta3a

  • Property mode set to 100644
File size: 1.8 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
18#ifdef GNAT_PID
19#include <unistd.h>
20pid_t getpid()
21{
22  return GNAT_PID;
23}
24#endif
25
26/*
27 *  By having the POSIX_Init thread create a second thread just
28 *  to invoke gnat_main, we can override all default attributes
29 *  of the "Ada environment task".  Otherwise, we would be
30 *  stuck with the defaults set by RTEMS.
31 */
32 
33void *start_gnat_main( void * argument )
34{
35  extern int gnat_main ( int argc, char **argv, char **envp );
36
37  (void) gnat_main ( 0, 0, 0 );
38
39  exit( 0 );
40
41  return 0;
42}
43
44void *POSIX_Init( void *argument )
45{
46  pthread_t       thread_id;
47  pthread_attr_t  attr;
48  int             status;
49
50  status = pthread_attr_init( &attr );
51  assert( !status );
52
53#ifdef GNAT_MAIN_STACKSPACE
54  status = pthread_attr_setstacksize( &attr, GNAT_MAIN_STACKSPACE );
55  assert( !status );
56#endif
57
58  status = pthread_create( &thread_id, &attr, start_gnat_main, NULL );
59  assert( !status );
60
61  pthread_exit( 0 );
62
63  return 0;
64}
65
66/* configuration information */
67
68#define CONFIGURE_GNAT_RTEMS
69
70#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
71#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
72
73#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1)
74
75#define CONFIGURE_POSIX_INIT_THREAD_TABLE
76
77#define CONFIGURE_MAXIMUM_POSIX_THREADS              20
78#define CONFIGURE_MAXIMUM_POSIX_KEYS                 20
79#define CONFIGURE_MAXIMUM_POSIX_MUTEXES              30
80#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES  20
81
82#define CONFIGURE_INIT
83
84#include <confdefs.h>
85
Note: See TracBrowser for help on using the repository browser.