Skip to content

Commit

Permalink
add PowerPC UART Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
israpps committed Jul 10, 2024
1 parent 1b9391b commit aed60e7
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ jobs:
strategy:
fail-fast: false
matrix:
debug: [debug, iopcore_debug, ingame_debug, deci2_debug, eesio_debug]
debug: [debug, iopcore_debug, ingame_debug, deci2_debug, eesio_debug
debug_ppctty, iopcore_ppctty_debug, ingame_ppctty_debug,
]
runs-on: ubuntu-latest
container: ghcr.io/ps2homebrew/ps2homebrew:main
steps:
Expand Down
23 changes: 18 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ DEBUG ?= 0
EESIO_DEBUG ?= 0
INGAME_DEBUG ?= 0
DECI2_DEBUG ?= 0
#How the TTY will reach developer: 'UDP', 'PPC_UART'.
TTY_APPROACH ?= UDP

# ======== DO NOT MODIFY VALUES AFTER THIS POINT! UNLESS YOU KNOW WHAT YOU ARE DOING ========
REVISION = $(shell expr $(shell git rev-list --count HEAD) + 2)
Expand Down Expand Up @@ -153,23 +155,31 @@ ifeq ($(DEBUG),1)
ifeq ($(DECI2_DEBUG),1)
EE_OBJS += debug.o drvtif_irx.o tifinet_irx.o deci2_img.o
EE_LDFLAGS += -liopreboot
else
else ifeq ($(TTY_APPROACH),UDP)
EE_OBJS += debug.o udptty.o ioptrap.o ps2link.o
EE_CFLAGS += -DTTY_UDP
else ifeq ($(TTY_APPROACH),PPC_UART)
EE_OBJS += debug.o ppctty.o ioptrap.o
EE_CFLAGS += -DTTY_PPC_UART
else
$(error Unknown value for TTY_APPROACH: '$(TTY_APPROACH)')
endif
MOD_DEBUG_FLAGS = DEBUG=1
ifeq ($(IOPCORE_DEBUG),1)
EE_CFLAGS += -D__INGAME_DEBUG
EECORE_EXTRA_FLAGS = LOAD_DEBUG_MODULES=1
EECORE_EXTRA_FLAGS += LOAD_DEBUG_MODULES=1
CDVDMAN_DEBUG_FLAGS = IOPCORE_DEBUG=1
MCEMU_DEBUG_FLAGS = IOPCORE_DEBUG=1
SMSTCPIP_INGAME_CFLAGS =
IOP_OBJS += udptty-ingame.o
ifeq ($(TTY_APPROACH),UDP)
IOP_OBJS += udptty-ingame.o
endif
else ifeq ($(EESIO_DEBUG),1)
EE_CFLAGS += -D__EESIO_DEBUG
EE_LIBS += -lsiocookie
else ifeq ($(INGAME_DEBUG),1)
EE_CFLAGS += -D__INGAME_DEBUG
EECORE_EXTRA_FLAGS = LOAD_DEBUG_MODULES=1
EECORE_EXTRA_FLAGS += LOAD_DEBUG_MODULES=1
CDVDMAN_DEBUG_FLAGS = IOPCORE_DEBUG=1
SMSTCPIP_INGAME_CFLAGS =
ifeq ($(DECI2_DEBUG),1)
Expand All @@ -178,8 +188,11 @@ ifeq ($(DEBUG),1)
IOP_OBJS += drvtif_ingame_irx.o tifinet_ingame_irx.o
DECI2_DEBUG=1
CDVDMAN_DEBUG_FLAGS = USE_DEV9=1 #(clear IOPCORE_DEBUG) dsidb cannot be used to handle exceptions or set breakpoints, so disable output to save resources.
else
else ifeq ($(TTY_APPROACH),UDP)
IOP_OBJS += udptty-ingame.o
EECORE_EXTRA_FLAGS += "TTY_APPROACH=$(TTY_APPROACH)"
else ifeq ($(TTY_APPROACH),PPC_UART)
EECORE_EXTRA_FLAGS += "TTY_APPROACH=$(TTY_APPROACH)"
endif
endif
else
Expand Down
7 changes: 6 additions & 1 deletion ee_core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ endif
ifeq ($(LOAD_DEBUG_MODULES),1)
EE_CFLAGS += -D__LOAD_DEBUG_MODULES
ifeq ($(DECI2_DEBUG),1)
EE_CFLAGS += -D__DECI2_DEBUG
EE_CFLAGS += -D__DECI2_DEBUG
endif
ifeq ($(TTY_APPROACH),UDP)
EE_CFLAGS += -DTTY_UDP
else ifeq ($(TTY_APPROACH),PPC_UART)
EE_CFLAGS += -DTTY_PPC
endif
endif

