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.2 by cebix, 1999-10-14T11:37:46Z vs.
Revision 1.8 by cebix, 2001-04-08T12:21:46Z

# 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  
# Line 208 | Line 208 | int16 XSERDPort::Open(uint16 config)
208          configure(config);
209  
210          // Start input/output threads
211 +        input_thread_cancel = false;
212 +        output_thread_cancel = false;
213          if (sem_init(&input_signal, 0, 0) < 0)
214                  goto open_error;
215          if (sem_init(&output_signal, 0, 0) < 0)
# Line 238 | Line 240 | open_error:
240                  output_thread_active = false;
241          }
242          if (fd > 0) {
243 <                close(fd);
243 >                ::close(fd);
244                  fd = -1;
245          }
246          return openErr;
# Line 249 | Line 251 | open_error:
251   *  Read data from port
252   */
253  
254 < int16 XSERDPort::PrimeIn(uint32 pb, uint32 dce)
254 > int16 XSERDPort::prime_in(uint32 pb, uint32 dce)
255   {
256          // Send input command to input_thread
257          read_done = false;
# Line 265 | Line 267 | int16 XSERDPort::PrimeIn(uint32 pb, uint
267   *  Write data to port
268   */
269  
270 < int16 XSERDPort::PrimeOut(uint32 pb, uint32 dce)
270 > int16 XSERDPort::prime_out(uint32 pb, uint32 dce)
271   {
272          // Send output command to output_thread
273          write_done = false;
# Line 281 | Line 283 | int16 XSERDPort::PrimeOut(uint32 pb, uin
283   *      Control calls
284   */
285  
286 < int16 XSERDPort::Control(uint32 pb, uint32 dce, uint16 code)
286 > int16 XSERDPort::control(uint32 pb, uint32 dce, uint16 code)
287   {
288          switch (code) {
289                  case 1:                 // KillIO
# Line 446 | Line 448 | int16 XSERDPort::Control(uint32 pb, uint
448   *      Status calls
449   */
450  
451 < int16 XSERDPort::Status(uint32 pb, uint32 dce, uint16 code)
451 > int16 XSERDPort::status(uint32 pb, uint32 dce, uint16 code)
452   {
453          switch (code) {
454                  case kSERDInputCount: {
# Line 493 | Line 495 | int16 XSERDPort::Status(uint32 pb, uint3
495   *      Close serial port
496   */
497  
498 < int16 XSERDPort::Close()
498 > int16 XSERDPort::close()
499   {
500          // Kill threads
501          if (input_thread_active) {
# Line 513 | Line 515 | int16 XSERDPort::Close()
515  
516          // Close port
517          if (fd > 0)
518 <                close(fd);
518 >                ::close(fd);
519          fd = -1;
520          return noErr;
521   }
# Line 663 | Line 665 | void *XSERDPort::input_func(void *arg)
665                  // KillIO called? Then simply return
666                  if (s->io_killed) {
667  
668 <                        WriteMacInt16(s->input_pb + ioResult, abortErr);
668 >                        WriteMacInt16(s->input_pb + ioResult, uint16(abortErr));
669                          WriteMacInt32(s->input_pb + ioActCount, 0);
670                          s->read_pending = s->read_done = false;
671  
# Line 675 | Line 677 | void *XSERDPort::input_func(void *arg)
677                                  WriteMacInt32(s->input_dt + serdtResult, noErr);
678                          } else {
679                                  WriteMacInt32(s->input_pb + ioActCount, 0);
680 <                                WriteMacInt32(s->input_dt + serdtResult, readErr);
680 >                                WriteMacInt32(s->input_dt + serdtResult, uint16(readErr));
681                          }
682          
683                          // Trigger serial interrupt
# Line 723 | Line 725 | void *XSERDPort::output_func(void *arg)
725                  // KillIO called? Then simply return
726                  if (s->io_killed) {
727  
728 <                        WriteMacInt16(s->output_pb + ioResult, abortErr);
728 >                        WriteMacInt16(s->output_pb + ioResult, uint16(abortErr));
729                          WriteMacInt32(s->output_pb + ioActCount, 0);
730                          s->write_pending = s->write_done = false;
731  
# Line 735 | Line 737 | void *XSERDPort::output_func(void *arg)
737                                  WriteMacInt32(s->output_dt + serdtResult, noErr);
738                          } else {
739                                  WriteMacInt32(s->output_pb + ioActCount, 0);
740 <                                WriteMacInt32(s->output_dt + serdtResult, writErr);
740 >                                WriteMacInt32(s->output_dt + serdtResult, uint16(writErr));
741                          }
742          
743                          // Trigger serial interrupt

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines