Skip to content

Commit

Permalink
Merge pull request #709 from uyjulian/sio2man_feature_update
Browse files Browse the repository at this point in the history
sio2man feature update
  • Loading branch information
fjtrujy authored Jan 7, 2025
2 parents e20d5d1 + c02b4b3 commit bd1cb22
Show file tree
Hide file tree
Showing 18 changed files with 665 additions and 521 deletions.
10 changes: 6 additions & 4 deletions common/include/iop_mmio_hwport.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,12 @@ typedef struct sio0_1_mmio_hwport_

typedef struct sio2_mmio_hwport_
{
vu8 send3_buf[0x40];
vu8 send1_2_buf[0x20];
vu32 out_fifo; /* PCSX2 says in */
vu32 in_fifo; /* PCSX2 says out */
vu32 send3_buf[16];
vu32 send1_2_buf[8];
vu8 out_fifo; /* PCSX2 says in */
u8 pad1[3];
vu8 in_fifo; /* PCSX2 says out */
u8 pad2[3];
vu32 ctrl;
vu32 recv1;
vu32 recv2;
Expand Down
3 changes: 1 addition & 2 deletions iop/system/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@ SUBDIRS = \
rmmanx \
rmtapman \
rpadman \
rsio2man \
sbusintr \
sifcmd \
sifinit \
sifman \
siftoo \
sio2log \
sio2man \
sio2man-old \
sio2man-nano \
ssbusc \
stdio \
sysclib \
Expand Down
1 change: 0 additions & 1 deletion iop/system/padman/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ endif

ifneq (x$(PADMAN_BUILDING_XPADMAN_V2),x0)
IOP_CFLAGS += -DBUILDING_XPADMAN_V2
IOP_INCS += -I$(PS2SDKSRC)/iop/system/rsio2man/include
endif

include $(PS2SDKSRC)/Defs.make
Expand Down
1 change: 0 additions & 1 deletion iop/system/rmman/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ IOP_INCS += \
-I$(PS2SDKSRC)/iop/system/intrman/include \
-I$(PS2SDKSRC)/iop/system/iomanx/include \
-I$(PS2SDKSRC)/iop/system/loadcore/include \
-I$(PS2SDKSRC)/iop/system/rsio2man/include \
-I$(PS2SDKSRC)/iop/system/sifcmd/include \
-I$(PS2SDKSRC)/iop/system/sifman/include \
-I$(PS2SDKSRC)/iop/system/sio2man/include \
Expand Down
3 changes: 0 additions & 3 deletions iop/system/rmtapman/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,4 @@ IOP_SRC_DIR = $(PS2SDKSRC)/iop/system/mtapman/src/

IOP_CFLAGS += -DSIO2MAN_V2

IOP_INCS += \
-I$(PS2SDKSRC)/iop/system/rsio2man/include/

include $(PS2SDKSRC)/iop/system/mtapman/Makefile
6 changes: 0 additions & 6 deletions iop/system/rsio2man/README

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
# Copyright ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.

Expand All @@ -11,8 +11,8 @@ IOP_BIN_ALTNAMES =
IOP_SRC_DIR = $(PS2SDKSRC)/iop/system/sio2man/src/
IOP_INC_DIR = $(PS2SDKSRC)/iop/system/sio2man/include/

IOP_BIN ?= rsio2man.irx
IOP_BIN ?= sio2man-nano.irx

SIO2MAN_BUILDING_XSIO2MAN_V2 ?= 1
SIO2MAN_ENABLE_NANO ?= 1

include $(PS2SDKSRC)/iop/system/sio2man/Makefile
18 changes: 0 additions & 18 deletions iop/system/sio2man-old/Makefile

This file was deleted.

25 changes: 9 additions & 16 deletions iop/system/sio2man/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
# Copyright ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.

# Build the newer version of the SIO2 module with support for multitap?
SIO2MAN_BUILDING_XSIO2MAN ?= 1

# Build the newer version of the SIO2 module with support for remote and PDA devices?
SIO2MAN_BUILDING_XSIO2MAN_V2 ?= 0

# Enable logging?
SIO2MAN_ENABLE_LOGGING ?= 0

IOP_BIN_ALTNAMES ?= freesio2.irx
# Build nano version?
SIO2MAN_ENABLE_NANO ?= 0

IOP_BIN_ALTNAMES ?= freesio2.irx rsio2man.irx sio2man-old.irx

IOP_INCS += \
-I$(PS2SDKSRC)/iop/system/dmacman/include \
Expand All @@ -28,18 +25,14 @@ IOP_INCS += \

IOP_OBJS = sio2man.o log.o imports.o exports.o

ifneq (x$(SIO2MAN_BUILDING_XSIO2MAN),x0)
IOP_CFLAGS += -DBUILDING_XSIO2MAN
endif

ifneq (x$(SIO2MAN_BUILDING_XSIO2MAN_V2),x0)
IOP_CFLAGS += -DBUILDING_XSIO2MAN_V2
endif

ifneq (x$(SIO2MAN_ENABLE_LOGGING),x0)
IOP_CFLAGS += -DSIO2LOG
endif

ifneq (x$(SIO2MAN_ENABLE_NANO),x0)
IOP_CFLAGS += -DSIO2MAN_NANO
endif

include $(PS2SDKSRC)/Defs.make
include $(PS2SDKSRC)/iop/Rules.bin.make
include $(PS2SDKSRC)/iop/Rules.make
Expand Down
2 changes: 0 additions & 2 deletions iop/system/sio2man/README

This file was deleted.

21 changes: 21 additions & 0 deletions iop/system/sio2man/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SIO2 Manager

This module is an abstraction layer for the SIO2 interface used for memory card
and controller ports.
This implementation of the module has backwards compatibility features to allow
different versions of e.g. `mcman`, `padman`, `mcxman`, `mtapman`, `rmman`,
`imodeman`, `sio2d`, `mc2_d`, `ds2u_d` to link and operate correctly.

## Configurations

There are multiple configurations of this library, allowing the choice of
balancing between size, speed, and features.

* `sio2man` -> The recommended version.
* `sio2man-nano` -> For memory savings.
* `sio2log` -> For debug and logging purposes.

## How to use this module in your program

In order to use this module in your program, use `LoadModule` or \
`LoadModuleBuffer` with no arguments.
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,42 @@

/**
* @file
* rom1:SIO2MAN module definitions
* rom1:SIO2MAN is a newer version of SIO2MAN than rom0:SIO2MAN.
* SIO2MAN from SDK 2.0 and newer definitions
* For DVD Player ROMs that support remote, rom1:SIO2MAN is a newer version of SIO2MAN than rom0:SIO2MAN.
*/

#ifndef __RSIO2MAN_H__
#define __RSIO2MAN_H__

#define NO_XSIO2MAN_IMPORTS
#define NO_XSIO2MAN_V2_CONFLICTING_IMPORTS
#include <xsio2man.h>
#undef NO_XSIO2MAN_IMPORTS
#undef NO_XSIO2MAN_V2_CONFLICTING_IMPORTS

#ifdef __cplusplus
extern "C" {
#endif

extern void sio2_rm_transfer_init(void);
extern void sio2_unk_transfer_init(void);
extern void sio2_imode_transfer_init(void);

// The following was added in SDK 2.4.
extern void sio2_pad2_transfer_init(void);
extern void sio2_transfer_reset3(void);

// The following was added with export version 2.4 in SDK 2.6.
extern void sio2_mc2_transfer_init(void);

// The following was added with export version 2.7 in SDK 3.0.3.
extern void sio2_set_intr_handler(int (*handler)(void *), void *userdata);
extern void sio2_set_ctrl_c(void);
extern void sio2_set_ctrl_1(void);
extern void sio2_wait_for_intr(void);

#define rsio2man_IMPORTS_start DECLARE_IMPORT_TABLE(sio2man, 2, 3)
#define rsio2man_IMPORTS_end END_IMPORT_TABLE

#define I_sio2_transfer_reset DECLARE_IMPORT(26, sio2_transfer_reset)
#define I_sio2_mtap_transfer_init DECLARE_IMPORT(48, sio2_mtap_transfer_init)
#define I_sio2_rm_transfer_init DECLARE_IMPORT(49, sio2_rm_transfer_init)
#define I_sio2_unk_transfer_init DECLARE_IMPORT(50, sio2_unk_transfer_init)
#define I_sio2_imode_transfer_init DECLARE_IMPORT(50, sio2_imode_transfer_init)
#define I_sio2_transfer2 DECLARE_IMPORT(51, sio2_transfer2)
#define I_sio2_transfer_reset2 DECLARE_IMPORT(52, sio2_transfer_reset2)
#define I_sio2_mtap_change_slot_set DECLARE_IMPORT(53, sio2_mtap_change_slot_set)
Expand All @@ -41,5 +56,16 @@ extern void sio2_unk_transfer_init(void);
#define I_sio2_mtap_get_slot_max DECLARE_IMPORT(58, sio2_mtap_get_slot_max)
#define I_sio2_mtap_get_slot_max2 DECLARE_IMPORT(59, sio2_mtap_get_slot_max2)
#define I_sio2_mtap_update_slots DECLARE_IMPORT(60, sio2_mtap_update_slots)
#define I_sio2_pad2_transfer_init DECLARE_IMPORT(61, sio2_pad2_transfer_init)
#define I_sio2_transfer_reset3 DECLARE_IMPORT(62, sio2_transfer_reset3)
#define I_sio2_mc2_transfer_init DECLARE_IMPORT(63, sio2_mc2_transfer_init)
#define I_sio2_set_intr_handler DECLARE_IMPORT(64, sio2_set_intr_handler)
#define I_sio2_set_ctrl_c DECLARE_IMPORT(65, sio2_set_ctrl_c)
#define I_sio2_set_ctrl_1 DECLARE_IMPORT(66, sio2_set_ctrl_1)
#define I_sio2_wait_for_intr DECLARE_IMPORT(67, sio2_wait_for_intr)

#ifdef __cplusplus
}
#endif

#endif /* __RSIO2MAN_H__ */
11 changes: 10 additions & 1 deletion iop/system/sio2man/include/sio2man.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

/**
* @file
* rom0:SIO2MAN module definitions
* SIO2MAN from SDK 1.3 definitions
* For all systems except arcade and DTL-T, rom0:SIO2MAN module definitions
*/

#ifndef __SIO2MAN_H__
Expand All @@ -19,6 +20,10 @@
#include <types.h>
#include <irx.h>

#ifdef __cplusplus
extern "C" {
#endif

struct _sio2_dma_arg { // size 12
void *addr;
int size;
Expand Down Expand Up @@ -95,4 +100,8 @@ extern int sio2_transfer(sio2_transfer_data_t *td);
#define I_sio2_mc_transfer_init DECLARE_IMPORT(24, sio2_mc_transfer_init)
#define I_sio2_transfer DECLARE_IMPORT(25, sio2_transfer)

#ifdef __cplusplus
}
#endif

#endif /* __SIO2MAN_H__ */
47 changes: 46 additions & 1 deletion iop/system/sio2man/include/xsio2man.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

/**
* @file
* rom0:XSIO2MAN module definitions
* SIO2MAN from SDK 1.4 and newer definitions
* For non-Protokernel systems, rom0:XSIO2MAN module definitions
*/

#ifndef __XSIO2MAN_H__
Expand All @@ -28,6 +29,27 @@ typedef int (*sio2_mtap_get_slot_max2_cb_t)(int port);
typedef void (*sio2_mtap_update_slots_t)(void);

extern void sio2_transfer_reset(void);
extern void sio2_ctrl_set2(u32 val);
extern u32 sio2_ctrl_get2(void);
extern u32 sio2_stat6c_get2(void);
extern void sio2_portN_ctrl1_set2(int N, u32 val);
extern u32 sio2_portN_ctrl1_get2(int N);
extern void sio2_portN_ctrl2_set2(int N, u32 val);
extern u32 sio2_portN_ctrl2_get2(int N);
extern u32 sio2_stat70_get2(void);
extern void sio2_regN_set2(int N, u32 val);
extern u32 sio2_regN_get2(int N);
extern u32 sio2_stat74_get2(void);
extern void sio2_unkn78_set2(u32 val);
extern u32 sio2_unkn78_get2(void);
extern void sio2_unkn7c_set2(u32 val);
extern u32 sio2_unkn7c_get2(void);
extern void sio2_data_out2(u8 val);
extern u8 sio2_data_in2(void);
extern void sio2_stat_set2(u32 val);
extern u32 sio2_stat_get2(void);
extern void sio2_pad_transfer_init2(void);
extern void sio2_mc_transfer_init2(void);
extern void sio2_mtap_transfer_init(void);
extern int sio2_transfer2(sio2_transfer_data_t *td);
extern void sio2_transfer_reset2(void);
Expand All @@ -45,7 +67,29 @@ extern void sio2_mtap_update_slots(void);

#ifndef NO_XSIO2MAN_IMPORTS
#define I_sio2_transfer_reset DECLARE_IMPORT(26, sio2_transfer_reset)
#define I_sio2_ctrl_set2 DECLARE_IMPORT(27, sio2_ctrl_set2)
#define I_sio2_ctrl_get2 DECLARE_IMPORT(28, sio2_ctrl_get2)
#define I_sio2_stat6c_get2 DECLARE_IMPORT(29, sio2_stat6c_get2)
#define I_sio2_portN_ctrl1_set2 DECLARE_IMPORT(30, sio2_portN_ctrl1_set2)
#define I_sio2_portN_ctrl1_get2 DECLARE_IMPORT(31, sio2_portN_ctrl1_get2)
#define I_sio2_portN_ctrl2_set2 DECLARE_IMPORT(32, sio2_portN_ctrl2_set2)
#define I_sio2_portN_ctrl2_get2 DECLARE_IMPORT(33, sio2_portN_ctrl2_get2)
#define I_sio2_stat70_get2 DECLARE_IMPORT(34, sio2_stat70_get2)
#define I_sio2_regN_set2 DECLARE_IMPORT(35, sio2_regN_set2)
#define I_sio2_regN_get2 DECLARE_IMPORT(36, sio2_regN_get2)
#define I_sio2_stat74_get2 DECLARE_IMPORT(37, sio2_stat74_get2)
#define I_sio2_unkn78_set2 DECLARE_IMPORT(38, sio2_unkn78_set2)
#define I_sio2_unkn78_get2 DECLARE_IMPORT(39, sio2_unkn78_get2)
#define I_sio2_unkn7c_set2 DECLARE_IMPORT(40, sio2_unkn7c_set2)
#define I_sio2_unkn7c_get2 DECLARE_IMPORT(41, sio2_unkn7c_get2)
#define I_sio2_data_out2 DECLARE_IMPORT(42, sio2_data_out2)
#define I_sio2_data_in2 DECLARE_IMPORT(43, sio2_data_in2)
#define I_sio2_stat_set2 DECLARE_IMPORT(44, sio2_stat_set2)
#define I_sio2_stat_get2 DECLARE_IMPORT(45, sio2_stat_get2)
#define I_sio2_pad_transfer_init2 DECLARE_IMPORT(46, sio2_pad_transfer_init2)
#define I_sio2_mc_transfer_init2 DECLARE_IMPORT(47, sio2_mc_transfer_init2)
#define I_sio2_mtap_transfer_init DECLARE_IMPORT(48, sio2_mtap_transfer_init)
#ifndef NO_XSIO2MAN_V2_CONFLICTING_IMPORTS
#define I_sio2_transfer2 DECLARE_IMPORT(49, sio2_transfer2)
#define I_sio2_transfer_reset2 DECLARE_IMPORT(50, sio2_transfer_reset2)
#define I_sio2_mtap_change_slot_set DECLARE_IMPORT(51, sio2_mtap_change_slot_set)
Expand All @@ -57,6 +101,7 @@ extern void sio2_mtap_update_slots(void);
#define I_sio2_mtap_get_slot_max2 DECLARE_IMPORT(57, sio2_mtap_get_slot_max2)
#define I_sio2_mtap_update_slots DECLARE_IMPORT(58, sio2_mtap_update_slots)
#endif
#endif

#ifdef __cplusplus
}
Expand Down
Loading

0 comments on commit bd1cb22

Please sign in to comment.