source: rtems/c/src/lib/libbsp/i386/ts_386ex/tools/debug_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#include <stdio.h>
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  int             status;
51
52  status = pthread_attr_init( &attr );
53  assert( !status );
54
55#ifdef GNAT_MAIN_STACKSPACE
56  status = pthread_attr_setstacksize( &attr, GNAT_MAIN_STACKSPACE );
57  assert( !status );
58#endif
59
60  status = pthread_create( &thread_id, &attr, start_gnat_main, NULL );
61  assert( !status );
62
63  pthread_exit( 0 );
64
65  return 0;
66}
67
68/* configuration information */
69
70#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
71#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
72
73#define CONFIGURE_POSIX_INIT_THREAD_TABLE
74
75#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1)
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.