source: rtems/c/src/lib/libbsp/shared/bsppost.c @ 8f95b5f

4.104.114.84.95
Last change on this file since 8f95b5f was 8f95b5f, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 30, 1998 at 2:01:19 PM

Moved bsp_postdriver_hook() to a shared file and made it a common
component.

  • Property mode set to 100644
File size: 973 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 = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
26    rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
27
28  if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
29    rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
30
31  if ((stderr_fd = __rtems_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}
37
Note: See TracBrowser for help on using the repository browser.