Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions iop/system/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ SUBDIRS = \
loadcore \
loadfile \
modload \
msifrpc \
mtapman \
padman \
padman-old \
Expand Down
25 changes: 25 additions & 0 deletions iop/system/msifrpc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.

IOP_BIN ?= msifrpc.irx

IOP_IMPORT_INCS += \
system/sysmem \
system/loadcore \
system/intrman \
system/stdio \
system/sifcmd \
system/sifman \
system/threadman

IOP_OBJS = msifrpc.o exports.o imports.o

include $(PS2SDKSRC)/Defs.make
include $(PS2SDKSRC)/iop/Rules.bin.make
include $(PS2SDKSRC)/iop/Rules.make
include $(PS2SDKSRC)/iop/Rules.release
15 changes: 15 additions & 0 deletions iop/system/msifrpc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Multi-threaded SIF service

This module provides functions to allow multi-threaded SIF RPC operation.

## Configurations

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

* `msifrpc` -> The recommended version.

## How to use this module in your program

In order to use this module in your program, use `LoadModule` or \
`LoadModuleBuffer` with no arguments.
77 changes: 77 additions & 0 deletions iop/system/msifrpc/include/msifrpc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
*/

#ifndef _MSIFRPC_H
#define _MSIFRPC_H

typedef struct _sifm_rpc_data
{
void *paddr;
unsigned int pid;
int tid;
unsigned int mode;
} sceSifMRpcData;

typedef void (*sceSifMEndFunc)(void *);

typedef struct _sifm_client_data
{
sceSifMRpcData rpcd;
int command;
void *buff;
void *cbuff;
sceSifMEndFunc func;
void *para;
struct _sifm_serve_data *serve;
} sceSifMClientData;

typedef void *(*sceSifMRpcFunc)(unsigned int, void *, int);

typedef struct _sifm_serve_data
{
void *func_buff;
int size;
void *cfunc_buff;
int csize;
sceSifMClientData *client;
void *paddr;
unsigned int fno;
void *receive;
int rsize;
int rmode;
unsigned int rid;
struct _sifm_serve_data *link;
struct _sifm_serve_data *next;
struct _sifm_queue_data *base;
struct _sifm_serve_entry *sentry;
} sceSifMServeData;

typedef struct _sifm_serve_entry
{
unsigned int mbxid;
int command;
sceSifMRpcFunc func;
sceSifMRpcFunc cfunc;
sceSifMServeData *serve_list;
struct _sifm_serve_entry *next;
} sceSifMServeEntry;

extern void sceSifMInitRpc(unsigned int mode);
extern int sceSifMTermRpc(int request, int flags);
extern void sceSifMEntryLoop(sceSifMServeEntry *se, int request, sceSifMRpcFunc func, sceSifMRpcFunc cfunc);

#define msifrpc_IMPORTS_start DECLARE_IMPORT_TABLE(msifrpc, 1, 2)
#define msifrpc_IMPORTS_end END_IMPORT_TABLE

#define I_sceSifMInitRpc DECLARE_IMPORT(4, sceSifMInitRpc)
#define I_sceSifMTermRpc DECLARE_IMPORT(16, sceSifMTermRpc)
#define I_sceSifMEntryLoop DECLARE_IMPORT(17, sceSifMEntryLoop)

#endif
27 changes: 27 additions & 0 deletions iop/system/msifrpc/src/exports.tab
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

DECLARE_EXPORT_TABLE(msifrpc, 1, 2)
DECLARE_EXPORT(_start)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(sceSifMInitRpc)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(sceSifMTermRpc)
DECLARE_EXPORT(sceSifMEntryLoop)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
END_EXPORT_TABLE

void _retonly() {}
51 changes: 51 additions & 0 deletions iop/system/msifrpc/src/imports.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

sysmem_IMPORTS_start
I_AllocSysMemory
I_FreeSysMemory
I_Kprintf
sysmem_IMPORTS_end

loadcore_IMPORTS_start
I_RegisterLibraryEntries
loadcore_IMPORTS_end

intrman_IMPORTS_start
I_CpuSuspendIntr
I_CpuResumeIntr
intrman_IMPORTS_end

stdio_IMPORTS_start
I_printf
stdio_IMPORTS_end

sifcmd_IMPORTS_start
I_sceSifGetSreg
I_sceSifAddCmdHandler
I_sceSifSendCmd
I_isceSifSendCmd
sifcmd_IMPORTS_end

sifman_IMPORTS_start
I_sceSifSetDma
sifman_IMPORTS_end

thbase_IMPORTS_start
I_CreateThread
I_DeleteThread
I_StartThread
I_TerminateThread
I_ChangeThreadPriority
I_GetThreadId
I_ReferThreadStatus
I_SleepThread
I_iWakeupThread
I_DelayThread
I_iSetAlarm
thbase_IMPORTS_end

thmsgbx_IMPORTS_start
I_CreateMbx
I_DeleteMbx
I_iSendMbx
I_ReceiveMbx
thmsgbx_IMPORTS_end
29 changes: 29 additions & 0 deletions iop/system/msifrpc/src/irx_imports.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
#
# Defines all IRX imports.
*/

#ifndef IOP_IRX_IMPORTS_H
#define IOP_IRX_IMPORTS_H

#include <irx.h>

/* Please keep these in alphabetical order! */

#include <intrman.h>
#include <loadcore.h>
#include <sifcmd.h>
#include <sifman.h>
#include <stdio.h>
#include <sysmem.h>
#include <thbase.h>
#include <thmsgbx.h>

#endif /* IOP_IRX_IMPORTS_H */
Loading