1 |
/* |
2 |
* serial_dummy.cpp - Serial device driver, dummy implementation |
3 |
* |
4 |
* Basilisk II (C) 1997-2000 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 prime_in(uint32 pb, uint32 dce); |
47 |
virtual int16 prime_out(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::prime_in(uint32 pb, uint32 dce) |
95 |
{ |
96 |
return readErr; |
97 |
} |
98 |
|
99 |
|
100 |
/* |
101 |
* Write data to port |
102 |
*/ |
103 |
|
104 |
int16 DSERDPort::prime_out(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 |
} |