This source file includes following definitions.
- prom_nbgetchar
- prom_nbputchar
- prom_getchar
- prom_putchar
1
2
3
4
5
6
7 #include <asm/openprom.h>
8 #include <asm/oplib.h>
9
10
11
12
13 int
14 prom_nbgetchar(void)
15 {
16 static char inc;
17
18 switch(prom_vers) {
19 case PROM_V0:
20 return (*(romvec->pv_nbgetchar))();
21 break;
22 case PROM_V2:
23 case PROM_V3:
24 case PROM_P1275:
25 if( (*(romvec->pv_v2devops).v2_dev_read)(*romvec->pv_v2bootargs.fd_stdin , &inc, 0x1) == 1)
26 return inc;
27 return -1;
28 break;
29 };
30 return 0;
31 }
32
33
34
35
36 int
37 prom_nbputchar(char c)
38 {
39 static char outc;
40
41 switch(prom_vers) {
42 case PROM_V0:
43 return (*(romvec->pv_nbputchar))(c);
44 break;
45 case PROM_V2:
46 case PROM_V3:
47 case PROM_P1275:
48 outc = c;
49 if( (*(romvec->pv_v2devops).v2_dev_write)(*romvec->pv_v2bootargs.fd_stdout, &outc, 0x1) == 1)
50 return 0;
51 return -1;
52 break;
53 };
54 return 0;
55 }
56
57
58 char
59 prom_getchar(void)
60 {
61 int character;
62 while((character = prom_nbgetchar()) == -1) ;
63 return (char) character;
64 }
65
66
67 void
68 prom_putchar(char c)
69 {
70 while(prom_nbputchar(c) == -1) ;
71 return;
72 }
73