/[cebix]/SheepShaver/src/serial.cpp
ViewVC logotype

Diff of /SheepShaver/src/serial.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by cebix, Mon Feb 4 16:58:13 2002 UTC revision 1.4 by gbeauche, Sun Dec 19 09:01:04 2004 UTC
# Line 1  Line 1 
1  /*  /*
2   *  serial.cpp - Serial device driver   *  serial.cpp - Serial device driver
3   *   *
4   *  SheepShaver (C) 1997-2002 Marc Hellwig and Christian Bauer   *  SheepShaver (C) 1997-2004 Marc Hellwig and Christian Bauer
5   *   *
6   *  This program is free software; you can redistribute it and/or modify   *  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   *  it under the terms of the GNU General Public License as published by
# Line 32  Line 32 
32  SERDPort *the_serd_port[2];  SERDPort *the_serd_port[2];
33    
34  // Function pointers from imported functions  // Function pointers from imported functions
35  typedef int16 (*iocommandiscomplete_ptr)(uint32, int16);  typedef int16 (*iocic_ptr)(uint32, int16);
36  static iocommandiscomplete_ptr IOCommandIsComplete;  static uint32 iocic_tvect = 0;
37    static inline int16 IOCommandIsComplete(uint32 arg1, int16 arg2)
38    {
39            return (int16)CallMacOS2(iocic_ptr, iocic_tvect, arg1, arg2);
40    }
41    
42    
43  /*  /*
# Line 55  int16 SerialOpen(uint32 pb, uint32 dce) Line 59  int16 SerialOpen(uint32 pb, uint32 dce)
59          D(bug("SerialOpen pb %08lx, dce %08lx\n", pb, dce));          D(bug("SerialOpen pb %08lx, dce %08lx\n", pb, dce));
60    
61          // Get IOCommandIsComplete function          // Get IOCommandIsComplete function
62          IOCommandIsComplete = (iocommandiscomplete_ptr)FindLibSymbol("\021DriverServicesLib", "\023IOCommandIsComplete");          iocic_tvect = FindLibSymbol("\021DriverServicesLib", "\023IOCommandIsComplete");
63          D(bug("IOCommandIsComplete TVECT at %08lx\n", (uint32)IOCommandIsComplete));          D(bug("IOCommandIsComplete TVECT at %08lx\n", iocic_tvect));
64          if (IOCommandIsComplete == NULL) {          if (iocic_tvect == 0) {
65                  printf("FATAL: SerialOpen(): Can't find IOCommandIsComplete()\n");                  printf("FATAL: SerialOpen(): Can't find IOCommandIsComplete()\n");
66                  return openErr;                  return openErr;
67          }          }
# Line 78  int16 SerialOpen(uint32 pb, uint32 dce) Line 82  int16 SerialOpen(uint32 pb, uint32 dce)
82                  return res;                  return res;
83    
84          // Allocate Deferred Task structures          // Allocate Deferred Task structures
85          uint32 input_dt = the_port->input_dt = (uint32)the_port->dt_store;          if ((the_port->dt_store = Mac_sysalloc(SIZEOF_serdt * 2)) == 0)
86          uint32 output_dt = the_port->output_dt = (uint32)the_port->dt_store + SIZEOF_serdt;                  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));          D(bug(" input_dt %08lx, output_dt %08lx\n", input_dt, output_dt));
90    
91          WriteMacInt16(input_dt + qType, dtQType);          WriteMacInt16(input_dt + qType, dtQType);
# Line 266  int16 SerialClose(uint32 pb, uint32 dce) Line 272  int16 SerialClose(uint32 pb, uint32 dce)
272          // Close port if open          // Close port if open
273          SERDPort *the_port = the_serd_port[(-(int16)ReadMacInt16(dce + dCtlRefNum)-6) >> 1];          SERDPort *the_port = the_serd_port[(-(int16)ReadMacInt16(dce + dCtlRefNum)-6) >> 1];
274          if (the_port->is_open) {          if (the_port->is_open) {
275                    Mac_sysfree(the_port->dt_store);
276                  int16 res = the_port->close();                  int16 res = the_port->close();
277                  the_port->is_open = false;                  the_port->is_open = false;
278                  return res;                  return res;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

Christian Bauer">Christian Bauer
ViewVC Help
Powered by ViewVC 1.1.15