1 /* pro_maint.c: Maintenance terminal interface
2
3 Copyright (c) 1997-2003, Tarik Isani (xhomer@isani.org)
4
5 This file is part of Xhomer.
6
7 Xhomer is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2
9 as published by the Free Software Foundation.
10
11 Xhomer is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Xhomer; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21
22 /* This module implements the registers of the maintenance terminal
23 * interface. On a real Pro, this interface becomes available to
24 * software if pins 8 and 9 on the printer port are shorted. Here,
25 * shorting pins 8 and 9 is simulated by setting the "maint_mode"
26 * variable to "on" in the configuration file.
27 */
28
29
30 #ifdef PRO
31 #include "pdp11_defs.h"
32
33 int pro_maint_mode = 0; /* set to 1 if printer port is in maintenance mode */
34
35
36 /* Maintenance terminal registers */
37
pro_maint_rd(int pa)38 int pro_maint_rd (int pa)
39 {
40 int data;
41
42 /* Only allow access to these registers if the Pro is in maintenance mode */
43
44 if (pro_maint_mode == 1)
45 switch (pa & 06)
46 {
47
48 case 00:
49 /* Maintenance terminal receiver CSR (RCSR) */
50
51 data = (pro_ptr_rd(02) & PRO_2661_RD) ? PRO_MAINT_RD : 0;
52 break;
53
54 case 02:
55 /* Maintenance terminal receiver register (RBUF) */
56
57 data = pro_ptr_rd(00);
58 break;
59
60 case 04:
61 /* Maintenance terminal transmitter CSR (XCSR) */
62
63 data = (pro_ptr_rd(2) & PRO_2661_TR) ? PRO_MAINT_TR : 0;
64 break;
65
66 case 06:
67
68 /* Maintenance terminal transmitter register (write-only) */
69
70 data = 0;
71 break;
72
73 default:
74 data = 0;
75 break;
76 }
77 else
78 data = 0;
79
80 return data;
81 }
82
83
pro_maint_wr(int data,int pa,int access)84 void pro_maint_wr (int data, int pa, int access)
85 {
86 /* Only allow access to these registers if the Pro is in maintenance mode */
87
88 if (pro_maint_mode == 1)
89 switch (pa & 06)
90 {
91 case 00:
92 case 02:
93 case 04:
94 /* Maintenance terminal read-only registers */
95
96 break;
97
98 case 06:
99 /* Maintenance terminal transmitter register (XBUF) */
100
101 pro_ptr_wr(data, 00, access);
102 break;
103 }
104 }
105 #endif
106