And now AVox output works in Linux. I can't believe the stupid mistake

I was making, shadowing an instance variable with a local one.  I must
be losing it :)


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1464 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-04-11 01:28:35 +00:00
parent b508d668c2
commit de5a387f47
4 changed files with 42 additions and 13 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: AtariVox.cxx,v 1.11 2008-04-11 00:29:15 stephena Exp $
// $Id: AtariVox.cxx,v 1.12 2008-04-11 01:28:35 stephena Exp $
//============================================================================
#ifdef SPEAKJET_EMULATION
@ -38,7 +38,6 @@ AtariVox::AtariVox(Jack jack, const Event& event, const SerialPort& port)
#ifdef SPEAKJET_EMULATION
mySpeakJet = new SpeakJet();
#endif
mySerialPort->openPort("", -1, -1, -1, -1);
myDigitalPinState[One] = myDigitalPinState[Two] =
@ -53,7 +52,6 @@ AtariVox::~AtariVox()
#ifdef SPEAKJET_EMULATION
delete mySpeakJet;
#endif
mySerialPort->closePort();
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: M6502Hi.cxx,v 1.21 2008-02-06 13:45:22 stephena Exp $
// $Id: M6502Hi.cxx,v 1.22 2008-04-11 01:28:35 stephena Exp $
//============================================================================
#include "M6502Hi.hxx"
@ -62,7 +62,6 @@ inline uInt8 M6502High::peek(uInt16 address)
}
#endif
uInt8 result = mySystem->peek(address);
myLastAccessWasRead = true;
return result;

View File

@ -13,14 +13,23 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SerialPortUNIX.cxx,v 1.2 2008-04-09 17:19:15 stephena Exp $
// $Id: SerialPortUNIX.cxx,v 1.3 2008-04-11 01:28:35 stephena Exp $
//============================================================================
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/termios.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include "SerialPortUNIX.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SerialPortUNIX::SerialPortUNIX()
: SerialPort()
: SerialPort(),
myHandle(0)
{
}
@ -33,17 +42,36 @@ SerialPortUNIX::~SerialPortUNIX()
bool SerialPortUNIX::openPort(const string& device, int baud, int data,
int stop, int parity)
{
return false;
myHandle = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NONBLOCK);
if(myHandle <= 0)
return false;
struct termios termios;
memset(&termios, 0, sizeof(struct termios));
termios.c_cflag = CREAD | CLOCAL;
termios.c_cflag |= B19200;
termios.c_cflag |= CS8;
tcflush(myHandle, TCIFLUSH);
tcsetattr(myHandle, TCSANOW, &termios);
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SerialPortUNIX::closePort()
{
if(myHandle)
close(myHandle);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SerialPortUNIX::writeByte(const uInt8 data)
bool SerialPortUNIX::writeByte(const uInt8* data)
{
cerr << "SerialPortUNIX::writeByte " << (int)data << endl;
if(myHandle)
{
// cerr << "SerialPortUNIX::writeByte " << (int)(*data) << endl;
return write(myHandle, data, 1) == 1;
}
return false;
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SerialPortUNIX.hxx,v 1.2 2008-04-09 17:19:16 stephena Exp $
// $Id: SerialPortUNIX.hxx,v 1.3 2008-04-11 01:28:35 stephena Exp $
//============================================================================
#ifndef SERIALPORT_UNIX_HXX
@ -26,7 +26,7 @@
it seems to be Linux-only, and reading isn't actually supported at all.
@author Stephen Anthony
@version $Id: SerialPortUNIX.hxx,v 1.2 2008-04-09 17:19:16 stephena Exp $
@version $Id: SerialPortUNIX.hxx,v 1.3 2008-04-11 01:28:35 stephena Exp $
*/
class SerialPortUNIX : public SerialPort
{
@ -58,7 +58,11 @@ class SerialPortUNIX : public SerialPort
@param data The byte to write to the port
@return True if a byte was written, else false
*/
bool writeByte(const uInt8 data);
bool writeByte(const uInt8* data);
private:
// File descriptor for serial connection
int myHandle;
};
#endif