ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/serial_unix.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/serial_unix.cpp (file contents):
Revision 1.1 by cebix, 1999-10-03T14:16:25Z vs.
Revision 1.7 by cebix, 2001-02-02T20:52:58Z

# Line 1 | Line 1
1   /*
2   *  serial_unix.cpp - Serial device driver, Unix specific stuff
3   *
4 < *  Basilisk II (C) 1997-1999 Christian Bauer
4 > *  Basilisk II (C) 1997-2001 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
# Line 101 | Line 101 | public:
101                  }
102          }
103  
104 <        virtual int16 Open(uint16 config);
105 <        virtual int16 PrimeIn(uint32 pb, uint32 dce);
106 <        virtual int16 PrimeOut(uint32 pb, uint32 dce);
107 <        virtual int16 Control(uint32 pb, uint32 dce, uint16 code);
108 <        virtual int16 Status(uint32 pb, uint32 dce, uint16 code);
109 <        virtual int16 Close(void);
104 >        virtual int16 open(uint16 config);
105 >        virtual int16 prime_in(uint32 pb, uint32 dce);
106 >        virtual int16 prime_out(uint32 pb, uint32 dce);
107 >        virtual int16 control(uint32 pb, uint32 dce, uint16 code);
108 >        virtual int16 status(uint32 pb, uint32 dce, uint16 code);
109 >        virtual int16 close(void);
110  
111   private:
112          bool configure(uint16 config);
# Line 166 | Line 166 | void SerialExit(void)
166   *  Open serial port
167   */
168  
169 < int16 XSERDPort::Open(uint16 config)
169 > int16 XSERDPort::open(uint16 config)
170   {
171          // Don't open NULL name devices
172          if (device_name == NULL)
# Line 177 | Line 177 | int16 XSERDPort::Open(uint16 config)
177          quitting = false;
178  
179          // Open port
180 <        fd = open(device_name, O_RDWR);
180 >        fd = ::open(device_name, O_RDWR);
181          if (fd < 0)
182                  goto open_error;
183  
184 < #ifdef __linux__
184 > #if defined(__linux__)
185          // Parallel port?
186          struct stat st;
187          if (fstat(fd, &st) == 0)
188                  if (S_ISCHR(st.st_mode))
189                          is_parallel = (MAJOR(st.st_rdev) == LP_MAJOR);
190 < #elif defined(__FreeBSD__)
190 > #elif defined(__FreeBSD__) || defined(__NetBSD__)
191          // Parallel port?
192          struct stat st;
193          if (fstat(fd, &st) == 0)
# Line 238 | Line 238 | open_error:
238                  output_thread_active = false;
239          }
240          if (fd > 0) {
241 <                close(fd);
241 >                ::close(fd);
242                  fd = -1;
243          }
244          return openErr;
# Line 249 | Line 249 | open_error:
249   *  Read data from port
250   */
251  
252 < int16 XSERDPort::PrimeIn(uint32 pb, uint32 dce)
252 > int16 XSERDPort::prime_in(uint32 pb, uint32 dce)
253   {
254          // Send input command to input_thread
255          read_done = false;
# Line 265 | Line 265 | int16 XSERDPort::PrimeIn(uint32 pb, uint
265   *  Write data to port
266   */
267  
268 < int16 XSERDPort::PrimeOut(uint32 pb, uint32 dce)
268 > int16 XSERDPort::prime_out(uint32 pb, uint32 dce)
269   {
270          // Send output command to output_thread
271          write_done = false;
# Line 281 | Line 281 | int16 XSERDPort::PrimeOut(uint32 pb, uin
281   *      Control calls
282   */
283  
284 < int16 XSERDPort::Control(uint32 pb, uint32 dce, uint16 code)
284 > int16 XSERDPort::control(uint32 pb, uint32 dce, uint16 code)
285   {
286          switch (code) {
287                  case 1:                 // KillIO
# Line 446 | Line 446 | int16 XSERDPort::Control(uint32 pb, uint
446   *      Status calls
447   */
448  
449 < int16 XSERDPort::Status(uint32 pb, uint32 dce, uint16 code)
449 > int16 XSERDPort::status(uint32 pb, uint32 dce, uint16 code)
450   {
451          switch (code) {
452                  case kSERDInputCount: {
# Line 493 | Line 493 | int16 XSERDPort::Status(uint32 pb, uint3
493   *      Close serial port
494   */
495  
496 < int16 XSERDPort::Close()
496 > int16 XSERDPort::close()
497   {
498          // Kill threads
499          if (input_thread_active) {
# Line 513 | Line 513 | int16 XSERDPort::Close()
513  
514          // Close port
515          if (fd > 0)
516 <                close(fd);
516 >                ::close(fd);
517          fd = -1;
518          return noErr;
519   }
# Line 663 | Line 663 | void *XSERDPort::input_func(void *arg)
663                  // KillIO called? Then simply return
664                  if (s->io_killed) {
665  
666 <                        WriteMacInt16(s->input_pb + ioResult, abortErr);
666 >                        WriteMacInt16(s->input_pb + ioResult, uint16(abortErr));
667                          WriteMacInt32(s->input_pb + ioActCount, 0);
668                          s->read_pending = s->read_done = false;
669  
# Line 675 | Line 675 | void *XSERDPort::input_func(void *arg)
675                                  WriteMacInt32(s->input_dt + serdtResult, noErr);
676                          } else {
677                                  WriteMacInt32(s->input_pb + ioActCount, 0);
678 <                                WriteMacInt32(s->input_dt + serdtResult, readErr);
678 >                                WriteMacInt32(s->input_dt + serdtResult, uint16(readErr));
679                          }
680          
681                          // Trigger serial interrupt
# Line 723 | Line 723 | void *XSERDPort::output_func(void *arg)
723                  // KillIO called? Then simply return
724                  if (s->io_killed) {
725  
726 <                        WriteMacInt16(s->output_pb + ioResult, abortErr);
726 >                        WriteMacInt16(s->output_pb + ioResult, uint16(abortErr));
727                          WriteMacInt32(s->output_pb + ioActCount, 0);
728                          s->write_pending = s->write_done = false;
729  
# Line 735 | Line 735 | void *XSERDPort::output_func(void *arg)
735                                  WriteMacInt32(s->output_dt + serdtResult, noErr);
736                          } else {
737                                  WriteMacInt32(s->output_pb + ioActCount, 0);
738 <                                WriteMacInt32(s->output_dt + serdtResult, writErr);
738 >                                WriteMacInt32(s->output_dt + serdtResult, uint16(writErr));
739                          }
740          
741                          // Trigger serial interrupt

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines