⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bsppost.c

📁 RTEMS (Real-Time Executive for Multiprocessor Systems) is a free open source real-time operating sys
💻 C
字号:
/* *  This is a basic BSP post driver hook.  * * 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) * *  $Id: bsppost.c,v 1.2 1998/11/23 19:07:44 joel Exp $ */#include <rtems.h>#include <rtems/libio.h>#include <fcntl.h>voidbsp_postdriver_hook(void){  int stdin_fd, stdout_fd, stderr_fd;  int error_code;  error_code = 'S' << 24 | 'T' << 16;  if ((stdin_fd = open("/dev/console", O_RDONLY, 0)) == -1)    rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );  if ((stdout_fd = open("/dev/console", O_WRONLY, 0)) == -1)    rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );  if ((stderr_fd = 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' );}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -