Cleanup: Moved some rather intrusive instances of global namespace pollution in Sio.h into a new sio_internal.h, so that the rest of the world doesn't have to ensure the pain of having BREAK and RTS macro'd to integers. ;)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1198 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-05-16 00:43:46 +00:00
parent 728eb75e7a
commit e93b101f49
6 changed files with 71 additions and 61 deletions

View File

@ -17,8 +17,8 @@
*/
#include "PrecompiledHeader.h"
#include "IopCommon.h"
#include "sio_internal.h"
sio2Struct sio2;

View File

@ -20,6 +20,7 @@
#include "IopCommon.h"
#include "MemoryCard.h"
#include "sio_internal.h"
_sio sio;

View File

@ -16,27 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _SIO_H_
#define _SIO_H_
// SIO IRQ Timings...
// Scheduling ints into the future is a purist approach to emulation, and
// is mostly cosmetic since the emulator itself performs all actions instantly
// (as far as the emulated CPU is concerned). In some cases this can actually
// cause more sync problems than it supposedly solves, due to accumulated
// delays incurred by the recompiler's low cycle update rate and also Pcsx2
// failing to properly handle pre-emptive DMA/IRQs or cpu exceptions.
// The SIO is one of these cases, where-by many games seem to be a lot happier
// if the SIO handles its IRQs instantly instead of scheduling them.
// Uncomment the line below for SIO instant-IRQ mode. It improves responsiveness
// considerably, fixes PAD latency problems in some games, and may even reduce the
// chance of saves getting corrupted (untested). But it lacks the purist touch,
// so it's not enabled by default.
//#define SIO_INLINE_IRQS
#pragma once
struct _sio {
u16 StatReg;
@ -79,27 +59,6 @@ struct _sio {
extern _sio sio;
// Status Flags
#define TX_RDY 0x0001
#define RX_RDY 0x0002
#define TX_EMPTY 0x0004
#define PARITY_ERR 0x0008
#define RX_OVERRUN 0x0010
#define FRAMING_ERR 0x0020
#define SYNC_DETECT 0x0040
#define DSR 0x0080
#define CTS 0x0100
#define IRQ 0x0200
// Control Flags
#define TX_PERM 0x0001
#define DTR 0x0002
#define RX_PERM 0x0004
#define BREAK 0x0008
#define RESET_ERR 0x0010
#define RTS 0x0020
#define SIO_RESET 0x0040
extern void sioInit();
extern void sioShutdown();
extern void psxSIOShutdown();
@ -110,21 +69,3 @@ extern void sioInterrupt();
extern void InitializeSIO(u8 value);
extern void sioEjectCard( uint mcdId );
#ifdef _MSC_VER
#pragma pack(1)
#endif
struct mc_command_0x26_tag{
u8 field_151; //+02 flags
u16 sectorSize; //+03 divide to it
u16 field_2C; //+05 divide to it
u32 mc_size; //+07
u8 mc_xor; //+0b don't forget to recalculate it!!!
u8 Z; //+0c
#ifdef _MSC_VER
};
#pragma pack()
#else
} __attribute__((packed));
#endif
#endif

62
pcsx2/sio_internal.h Normal file
View File

@ -0,0 +1,62 @@
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2009 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#pragma once
// sio_internal.h -- contains defines and structs used by sio and sio2, which
// are of little or no use to the rest of the world.
// Status Flags
static const int
TX_RDY = 0x0001,
RX_RDY = 0x0002,
TX_EMPTY = 0x0004,
PARITY_ERR = 0x0008,
RX_OVERRUN = 0x0010,
FRAMING_ERR = 0x0020,
SYNC_DETECT = 0x0040,
DSR = 0x0080,
CTS = 0x0100,
IRQ = 0x0200;
// Control Flags
static const int
TX_PERM = 0x0001,
DTR = 0x0002,
RX_PERM = 0x0004,
BREAK = 0x0008,
RESET_ERR = 0x0010,
RTS = 0x0020,
SIO_RESET = 0x0040;
#ifdef _MSC_VER
#pragma pack(1)
#endif
struct mc_command_0x26_tag{
u8 field_151; //+02 flags
u16 sectorSize; //+03 divide to it
u16 field_2C; //+05 divide to it
u32 mc_size; //+07
u8 mc_xor; //+0b don't forget to recalculate it!!!
u8 Z; //+0c
#ifdef _MSC_VER
};
#pragma pack()
#else
} __attribute__((packed));
#endif

View File

@ -1524,6 +1524,10 @@
RelativePath="..\..\Sio.h"
>
</File>
<File
RelativePath="..\..\sio_internal.h"
>
</File>
<Filter
Name="Hardware"
>

View File

@ -63,7 +63,9 @@ void __Log(char *fmt, ...)
EXPORT_C_(s32) DEV9init()
{
#ifdef __LINUX__ // for until we get a win32 version sorted out / implemented...
LoadConfig();
#endif
#ifdef DEV9_LOG
dev9Log = fopen("logs/dev9Log.txt", "w");