diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-03-30 14:01:19 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-03-30 14:01:19 +0000 |
commit | 8f95b5f67b59eef4aa392b6be72f59af720d9ea2 (patch) | |
tree | af9b523e50efac2535bb4adc90d162f84ec78284 /c/src/lib/libbsp/i386 | |
parent | Renamed crt0.o to crt0_go32.o to avoid build problems. (diff) | |
download | rtems-8f95b5f67b59eef4aa392b6be72f59af720d9ea2.tar.bz2 |
Moved bsp_postdriver_hook() to a shared file and made it a common
component.
Diffstat (limited to 'c/src/lib/libbsp/i386')
-rw-r--r-- | c/src/lib/libbsp/i386/force386/startup/Makefile.in | 2 | ||||
-rw-r--r-- | c/src/lib/libbsp/i386/force386/startup/bspstart.c | 29 | ||||
-rw-r--r-- | c/src/lib/libbsp/i386/go32/startup/Makefile.in | 2 | ||||
-rw-r--r-- | c/src/lib/libbsp/i386/go32/startup/bspstart.c | 28 | ||||
-rw-r--r-- | c/src/lib/libbsp/i386/pc386/startup/Makefile.in | 2 | ||||
-rw-r--r-- | c/src/lib/libbsp/i386/pc386/startup/bspstart.c | 37 |
6 files changed, 11 insertions, 89 deletions
diff --git a/c/src/lib/libbsp/i386/force386/startup/Makefile.in b/c/src/lib/libbsp/i386/force386/startup/Makefile.in index 4bf71c8ce3..3da58a3ab9 100644 --- a/c/src/lib/libbsp/i386/force386/startup/Makefile.in +++ b/c/src/lib/libbsp/i386/force386/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bspstart main sbrk setvec +C_PIECES=bspclean bsppost bspstart main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/i386/force386/startup/bspstart.c b/c/src/lib/libbsp/i386/force386/startup/bspstart.c index 18e4fc88aa..9e6b151593 100644 --- a/c/src/lib/libbsp/i386/force386/startup/bspstart.c +++ b/c/src/lib/libbsp/i386/force386/startup/bspstart.c @@ -25,8 +25,6 @@ #include <libcsupport.h> -#include <fcntl.h> - #ifdef STACK_CHECKER_ON #include <stackchk.h> #endif @@ -111,33 +109,10 @@ bsp_pretasking_hook(void) /* - * After drivers are setup, register some "filenames" - * and open stdin, stdout, stderr files - * - * Newlib will automatically associate the files with these - * (it hardcodes the numbers) + * Use the shared bsp_postdriver_hook() implementation */ -void -bsp_postdriver_hook(void) -{ - int stdin_fd, stdout_fd, stderr_fd; - int error_code; - - error_code = 'S' << 24 | 'T' << 16; - - if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1) - rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' ); - - if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1) - rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' ); - - if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1) - rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' ); - - if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) - rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' ); -} +void bsp_postdriver_hook(void); void bsp_start( void ) { diff --git a/c/src/lib/libbsp/i386/go32/startup/Makefile.in b/c/src/lib/libbsp/i386/go32/startup/Makefile.in index a974a158f5..86a047cec5 100644 --- a/c/src/lib/libbsp/i386/go32/startup/Makefile.in +++ b/c/src/lib/libbsp/i386/go32/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspstart sbrk setvec +C_PIECES=bsppost bspstart sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/i386/go32/startup/bspstart.c b/c/src/lib/libbsp/i386/go32/startup/bspstart.c index 6f9521a807..3e1498b426 100644 --- a/c/src/lib/libbsp/i386/go32/startup/bspstart.c +++ b/c/src/lib/libbsp/i386/go32/startup/bspstart.c @@ -27,7 +27,6 @@ #include <zilog/z8036.h> #include <string.h> -#include <fcntl.h> #ifdef STACK_CHECKER_ON #include <stackchk.h> @@ -118,33 +117,10 @@ bsp_pretasking_hook(void) /* - * After drivers are setup, register some "filenames" - * and open stdin, stdout, stderr files - * - * Newlib will automatically associate the files with these - * (it hardcodes the numbers) + * Use the shared bsp_postdriver_hook() implementation */ -void -bsp_postdriver_hook(void) -{ - int stdin_fd, stdout_fd, stderr_fd; - int error_code; - - error_code = 'S' << 24 | 'T' << 16; - - if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1) - rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' ); - - if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1) - rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' ); - - if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1) - rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' ); - - if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) - rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' ); -} +void bsp_postdriver_hook(void); /* This is the original command line passed from DOS */ char ** Go32_Argv; diff --git a/c/src/lib/libbsp/i386/pc386/startup/Makefile.in b/c/src/lib/libbsp/i386/pc386/startup/Makefile.in index 957411a4fb..cf3371536c 100644 --- a/c/src/lib/libbsp/i386/pc386/startup/Makefile.in +++ b/c/src/lib/libbsp/i386/pc386/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bspstart exit irq main sbrk +C_PIECES=bspclean bsppost bspstart exit irq main sbrk C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c index 8b670357c1..b6035400db 100644 --- a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c +++ b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c @@ -34,8 +34,6 @@ +--------------------------------------------------------------------------*/ -#include <fcntl.h> - #include <bsp.h> #include <libcsupport.h> #include <rtems/libio.h> @@ -136,38 +134,11 @@ bsp_pretasking_hook(void) } /* bsp_pretasking_hook */ -/*-------------------------------------------------------------------------+ -| Function: bsp_postdriver_hook -| Description: After drivers are setup, register some "filenames" and open -| stdin, stdout, stderr files. Newlib will automatically -| associate the files with these (it hardcodes the numbers). -| Global Variables: None. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -void -bsp_postdriver_hook(void) -{ - int stdin_fd, stdout_fd, stderr_fd; - - rtems_status_code error_code; - - error_code = 'S' << 24 | 'T' << 16; - - /* open standard devices: stdout, stderr and stdin */ - - if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) < 0) - rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' ); - - if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) < 0) - rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' ); - - if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) < 1) - rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' ); +/* + * Use the shared bsp_postdriver_hook() implementation + */ - if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) - rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' ); -} /* bsp_postdriver_hook */ +void bsp_postdriver_hook(void); /*-------------------------------------------------------------------------+ |