source: rtems/c/src/lib/libbsp/i386/ts_386ex/tools/network_ada/tcprelay/init.c @ 1d4048b2

4.104.114.84.95
Last change on this file since 1d4048b2 was 1d4048b2, checked in by Joel Sherrill <joel.sherrill@…>, on 08/11/99 at 23:45:57

Patch from Tony R. Ambardar <tonya@…>:

I'm attaching a big patch for the ts_386ex BSP which adds and includes
the following:

1) Conversion to ELF format + minor code cleanups + documentation.

2) An Ada95 binding to FreeBSD sockets, based on Samuel Tardieu's

adasockets-0.1.3 package. This includes some sample applications.

3) Some Ada and C interfaces to add serial-port debugging to

programs. Comes with examples, too; the Ada one shows how
transparent adding the support can be. Note that Rosimildo sent me
the original C code.

The network stuff is not BSP specific, and could be added to your Ada
code collection. The debugging stuff is specific to the i386. Right
now, everything sits in my "tools" directory.

  • Property mode set to 100644
File size: 2.3 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#include <rtems/rtems_bsdnet.h>
20#include "../networkconfig.h"
21
22#ifdef GNAT_PID
23#include <unistd.h>
24pid_t getpid()
25{
26  return GNAT_PID;
27}
28#endif
29
30/*
31 *  By having the POSIX_Init thread create a second thread just
32 *  to invoke gnat_main, we can override all default attributes
33 *  of the "Ada environment task".  Otherwise, we would be
34 *  stuck with the defaults set by RTEMS.
35 */
36 
37void *start_gnat_main( void * argument )
38{
39  extern int gnat_main ( int argc, char **argv, char **envp );
40
41  (void) gnat_main ( 0, 0, 0 );
42
43  exit( 0 );
44
45  return 0;
46}
47
48#define GNAT_MAIN_STACKSPACE (32*1024)
49
50void *POSIX_Init( void *argument )
51{
52  pthread_t       thread_id;
53  pthread_attr_t  attr;
54  int             status;
55
56  rtems_bsdnet_initialize_network ();
57
58  status = pthread_attr_init( &attr );
59  assert( !status );
60
61#ifdef GNAT_MAIN_STACKSPACE
62  status = pthread_attr_setstacksize( &attr, GNAT_MAIN_STACKSPACE );
63  assert( !status );
64#endif
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/*
80#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(1)
81*/
82
83#define CONFIGURE_POSIX_INIT_THREAD_TABLE
84
85#define CONFIGURE_EXECUTIVE_RAM_SIZE    (384*1024)
86#define CONFIGURE_INIT_TASK_STACK_SIZE  (10*1024)
87#define CONFIGURE_INIT_TASK_PRIORITY    120
88#define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \
89                                           RTEMS_NO_TIMESLICE | \
90                                           RTEMS_NO_ASR | \
91                                           RTEMS_INTERRUPT_LEVEL(0))
92
93#define CONFIGURE_MAXIMUM_POSIX_THREADS              20
94#define CONFIGURE_MAXIMUM_POSIX_KEYS                 20
95#define CONFIGURE_MAXIMUM_POSIX_MUTEXES              30
96#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES  20
97
98#define CONFIGURE_INIT
99
100#include <confdefs.h>
101
Note: See TracBrowser for help on using the repository browser.