source: rtems/c/src/lib/libbsp/shared/bsppost.c @ 6128a4a

4.104.114.84.9
Last change on this file since 6128a4a was 6128a4a, checked in by Ralf Corsepius <ralf.corsepius@…>, on Apr 21, 2004 at 10:43:04 AM

Remove stray white spaces.

  • Property mode set to 100644
File size: 947 bytes
Line 
1/*
2 *  This is a basic BSP post driver hook.
3 *
4 * After drivers are setup, register some "filenames"
5 * and open stdin, stdout, stderr files
6 *
7 * Newlib will automatically associate the files with these
8 * (it hardcodes the numbers)
9 *
10 *  $Id$
11 */
12
13#include <rtems.h>
14#include <rtems/libio.h>
15#include <fcntl.h>
16
17void
18bsp_postdriver_hook(void)
19{
20  int stdin_fd, stdout_fd, stderr_fd;
21  int error_code;
22
23  error_code = 'S' << 24 | 'T' << 16;
24
25  if ((stdin_fd = open("/dev/console", O_RDONLY, 0)) == -1)
26    rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
27
28  if ((stdout_fd = open("/dev/console", O_WRONLY, 0)) == -1)
29    rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
30
31  if ((stderr_fd = open("/dev/console", O_WRONLY, 0)) == -1)
32    rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
33
34  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
35    rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
36}
Note: See TracBrowser for help on using the repository browser.