OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [shared/] [bsppost.c] - Blame information for rev 30

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: bsppost.c,v 1.2 2001-09-27 12:01:12 chris Exp $
11
 */
12
 
13
#include <rtems.h>
14
#include <rtems/libio.h>
15
#include <fcntl.h>
16
 
17
void
18
bsp_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
}
37
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.