ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/dummy/serial_dummy.cpp
Revision: 1.1
Committed: 1999-10-03T14:16:26Z (24 years, 7 months ago) by cebix
Branch: MAIN
Branch point for: cebix
Log Message:
Initial revision

File Contents

# Content
1 /*
2 * serial_dummy.cpp - Serial device driver, dummy implementation
3 *
4 * Basilisk II (C) 1997-1999 Christian Bauer
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program 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 this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #include "sysdeps.h"
22 #include "cpu_emulation.h"
23 #include "main.h"
24 #include "macos_util.h"
25 #include "prefs.h"
26 #include "serial.h"
27 #include "serial_defs.h"
28
29 #define DEBUG 0
30 #include "debug.h"
31
32
33 // Driver private variables
34 class DSERDPort : public SERDPort {
35 public:
36 DSERDPort(const char *dev)
37 {
38 device_name = (char *)dev;
39 }
40
41 virtual ~DSERDPort()
42 {
43 }
44
45 virtual int16 Open(uint16 config);
46 virtual int16 PrimeIn(uint32 pb, uint32 dce);
47 virtual int16 PrimeOut(uint32 pb, uint32 dce);
48 virtual int16 Control(uint32 pb, uint32 dce, uint16 code);
49 virtual int16 Status(uint32 pb, uint32 dce, uint16 code);
50 virtual int16 Close(void);
51
52 private:
53 char *device_name; // Device name
54 };
55
56
57 /*
58 * Initialization
59 */
60
61 void SerialInit(void)
62 {
63 // Read serial preferences and create structs for both ports
64 the_serd_port[0] = new DSERDPort(PrefsFindString("seriala"));
65 the_serd_port[1] = new DSERDPort(PrefsFindString("serialb"));
66 }
67
68
69 /*
70 * Deinitialization
71 */
72
73 void SerialExit(void)
74 {
75 delete (DSERDPort *)the_serd_port[0];
76 delete (DSERDPort *)the_serd_port[1];
77 }
78
79
80 /*
81 * Open serial port
82 */
83
84 int16 DSERDPort::Open(uint16 config)
85 {
86 return openErr;
87 }
88
89
90 /*
91 * Read data from port
92 */
93
94 int16 DSERDPort::PrimeIn(uint32 pb, uint32 dce)
95 {
96 return readErr;
97 }
98
99
100 /*
101 * Write data to port
102 */
103
104 int16 DSERDPort::PrimeOut(uint32 pb, uint32 dce)
105 {
106 return writErr;
107 }
108
109
110 /*
111 * Control calls
112 */
113
114 int16 DSERDPort::Control(uint32 pb, uint32 dce, uint16 code)
115 {
116 return controlErr;
117 }
118
119
120 /*
121 * Status calls
122 */
123
124 int16 DSERDPort::Status(uint32 pb, uint32 dce, uint16 code)
125 {
126 return statusErr;
127 }
128
129
130 /*
131 * Close serial port
132 */
133
134 int16 DSERDPort::Close()
135 {
136 return noErr;
137 }