source: rtems/c/src/lib/libc/newlibif.c @ 9deb5b8b

4.104.114.84.95
Last change on this file since 9deb5b8b was 9deb5b8b, checked in by Joel Sherrill <joel.sherrill@…>, on 08/01/97 at 18:12:11

Katsutoshi Shibuya (shibuya@…)of BU-Denken Co., Ltd.
(Sapporo, Japan) submitted the extended console driver for the
MVME162LX BSP and the POSIX tcsetattr() and tcgetattr() routines.
This device driver supports four serial ports, cooked IO, and
provides a portable base for Zilog 8530 based console drivers.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1
2/*
3 *  This file contains the glue which maps newlib system calls onto their
4 *  RTEMS implementations.  This formerly was in the file
5 *  libgloss/rtems/iface.c which was installed as rtems.o.  Merging this
6 *  into the RTEMS source tree minimizes the files which must be linked
7 *  to build an rtems application.
8 *
9 *  $Id$
10 *
11 */
12
13#include <rtems.h>
14#if defined(RTEMS_NEWLIB)
15
16#include <sys/types.h>
17#include <sys/stat.h>
18#include <errno.h>
19
20#include "internal.h"
21#include "libio.h"
22
23int
24read(int fd,
25     char *buf,
26     int nbytes)
27{
28    return __rtems_read(fd, buf, nbytes);
29}
30
31int
32write(int fd,
33      char *buf,
34      int nbytes)
35{
36    return __rtems_write(fd, buf, nbytes);
37}
38
39int
40open(char *buf,
41     int flags,
42     int mode)
43{
44    return __rtems_open(buf, flags, mode);
45}
46
47int
48close(int fd)
49{
50    return __rtems_close(fd);
51}
52
53/*
54 * isatty -- returns 1 if connected to a terminal device,
55 *           returns 0 if not.
56 */
57int
58isatty(int fd)
59{
60    return __rtems_isatty(fd);
61}
62
63/*
64 * lseek -- move read/write pointer. Since a serial port
65 *          is non-seekable, we return an error.
66 */
67off_t
68lseek(int fd,
69      off_t offset,
70      int whence)
71{
72    return __rtems_lseek(fd, offset, whence);
73}
74
75/*
76 * fstat -- get status of a file. Since we have no file
77 *          system, we just return an error.
78 */
79int
80fstat(int fd,
81      struct stat *buf)
82{
83    return __rtems_fstat(fd, buf);
84}
85
86/*
87 *  getpid and kill are provided directly by rtems
88 */
89
90/*
91 * ioctl -- IO control
92 */
93
94int
95ioctl(int fd, int request, void *argp)
96{
97    return __rtems_ioctl(fd,request,argp);
98}
99
100/*
101 * tcgetattr/tcsetattr -- get/set attributes of a device.
102 *
103 * by K.Shibuya
104 */
105
106int
107tcgetattr(int fd, struct termios *tp)
108{
109    return __rtems_ioctl(fd,RTEMS_IO_GET_ATTRIBUTES,tp);
110}
111
112int
113tcsetattr(int fd, int opt, struct termios *tp)
114{
115    if(opt != TCSANOW)
116      return -1;
117    return __rtems_ioctl(fd,RTEMS_IO_SET_ATTRIBUTES,tp);
118}
119
120#endif
Note: See TracBrowser for help on using the repository browser.