]> git.karo-electronics.de Git - karo-tx-redboot.git/blob - packages/services/gfx/mw/v2_0/src/rtems/rtems_init.c
Cleanup CVS ipmorted branch
[karo-tx-redboot.git] / packages / services / gfx / mw / v2_0 / src / rtems / rtems_init.c
1 /*
2 /////////////////////////////////////////////////////////////////////////////
3 // $Header: /usr/cvs/microwin/src/rtems/rtems_init.c,v 1.1.1.1 2001/06/21 06:32:42 greg Exp $
4 //
5 // Copyright (c) 1999 ConnectTel, Inc. All Rights Reserved.
6 //  
7 // MODULE DESCRIPTION:
8 //
9 //  RTEMS Init Task for a MicroWindows application that 
10 //        may or may not use network functionality.
11 //
12 //  by: Rosimildo da Silva:
13 //      rdasilva@connecttel.com
14 //      http://www.connecttel.com
15 //
16 // MODIFICATION/HISTORY:
17 // $Log: rtems_init.c,v $
18 // Revision 1.1.1.1  2001/06/21 06:32:42  greg
19 // Microwindows pre8 with patches
20 //
21 // Revision 1.1.1.1  2001/06/05 03:44:03  root
22 // First import of 5/5/2001 Microwindows to CVS
23 //
24 //
25 /////////////////////////////////////////////////////////////////////////////
26 */
27
28 #define  CONFIGURE_INIT
29 #include <stdio.h>
30 #include "rtemscfg.h"
31
32 #ifndef  NONETWORK
33 #include "net_cfg.h"
34 #include <stdio.h>
35 #include <sys/socket.h>
36 #include <netinet/in.h>
37 #include <netdb.h>
38 #include <arpa/inet.h>
39 #endif
40 #include "device.h"  /* DPRINTF() macro */
41
42 /* Enable the following define if you want to debug this application */
43 /* #define USE_REMOTE_GDB__ */
44 #ifdef USE_REMOTE_GDB__
45 extern void init_remote_gdb( void );
46 #define BREAKPOINT() asm("   int $3");
47 #endif
48
49 /* this is the command line options to be passed to the main routine */
50 char *cc_argv[] = 
51 {
52         "cc_main",    /* arg[ 0 ] -- always the name of the program */
53 };
54 int cc_argc = sizeof( cc_argv ) / sizeof( cc_argv[ 0 ]  );
55
56
57 extern int rtems_main(int argc, char **argv);
58
59 /*
60  * DESCRIPTION: Init task for any MicroWindows/RTEMS application.
61  */
62 void *POSIX_Init( void *argument )
63 {
64   size_t st = 0;
65
66 #ifdef USE_REMOTE_GDB__
67   init_remote_gdb();
68 /*  BREAKPOINT(); */
69 #endif
70
71   DPRINTF( "\nStarting RTEMS init task...\n" );
72
73 #ifndef NONETWORK
74   /* Make all network initialization */
75   rtems_bsdnet_initialize_network();
76   DPRINTF( "Netowrk Initialization is complete.\n\n" );
77 #endif
78
79   st = _Thread_Executing->Start.Initial_stack.size;
80   DPRINTF( "Init Task Stack Size is: %d\n", st );
81
82   rtems_main( cc_argc, cc_argv );
83   DPRINTF( "*** Done ***\n\n\n" );
84   pthread_exit( NULL );
85   return NULL; /* just so the compiler thinks we returned something */
86 }