summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorSND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-02-14 22:44:17 +0000
committerSND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-02-14 22:44:17 +0000
commitf1d5f92e6bfbff24667a766610f7171bcf6d7116 (patch)
treefb4a2ccf4cd310d62e82873377ef5558924af081 /plugins
parentba0c9b98bf69b8e54e7117b21f2282d3b79c2988 (diff)
downloadpcsxr-f1d5f92e6bfbff24667a766610f7171bcf6d7116.tar.gz
...
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@82903 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/bladesio1/sio1.c132
1 files changed, 108 insertions, 24 deletions
diff --git a/plugins/bladesio1/sio1.c b/plugins/bladesio1/sio1.c
index cef7d6cc..cba060d1 100755
--- a/plugins/bladesio1/sio1.c
+++ b/plugins/bladesio1/sio1.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <stdint.h>
+#include "psxcommon.h"
#include "psemu_plugin_defs.h"
#include "settings.h"
@@ -35,17 +36,84 @@ static const unsigned char version = 1;
static const unsigned char revision = 1;
static const unsigned char build = 1;
+static void (CALLBACK *irqCallback)() = 0;
+
Settings settings;
+/* sio status flags.
+ */
+enum
+{
+ SR_TXRDY = 0x0001,
+ SR_RXRDY = 0x0002,
+ SR_TXU = 0x0004,
+ SR_PERROR = 0x0008,
+ SR_OE = 0x0010,
+ SR_FE = 0x0020,
+ SR_0040 = 0x0040, // ?
+ SR_DSR = 0x0080,
+ SR_CTS = 0x0100,
+ SR_IRQ = 0x0200
+};
+
+/* sio mode flags.
+ */
+enum
+{
+ MR_BR_1 = 0x0001,
+ MR_BR_16 = 0x0002,
+ MR_BR_64 = 0x0003,
+ MR_CHLEN_5 = 0x0000,
+ MR_CHLEN_6 = 0x0004,
+ MR_CHLEN_7 = 0x0008,
+ MR_CHLEN_8 = 0x000C,
+ MR_PEN = 0x0010,
+ MR_P_EVEN = 0x0020,
+ MR_SB_00 = 0x0000,
+ MR_SB_01 = 0x0040,
+ MR_SB_10 = 0x0080,
+ MR_SB_11 = 0x00C0
+};
+
+/* sio control flags.
+ */
+enum
+{
+ CR_TXEN = 0x0001,
+ CR_DTR = 0x0002,
+ CR_RXEN = 0x0004,
+ CR_0008 = 0x0008, // ?
+ CR_ERRRST = 0x0010,
+ CR_RTS = 0x0020,
+ CR_RST = 0x0040,
+ CR_0080 = 0x0080, // HM?
+ CR_BUFSZ_1 = 0x0000,
+ CR_BUFSZ_2 = 0x0100,
+ CR_BUFSZ_4 = 0x0200,
+ CR_BUFSZ_8 = 0x0300,
+ CR_TXIEN = 0x0400,
+ CR_RXIEN = 0x0800,
+ CR_DSRIEN = 0x1000,
+ CR_2000 = 0x2000 // CTSIEN?
+};
+
+static u8 dataReg[8];
+static u16 statReg;
+static u16 modeReg;
+static u16 ctrlReg;
+static u16 baudReg;
+
/******************************************************************************/
long CALLBACK SIO1init()
{
+ printf("SIO1init()\n");
return 0;
}
long CALLBACK SIO1shutdown()
{
+ printf("SIO1shutdown()\n");
return 0;
}
@@ -53,13 +121,22 @@ long CALLBACK SIO1shutdown()
long CALLBACK SIO1open( unsigned long *gpuDisp )
{
+ printf("SIO1open()\n");
+
settingsRead();
+
+ memset(dataReg, 0x00, sizeof(dataReg));
+ statReg = SR_TXRDY | SR_TXU | SR_DSR | SR_CTS;
+ modeReg = 0x0000;
+ ctrlReg = 0x0000;
+ baudReg = 0x0000;
return 0;
}
long CALLBACK SIO1close()
{
+ printf("SIO1close()\n");
return 0;
}
@@ -67,10 +144,12 @@ long CALLBACK SIO1close()
void CALLBACK SIO1pause()
{
+ printf("SIO1pause()\n");
}
void CALLBACK SIO1resume()
{
+ printf("SIO1resume()\n");
}
/******************************************************************************/
@@ -82,6 +161,9 @@ long CALLBACK SIO1keypressed( int val )
/******************************************************************************/
+/* Write.
+ */
+
void CALLBACK SIO1writeData8(unsigned char val)
{
printf("SIO1writeData8(%.2x)\n", val);
@@ -110,33 +192,42 @@ void CALLBACK SIO1writeStat32(unsigned long val)
void CALLBACK SIO1writeMode16(unsigned short val)
{
printf("SIO1writeMode16(%.4x)\n", val);
+ modeReg = val;
}
void CALLBACK SIO1writeMode32(unsigned long val)
{
printf("SIO1writeMode32(%.8x)\n", val);
+ modeReg = val;
}
void CALLBACK SIO1writeCtrl16(unsigned short val)
{
printf("SIO1writeCtrl16(%.4x)\n", val);
+ ctrlReg = val;
}
void CALLBACK SIO1writeCtrl32(unsigned long val)
{
printf("SIO1writeCtrl32(%.8x)\n", val);
+ ctrlReg = val;
}
void CALLBACK SIO1writeBaud16(unsigned short val)
{
printf("SIO1writeBaud16(%.4x)\n", val);
+ baudReg = val;
}
void CALLBACK SIO1writeBaud32(unsigned long val)
{
printf("SIO1writeBaud32(%.8x)\n", val);
+ baudReg = val;
}
+/* Read.
+ */
+
unsigned char CALLBACK SIO1readData8()
{
printf("SIO1readData8()\n");
@@ -157,67 +248,60 @@ unsigned long CALLBACK SIO1readData32()
unsigned short CALLBACK SIO1readStat16()
{
- printf("SIO1readStat16()\n");
- return 0;
+ printf("SIO1readStat16() : %.4x\n", statReg);
+ return statReg;
}
unsigned long CALLBACK SIO1readStat32()
{
- printf("SIO1readStat32()\n");
- return 0;
+ printf("SIO1readStat32() : %.4x\n", statReg);
+ return statReg;
}
unsigned short CALLBACK SIO1readMode16()
{
- printf("SIO1readMode16()\n");
- return 0;
+ printf("SIO1readMode16() : %.4x\n", modeReg);
+ return modeReg;
}
unsigned long CALLBACK SIO1readMode32()
{
- printf("SIO1readMode32()\n");
- return 0;
+ printf("SIO1readMode32() : %.4x\n", modeReg);
+ return modeReg;
}
unsigned short CALLBACK SIO1readCtrl16()
{
- printf("SIO1readCtrl16()\n");
- return 0;
+ printf("SIO1readCtrl16() : %.4x\n", ctrlReg);
+ return ctrlReg;
}
unsigned long CALLBACK SIO1readCtrl32()
{
- printf("SIO1readCtrl32()\n");
- return 0;
+ printf("SIO1readCtrl32() : %.4x\n", ctrlReg);
+ return ctrlReg;
}
unsigned short CALLBACK SIO1readBaud16()
{
- printf("SIO1readBaud16()\n");
- return 0;
+ printf("SIO1readBaud16() : %.4x\n", baudReg);
+ return baudReg;
}
unsigned long CALLBACK SIO1readBaud32()
{
- printf("SIO1readBaud32()\n");
- return 0;
+ printf("SIO1readBaud32() : %.4x\n", baudReg);
+ return baudReg;
}
-
/******************************************************************************/
void CALLBACK SIO1registerCallback(void (CALLBACK *callback)())
{
+ irqCallback = callback;
}
/******************************************************************************/
-/*
-long CALLBACK SIO1queryPlayer()
-{
- return settings.player;
-}
-*/
-/******************************************************************************/
unsigned long CALLBACK PSEgetLibType()
{