|
|
1.1 root 1: #include "of1275.h"
2:
3: static int of_write_initialized = 0;
4: static int stdout_ihandle = 0;
5: static int of_read_initialized = 0;
6: static int stdin_ihandle = 0;
7:
8: int write(int fd, char *buf, int len)
9: {
10: int actual;
11:
12: if (fd != 1 && fd != 2) {
13: // printk("write: bad id %x\n", fd);
14: exit(1);
15: }
16:
17: if (!of_write_initialized) {
18: stdout_ihandle =
19: of_find_integer_property("/chosen", "stdout");
20: // printk("stdout_ihandle: %x\n",stdout_ihandle);
21: of_write_initialized = 1;
22: }
23:
24: of1275_write(stdout_ihandle, buf, len, &actual);
25: return actual;
26: }
27:
28: int read(int fd, char *buf, int len)
29: {
30: int actual;
31:
32: if (fd != 0) {
33: // printk("write: bad id %x\n", fd);
34: exit(1);
35: }
36:
37: if (!of_read_initialized) {
38: stdin_ihandle =
39: of_find_integer_property("/chosen", "stdin");
40: of_read_initialized = 1;
41: }
42:
43: of1275_read(stdin_ihandle, buf, len, &actual);
44: return actual;
45: }
46:
47: exit(int status)
48: {
49: of1275_exit(status);
50: while (1);
51: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.