1 |
|
/* |
2 |
|
* serial.cpp - Serial device driver |
3 |
|
* |
4 |
< |
* SheepShaver (C) 1997-2004 Marc Hellwig and Christian Bauer |
4 |
> |
* SheepShaver (C) 1997-2005 Marc Hellwig and 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 |
59 |
|
D(bug("SerialOpen pb %08lx, dce %08lx\n", pb, dce)); |
60 |
|
|
61 |
|
// Get IOCommandIsComplete function |
62 |
< |
iocic_tvect = (uint32)FindLibSymbol("\021DriverServicesLib", "\023IOCommandIsComplete"); |
62 |
> |
iocic_tvect = FindLibSymbol("\021DriverServicesLib", "\023IOCommandIsComplete"); |
63 |
|
D(bug("IOCommandIsComplete TVECT at %08lx\n", iocic_tvect)); |
64 |
|
if (iocic_tvect == 0) { |
65 |
|
printf("FATAL: SerialOpen(): Can't find IOCommandIsComplete()\n"); |
82 |
|
return res; |
83 |
|
|
84 |
|
// Allocate Deferred Task structures |
85 |
< |
uint32 input_dt = the_port->input_dt = (uint32)the_port->dt_store; |
86 |
< |
uint32 output_dt = the_port->output_dt = (uint32)the_port->dt_store + SIZEOF_serdt; |
85 |
> |
if ((the_port->dt_store = Mac_sysalloc(SIZEOF_serdt * 2)) == 0) |
86 |
> |
return openErr; |
87 |
> |
uint32 input_dt = the_port->input_dt = the_port->dt_store; |
88 |
> |
uint32 output_dt = the_port->output_dt = the_port->dt_store + SIZEOF_serdt; |
89 |
|
D(bug(" input_dt %08lx, output_dt %08lx\n", input_dt, output_dt)); |
90 |
|
|
91 |
|
WriteMacInt16(input_dt + qType, dtQType); |
272 |
|
// Close port if open |
273 |
|
SERDPort *the_port = the_serd_port[(-(int16)ReadMacInt16(dce + dCtlRefNum)-6) >> 1]; |
274 |
|
if (the_port->is_open) { |
275 |
+ |
Mac_sysfree(the_port->dt_store); |
276 |
|
int16 res = the_port->close(); |
277 |
|
the_port->is_open = false; |
278 |
|
return res; |