Expand Down
1 change: 1 addition & 0 deletions ee_core/include/modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ enum OPL_MODULE_ID {
OPL_MODULE_ID_IOPTRAP,
OPL_MODULE_ID_DRVTIF,
OPL_MODULE_ID_TIFINET,
OPL_MODULE_ID_PPCTTY,

// Special patches
OPL_MODULE_ID_IOP_PATCH,
Expand Down
5 changes: 4 additions & 1 deletion ee_core/src/iopmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,12 @@ static void ResetIopSpecial(const char *args, unsigned int arglen)
#ifdef __DECI2_DEBUG
LoadOPLModule(OPL_MODULE_ID_DRVTIF, 0, 0, NULL);
LoadOPLModule(OPL_MODULE_ID_TIFINET, 0, 0, NULL);
#else
#elif defined(TTY_UDP)
LoadOPLModule(OPL_MODULE_ID_UDPTTY, 0, 0, NULL);
LoadOPLModule(OPL_MODULE_ID_IOPTRAP, 0, 0, NULL);
#elif defined(TTY_PPC_UART)
LoadOPLModule(OPL_MODULE_ID_PPCTTY, 0, 0, NULL);
LoadOPLModule(OPL_MODULE_ID_IOPTRAP, 0, 0, NULL);
#endif
#endif

Expand Down
2 changes: 2 additions & 0 deletions include/extern_irx.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ IMPORT_BIN2C(padman_irx);

IMPORT_BIN2C(poweroff_irx);

IMPORT_BIN2C(ppctty_irx);

IMPORT_BIN2C(ps2atad_irx);

IMPORT_BIN2C(ps2dev9_irx);
Expand Down
12 changes: 11 additions & 1 deletion src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int debugSetActive(void)
ret = sysLoadModuleBuffer(&tifinet_irx, size_tifinet_irx, 0, NULL);
if (ret < 0)
return -9;
#else
#elif defined(TTY_UDP)
LOG("[UDPTTY]:\n");
ret = sysLoadModuleBuffer(&udptty_irx, size_udptty_irx, 0, NULL);
if (ret < 0)
Expand All @@ -45,6 +45,16 @@ int debugSetActive(void)
ret = sysLoadModuleBuffer(&ps2link_irx, size_ps2link_irx, 0, NULL);
if (ret < 0)
return -10;
#elif defined(TTY_PPC_UART)
LOG("[PPCTTY]:\n");
ret = sysLoadModuleBuffer(&ppctty_irx, size_ppctty_irx, 0, NULL);
if (ret < 0)
return -8;

LOG("[IOPTRAP]:\n");
ret = sysLoadModuleBuffer(&ioptrap_irx, size_ioptrap_irx, 0, NULL);
if (ret < 0)
return -9;
#endif
#endif

Expand Down
9 changes: 8 additions & 1 deletion src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,13 +554,20 @@ static unsigned int sendIrxKernelRAM(const char *startup, const char *mode_str,
irxptr_tab[modcount].info = size_tifinet_ingame_irx | SET_OPL_MOD_ID(OPL_MODULE_ID_TIFINET);
irxptr_tab[modcount++].ptr = (void *)&tifinet_ingame_irx;
}
#else
#elif defined(TTY_UDP)
if (modules & CORE_IRX_DEBUG) {
irxptr_tab[modcount].info = size_udptty_ingame_irx | SET_OPL_MOD_ID(OPL_MODULE_ID_UDPTTY);
irxptr_tab[modcount++].ptr = (void *)&udptty_ingame_irx;
irxptr_tab[modcount].info = size_ioptrap_irx | SET_OPL_MOD_ID(OPL_MODULE_ID_IOPTRAP);
irxptr_tab[modcount++].ptr = (void *)&ioptrap_irx;
}
#elif defined(TTY_PPC_UART)
if (modules & CORE_IRX_DEBUG) {
irxptr_tab[modcount].info = size_ppctty_irx | SET_OPL_MOD_ID(OPL_MODULE_ID_PPCTTY);
irxptr_tab[modcount++].ptr = (void *)&ppctty_irx;
irxptr_tab[modcount].info = size_ioptrap_irx | SET_OPL_MOD_ID(OPL_MODULE_ID_IOPTRAP);
irxptr_tab[modcount++].ptr = (void *)&ioptrap_irx;
}
#endif
#endif

Expand Down

0 comments on commit aed60e7

Please sign in to comment.