Moved AtariVox support from experimental to full-fledged controller.

Made SpeakJet emulation be optional, because it's still a WIP and we'll
soon be able to have AVox support without it.

Added SerialPort infrastructure, which will implement serial port access
in a general way.  Those ports which don't wish to do so can simply not
implement a SerialPortXXX class; in that case a null SerialPort is used.

Still TODO is actually implement the serial port functionality for UNIX,
and add similar classes for OSX and Win32.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1454 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-03-31 00:59:30 +00:00
parent 5a50164c9c
commit 27dc5a60e2
15 changed files with 319 additions and 73 deletions

26
stella/configure vendored
View File

@ -27,7 +27,7 @@ _build_joystick=yes
_build_cheats=yes
_build_static=no
_build_profile=no
_build_atarivox=no
_build_speakjet=no
# more defaults
_ranlib=ranlib
@ -192,8 +192,8 @@ Optional Features:
--disable-joystick
--enable-cheats enable/disable cheatcode support [enabled]
--disable-cheats
--enable-atarivox enable/disable AtariVox support [disabled]
--disable-atarivox
--enable-speakjet enable/disable SpeakJet emulation [disabled]
--disable-speakjet
--enable-shared build shared binary [enabled]
--enable-static build static binary (if possible) [disabled]
--disable-static
@ -232,8 +232,8 @@ for ac_option in $@; do
--disable-joystick) _build_joystick=no ;;
--enable-cheats) _build_cheats=yes ;;
--disable-cheats) _build_cheats=no ;;
--enable-atarivox) _build_atarivox=yes ;;
--disable-atarivox) _build_atarivox=no ;;
--enable-speakjet) _build_speakjet=yes ;;
--disable-speakjet) _build_speakjet=no ;;
--enable-shared) _build_static=no ;;
--enable-static) _build_static=yes ;;
--disable-static) _build_static=no ;;
@ -612,11 +612,11 @@ else
echo
fi
if test "$_build_atarivox" = yes ; then
echo_n " AtariVox support enabled (not yet working)"
if test "$_build_speakjet" = yes ; then
echo_n " SpeakJet emulation enabled (not yet working)"
echo
else
echo_n " AtariVox support disabled (not yet working)"
echo_n " SpeakJet emulation disabled (not yet working)"
echo
fi
@ -651,7 +651,7 @@ DBG="$SRC/debugger"
DBGGUI="$SRC/debugger/gui"
YACC="$SRC/yacc"
CHEAT="$SRC/cheat"
ATARIVOX="$SRC/emucore/rsynth"
SPEAKJET="$SRC/emucore/rsynth"
INCLUDES="-I$CORE -I$CORE/m6502/src -I$CORE/m6502/src/bspf/src -I$COMMON -I$GUI"
@ -725,10 +725,10 @@ if test "$_build_cheats" = yes ; then
INCLUDES="$INCLUDES -I$CHEAT"
fi
if test "$_build_atarivox" = yes ; then
DEFINES="$DEFINES -DATARIVOX_SUPPORT"
MODULES="$MODULES $ATARIVOX"
INCLUDES="$INCLUDES -I$ATARIVOX"
if test "$_build_speakjet" = yes ; then
DEFINES="$DEFINES -DSPEAKJET_EMULATION"
MODULES="$MODULES $SPEAKJET"
INCLUDES="$INCLUDES -I$SPEAKJET"
fi
if test "$_build_profile" = no ; then

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: SoundSDL.cxx,v 1.41 2008-03-29 19:15:57 stephena Exp $
// $Id: SoundSDL.cxx,v 1.42 2008-03-31 00:59:30 stephena Exp $
//============================================================================
#ifdef SOUND_SUPPORT
@ -33,6 +33,9 @@
#include "Console.hxx"
#include "AtariVox.hxx"
#ifdef SPEAKJET_EMULATION
#include "SpeakJet.hxx"
#endif
#include "SoundSDL.hxx"
@ -408,7 +411,8 @@ void SoundSDL::callback(void* udata, uInt8* stream, int len)
{
SoundSDL* sound = (SoundSDL*)udata;
sound->processFragment(stream, (Int32)len);
#ifdef ATARIVOX_SUPPORT
#ifdef SPEAKJET_EMULATION
// cerr << "SoundSDL::callback(): len==" << len << endl;
// See if we need sound from the AtariVox

View File

@ -13,28 +13,31 @@
// 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.7 2008-03-29 19:15:57 stephena Exp $
// $Id: AtariVox.cxx,v 1.8 2008-03-31 00:59:30 stephena Exp $
//============================================================================
#ifdef ATARIVOX_SUPPORT
#ifdef SPEAKJET_EMULATION
#include "SpeakJet.hxx"
#endif
#include "Event.hxx"
#include "AtariVox.hxx"
#include "SpeakJet.hxx"
#include "SerialPort.hxx"
#include "System.hxx"
#include "AtariVox.hxx"
#define DEBUG_ATARIVOX 0
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AtariVox::AtariVox(Jack jack, const Event& event)
AtariVox::AtariVox(Jack jack, const Event& event, const SerialPort& port)
: Controller(jack, event, Controller::AtariVox),
mySpeakJet(0),
mySerialPort((SerialPort*)&port),
myPinState(0),
myShiftCount(0),
myShiftRegister(0),
myLastDataWriteCycle(0)
{
#ifdef SPEAKJET_EMULATION
mySpeakJet = new SpeakJet();
#endif
myDigitalPinState[One] = myDigitalPinState[Two] =
myDigitalPinState[Three] = myDigitalPinState[Four] = true;
@ -45,7 +48,9 @@ AtariVox::AtariVox(Jack jack, const Event& event)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AtariVox::~AtariVox()
{
#ifdef SPEAKJET_EMULATION
delete mySpeakJet;
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -167,11 +172,11 @@ void AtariVox::shiftIn(bool value)
else
{
uInt8 data = ((myShiftRegister >> 1) & 0xff);
cerr << "AtariVox: output byte " << ((int)(data)) << endl;
#ifdef SPEAKJET_EMULATION
mySpeakJet->write(data);
#endif
mySerialPort->write(data);
}
myShiftRegister = 0;
}
}
#endif

View File

@ -1,4 +1,3 @@
//============================================================================
//
// SSSS tt lll lll
@ -14,16 +13,16 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: AtariVox.hxx,v 1.9 2008-03-29 19:15:57 stephena Exp $
// $Id: AtariVox.hxx,v 1.10 2008-03-31 00:59:30 stephena Exp $
//============================================================================
#ifdef ATARIVOX_SUPPORT
#ifndef ATARIVOX_HXX
#define ATARIVOX_HXX
class SpeakJet;
#include "Control.hxx"
#include "SpeakJet.hxx"
#include "SerialPort.hxx"
/**
Richard Hutchinson's AtariVox "controller": A speech synthesizer and
@ -33,7 +32,7 @@
driver code.
@author B. Watson
@version $Id: AtariVox.hxx,v 1.9 2008-03-29 19:15:57 stephena Exp $
@version $Id: AtariVox.hxx,v 1.10 2008-03-31 00:59:30 stephena Exp $
*/
class AtariVox : public Controller
{
@ -44,7 +43,7 @@ class AtariVox : public Controller
@param jack The jack the controller is plugged into
@param event The event object to use for events
*/
AtariVox(Jack jack, const Event& event);
AtariVox(Jack jack, const Event& event, const SerialPort& port);
/**
Destructor
@ -68,7 +67,9 @@ class AtariVox : public Controller
*/
virtual void update();
#ifdef SPEAKJET_EMULATION
SpeakJet* getSpeakJet() { return mySpeakJet; }
#endif
private:
void clockDataIn(bool value);
@ -80,10 +81,15 @@ class AtariVox : public Controller
// property... or it may turn out to be unnecessary.
enum { TIMING_SLOP = 0 };
// Instance of an real serial port on the system
// Assuming there's a real AtariVox attached, we can send SpeakJet
// bytes directly to it
SerialPort* mySerialPort;
#ifdef SPEAKJET_EMULATION
// Instance of SpeakJet which will actually do the talking for us.
// In the future, we'll support both real and emulated SpeakJet
// chips; for now we only emulate it.
SpeakJet *mySpeakJet;
#endif
// State of the output pins
uInt8 myPinState;
@ -105,5 +111,3 @@ class AtariVox : public Controller
};
#endif
#endif // ATARIVOX_SUPPORT

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: Console.cxx,v 1.134 2008-03-29 19:15:57 stephena Exp $
// $Id: Console.cxx,v 1.135 2008-03-31 00:59:30 stephena Exp $
//============================================================================
#include <cassert>
@ -63,7 +63,7 @@
Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
: myOSystem(osystem),
myProperties(props),
vox(0),
myAVox(0),
myDisplayFormat("NTSC"),
myFramerate(60),
myUserPaletteDefined(false)
@ -147,13 +147,11 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
{
myControllers[rightPort] = new TrackBall22(Controller::Right, *myEvent);
}
#ifdef ATARIVOX_SUPPORT
else if(right == "ATARIVOX")
{
cerr << "atarivox added as right controller\n";
myControllers[rightPort] = vox = new AtariVox(Controller::Right, *myEvent);
myControllers[rightPort] = myAVox =
new AtariVox(Controller::Right, *myEvent, myOSystem->serialPort());
}
#endif
else
{
myControllers[rightPort] = new Joystick(Controller::Right, *myEvent);

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: Console.hxx,v 1.64 2008-02-06 13:45:21 stephena Exp $
// $Id: Console.hxx,v 1.65 2008-03-31 00:59:30 stephena Exp $
//============================================================================
#ifndef CONSOLE_HXX
@ -39,7 +39,7 @@ class System;
This class represents the entire game console.
@author Bradford W. Mott
@version $Id: Console.hxx,v 1.64 2008-02-06 13:45:21 stephena Exp $
@version $Id: Console.hxx,v 1.65 2008-03-31 00:59:30 stephena Exp $
*/
class Console : public Serializable
{
@ -242,9 +242,8 @@ class Console : public Serializable
void togglePFBit() const { toggleTIABit(TIA::PF, "PF"); }
void enableBits(bool enable) const;
#ifdef ATARIVOX_SUPPORT
AtariVox *atariVox() { return vox; }
#endif
// TODO - make the core code work without needing to access this
AtariVox* atariVox() { return myAVox; }
private:
void toggleTIABit(TIA::TIABit bit, const string& bitname, bool show = true) const;
@ -296,9 +295,7 @@ class Console : public Serializable
// A RIOT of my own! (...with apologies to The Clash...)
M6532 *myRiot;
#ifdef ATARIVOX_SUPPORT
AtariVox *vox;
#endif
AtariVox* myAVox;
// The currently defined display format (NTSC/PAL/SECAM)
string myDisplayFormat;

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: M6532.cxx,v 1.15 2008-03-29 19:15:57 stephena Exp $
// $Id: M6532.cxx,v 1.16 2008-03-31 00:59:30 stephena Exp $
//============================================================================
#include <assert.h>
@ -246,7 +246,12 @@ void M6532::poke(uInt16 addr, uInt8 value)
else if((addr & 0x07) == 0x01) // Port A Data Direction Register
{
myDDRA = value;
#ifdef ATARIVOX_SUPPORT
// TODO - Fix this properly in the core
// Any time the core code needs to know what type of controller
// is connected, it's by definition a bug
// A real Atari doesn't 'know' that an AVox is connected, so we
// shouldn't either
/*
20060608 bkw: Not the most elegant thing in the world...
When a bit in the DDR is set as input, +5V is placed on its output
@ -264,11 +269,6 @@ void M6532::poke(uInt16 addr, uInt8 value)
be able to drive the emulated AtariVox, even though it wouldn't
work on real hardware.
*/
// TODO - Fix this properly in the core
// Any time the core code needs to know what type of controller
// is connected, it's by definition a bug
// A real Atari doesn't 'know' that an AVox is connected, so we
// shouldn't either
Controller& c = myConsole.controller(Controller::Right);
if(c.type() == Controller::AtariVox)
{
@ -277,7 +277,6 @@ void M6532::poke(uInt16 addr, uInt8 value)
c.write(Controller::Three, !(value & 0x04));
c.write(Controller::Four, !(value & 0x08));
}
#endif
}
else if((addr & 0x07) == 0x02) // Port B I/O Register (Console switches)
{

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: OSystem.cxx,v 1.120 2008-03-30 15:01:38 stephena Exp $
// $Id: OSystem.cxx,v 1.121 2008-03-31 00:59:30 stephena Exp $
//============================================================================
#include <cassert>
@ -33,6 +33,15 @@
#include "CheatManager.hxx"
#endif
#include "SerialPort.hxx"
#if defined(UNIX)
#include "SerialPortUNIX.hxx"
//#elif defined(WIN32)
// #include "SerialPortWin32.hxx"
//#elif defined(MAC_OSX)
// #include "SerialPortMACOSX.hxx"
#endif
#include "FSNode.hxx"
#include "unzip.h"
#include "MD5.hxx"
@ -62,6 +71,7 @@ OSystem::OSystem()
mySettings(NULL),
myPropSet(NULL),
myConsole(NULL),
mySerialPort(NULL),
myMenu(NULL),
myCommandMenu(NULL),
myLauncher(NULL),
@ -153,6 +163,7 @@ OSystem::~OSystem()
delete myPropSet;
delete myEventHandler;
delete mySerialPort;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -204,6 +215,20 @@ bool OSystem::create()
// that only have a single sound device (no hardware mixing)
createSound();
// Create the serial port object
// This is used by any controller that wants to directly access
// a real serial port on the system
#if defined(UNIX)
mySerialPort = new SerialPortUNIX();
//#elif defined(WIN32)
// mySerialPort = new SerialPortWin32();
//#elif defined(MAC_OSX)
// mySerialPort = new SerialPortMACOSX();
#else
// Create an 'empty' serial port
mySerialPort = new SerialPort();
#endif
return true;
}

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: OSystem.hxx,v 1.63 2008-03-30 15:01:38 stephena Exp $
// $Id: OSystem.hxx,v 1.64 2008-03-31 00:59:30 stephena Exp $
//============================================================================
#ifndef OSYSTEM_HXX
@ -28,6 +28,7 @@ class Launcher;
class Menu;
class Properties;
class PropertiesSet;
class SerialPort;
class Settings;
class Sound;
class StateManager;
@ -55,7 +56,7 @@ typedef Common::Array<Resolution> ResolutionList;
other objects belong.
@author Stephen Anthony
@version $Id: OSystem.hxx,v 1.63 2008-03-30 15:01:38 stephena Exp $
@version $Id: OSystem.hxx,v 1.64 2008-03-31 00:59:30 stephena Exp $
*/
class OSystem
{
@ -126,35 +127,42 @@ class OSystem
@return The console object
*/
inline Console& console(void) const { return *myConsole; }
inline Console& console() const { return *myConsole; }
/**
Get the serial port of the system.
@return The serial port object
*/
inline SerialPort& serialPort() const { return *mySerialPort; }
/**
Get the settings menu of the system.
@return The settings menu object
*/
inline Menu& menu(void) const { return *myMenu; }
inline Menu& menu() const { return *myMenu; }
/**
Get the command menu of the system.
@return The command menu object
*/
inline CommandMenu& commandMenu(void) const { return *myCommandMenu; }
inline CommandMenu& commandMenu() const { return *myCommandMenu; }
/**
Get the ROM launcher of the system.
@return The launcher object
*/
inline Launcher& launcher(void) const { return *myLauncher; }
inline Launcher& launcher() const { return *myLauncher; }
/**
Get the state manager of the system.
@return The statemanager object
*/
inline StateManager& state(void) const { return *myStateManager; }
inline StateManager& state() const { return *myStateManager; }
#ifdef DEBUGGER_SUPPORT
/**
@ -162,7 +170,7 @@ class OSystem
@return The debugger object
*/
inline Debugger& debugger(void) const { return *myDebugger; }
inline Debugger& debugger() const { return *myDebugger; }
#endif
#ifdef CHEATCODE_SUPPORT
@ -171,7 +179,7 @@ class OSystem
@return The cheatmanager object
*/
inline CheatManager& cheat(void) const { return *myCheatManager; }
inline CheatManager& cheat() const { return *myCheatManager; }
#endif
/**
@ -456,6 +464,9 @@ class OSystem
// Pointer to the (currently defined) Console object
Console* myConsole;
// Pointer to the serial port object
SerialPort* mySerialPort;
// Pointer to the Menu object
Menu* myMenu;

View File

@ -0,0 +1,74 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2008 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SerialPort.hxx,v 1.1 2008-03-31 00:59:30 stephena Exp $
//============================================================================
#ifndef SERIALPORT_HXX
#define SERIALPORT_HXX
#include "bspf.hxx"
/**
This class provides an interface for a standard serial port.
For now, this used when connecting a real AtariVox device,
but it may be used for other devices in the future.
@author Stephen Anthony
@version $Id: SerialPort.hxx,v 1.1 2008-03-31 00:59:30 stephena Exp $
*/
class SerialPort
{
public:
SerialPort() { }
virtual ~SerialPort() { }
/**
Open the given serial port with the specified attributes.
@param device The name of the port
@param baud Baud rate
@param data Number of data bits
@param stop Number of stop bits
@param parity Type of parity bit (0=none, 1=odd, 2=even)
@return False on any errors, else true
*/
virtual bool open(const string& device, int baud, int data,
int stop, int parity) { return false; }
/**
Close a previously opened serial port.
*/
virtual void close() { }
/**
Read a byte from the serial port.
@param data Destination for the byte read from the port
@return True if a byte was read, else false
*/
virtual bool read(uInt8& data) { return false; }
/**
Write a byte to the serial port.
@param data The byte to write to the port
@return True if a byte was written, else false
*/
virtual bool write(const uInt8 data) { return false; }
};
#endif

View File

@ -13,10 +13,10 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SpeakJet.cxx,v 1.8 2008-03-29 19:15:57 stephena Exp $
// $Id: SpeakJet.cxx,v 1.9 2008-03-31 00:59:30 stephena Exp $
//============================================================================
#ifdef ATARIVOX_SUPPORT
#ifdef SPEAKJET_EMULATION
#include "SpeakJet.hxx"
@ -84,6 +84,8 @@ int SpeakJet::thread(void *data) {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SpeakJet::write(uInt8 code)
{
cerr << "SpeakJet: output byte " << ((int)(code)) << endl;
// TODO: clean up this mess.
const char *rsynthPhones = xlatePhoneme(code);
// cerr << "rsynth: \"" << rsynthPhones << "\"" << endl;

View File

@ -13,10 +13,10 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SpeakJet.hxx,v 1.9 2008-03-29 19:15:57 stephena Exp $
// $Id: SpeakJet.hxx,v 1.10 2008-03-31 00:59:30 stephena Exp $
//============================================================================
#ifdef ATARIVOX_SUPPORT
#ifdef SPEAKJET_EMULATION
#ifndef SPEAKJET_HXX
#define SPEAKJET_HXX
@ -77,7 +77,7 @@
anyway).
@author B. Watson
@version $Id: SpeakJet.hxx,v 1.9 2008-03-29 19:15:57 stephena Exp $
@version $Id: SpeakJet.hxx,v 1.10 2008-03-31 00:59:30 stephena Exp $
*/
#include "bspf.hxx"

View File

@ -0,0 +1,55 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2008 by Bradford W. Mott and the Stella team
//
// 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.1 2008-03-31 00:59:30 stephena Exp $
//============================================================================
#include "SerialPortUNIX.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SerialPortUNIX::SerialPortUNIX()
: SerialPort()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SerialPortUNIX::~SerialPortUNIX()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SerialPortUNIX::open(const string& device, int baud, int data,
int stop, int parity)
{
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SerialPortUNIX::close()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SerialPortUNIX::read(uInt8& data)
{
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SerialPortUNIX::write(const uInt8 data)
{
cerr << "SerialPortUNIX::write " << (int)data << endl;
return false;
}

View File

@ -0,0 +1,71 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2008 by Bradford W. Mott and the Stella team
//
// 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.1 2008-03-31 00:59:30 stephena Exp $
//============================================================================
#ifndef SERIALPORT_UNIX_HXX
#define SERIALPORT_UNIX_HXX
#include "SerialPort.hxx"
/**
Implement reading and writing from a serial port under UNIX.
@author Stephen Anthony
@version $Id: SerialPortUNIX.hxx,v 1.1 2008-03-31 00:59:30 stephena Exp $
*/
class SerialPortUNIX : public SerialPort
{
public:
SerialPortUNIX();
virtual ~SerialPortUNIX();
/**
Open the given serial port with the specified attributes.
@param device The name of the port
@param baud Baud rate
@param data Number of data bits
@param stop Number of stop bits
@param parity Type of parity bit (0=none, 1=odd, 2=even)
@return False on any errors, else true
*/
bool open(const string& device, int baud, int data, int stop, int parity);
/**
Close a previously opened serial port.
*/
void close();
/**
Read a byte from the serial port.
@param data Destination for the byte read from the port
@return True if a byte was read, else false
*/
bool read(uInt8& data);
/**
Write a byte to the serial port.
@param data The byte to write to the port
@return True if a byte was written, else false
*/
bool write(const uInt8 data);
};
#endif

View File

@ -3,6 +3,7 @@ MODULE := src/unix
MODULE_OBJS := \
src/unix/FSNodePOSIX.o \
src/unix/OSystemUNIX.o \
src/unix/SerialPortUNIX.o \
src/unix/SettingsUNIX.o
MODULE_DIRS += \