Skip to content

Commit 08658cd

Browse files
authored
Merge pull request #796 from uyjulian/msifrpc
Add implementation of msifrpc module
2 parents 8d259ac + c1cff9b commit 08658cd

File tree

8 files changed

+1011
-0
lines changed

8 files changed

+1011
-0
lines changed

iop/system/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ SUBDIRS = \
2525
loadcore \
2626
loadfile \
2727
modload \
28+
msifrpc \
2829
mtapman \
2930
padman \
3031
padman-old \

iop/system/msifrpc/Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# _____ ___ ____ ___ ____
2+
# ____| | ____| | | |____|
3+
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
4+
#-----------------------------------------------------------------------
5+
# Copyright ps2dev - http://www.ps2dev.org
6+
# Licenced under Academic Free License version 2.0
7+
# Review ps2sdk README & LICENSE files for further details.
8+
9+
IOP_BIN ?= msifrpc.irx
10+
11+
IOP_IMPORT_INCS += \
12+
system/sysmem \
13+
system/loadcore \
14+
system/intrman \
15+
system/stdio \
16+
system/sifcmd \
17+
system/sifman \
18+
system/threadman
19+
20+
IOP_OBJS = msifrpc.o exports.o imports.o
21+
22+
include $(PS2SDKSRC)/Defs.make
23+
include $(PS2SDKSRC)/iop/Rules.bin.make
24+
include $(PS2SDKSRC)/iop/Rules.make
25+
include $(PS2SDKSRC)/iop/Rules.release

iop/system/msifrpc/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Multi-threaded SIF service
2+
3+
This module provides functions to allow multi-threaded SIF RPC operation.
4+
5+
## Configurations
6+
7+
There are multiple configurations of this library, allowing the choice of
8+
balancing between size, speed, and features.
9+
10+
* `msifrpc` -> The recommended version.
11+
12+
## How to use this module in your program
13+
14+
In order to use this module in your program, use `LoadModule` or \
15+
`LoadModuleBuffer` with no arguments.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
# _____ ___ ____ ___ ____
3+
# ____| | ____| | | |____|
4+
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5+
#-----------------------------------------------------------------------
6+
# Copyright ps2dev - http://www.ps2dev.org
7+
# Licenced under Academic Free License version 2.0
8+
# Review ps2sdk README & LICENSE files for further details.
9+
*/
10+
11+
#ifndef _MSIFRPC_H
12+
#define _MSIFRPC_H
13+
14+
typedef struct _sifm_rpc_data
15+
{
16+
void *paddr;
17+
unsigned int pid;
18+
int tid;
19+
unsigned int mode;
20+
} sceSifMRpcData;
21+
22+
typedef void (*sceSifMEndFunc)(void *);
23+
24+
typedef struct _sifm_client_data
25+
{
26+
sceSifMRpcData rpcd;
27+
int command;
28+
void *buff;
29+
void *cbuff;
30+
sceSifMEndFunc func;
31+
void *para;
32+
struct _sifm_serve_data *serve;
33+
} sceSifMClientData;
34+
35+
typedef void *(*sceSifMRpcFunc)(unsigned int, void *, int);
36+
37+
typedef struct _sifm_serve_data
38+
{
39+
void *func_buff;
40+
int size;
41+
void *cfunc_buff;
42+
int csize;
43+
sceSifMClientData *client;
44+
void *paddr;
45+
unsigned int fno;
46+
void *receive;
47+
int rsize;
48+
int rmode;
49+
unsigned int rid;
50+
struct _sifm_serve_data *link;
51+
struct _sifm_serve_data *next;
52+
struct _sifm_queue_data *base;
53+
struct _sifm_serve_entry *sentry;
54+
} sceSifMServeData;
55+
56+
typedef struct _sifm_serve_entry
57+
{
58+
unsigned int mbxid;
59+
int command;
60+
sceSifMRpcFunc func;
61+
sceSifMRpcFunc cfunc;
62+
sceSifMServeData *serve_list;
63+
struct _sifm_serve_entry *next;
64+
} sceSifMServeEntry;
65+
66+
extern void sceSifMInitRpc(unsigned int mode);
67+
extern int sceSifMTermRpc(int request, int flags);
68+
extern void sceSifMEntryLoop(sceSifMServeEntry *se, int request, sceSifMRpcFunc func, sceSifMRpcFunc cfunc);
69+
70+
#define msifrpc_IMPORTS_start DECLARE_IMPORT_TABLE(msifrpc, 1, 2)
71+
#define msifrpc_IMPORTS_end END_IMPORT_TABLE
72+
73+
#define I_sceSifMInitRpc DECLARE_IMPORT(4, sceSifMInitRpc)
74+
#define I_sceSifMTermRpc DECLARE_IMPORT(16, sceSifMTermRpc)
75+
#define I_sceSifMEntryLoop DECLARE_IMPORT(17, sceSifMEntryLoop)
76+
77+
#endif

iop/system/msifrpc/src/exports.tab

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
DECLARE_EXPORT_TABLE(msifrpc, 1, 2)
3+
DECLARE_EXPORT(_start)
4+
DECLARE_EXPORT(_retonly)
5+
DECLARE_EXPORT(_retonly)
6+
DECLARE_EXPORT(_retonly)
7+
DECLARE_EXPORT(sceSifMInitRpc)
8+
DECLARE_EXPORT(_retonly)
9+
DECLARE_EXPORT(_retonly)
10+
DECLARE_EXPORT(_retonly)
11+
DECLARE_EXPORT(_retonly)
12+
DECLARE_EXPORT(_retonly)
13+
DECLARE_EXPORT(_retonly)
14+
DECLARE_EXPORT(_retonly)
15+
DECLARE_EXPORT(_retonly)
16+
DECLARE_EXPORT(_retonly)
17+
DECLARE_EXPORT(_retonly)
18+
DECLARE_EXPORT(_retonly)
19+
DECLARE_EXPORT(sceSifMTermRpc)
20+
DECLARE_EXPORT(sceSifMEntryLoop)
21+
DECLARE_EXPORT(_retonly)
22+
DECLARE_EXPORT(_retonly)
23+
DECLARE_EXPORT(_retonly)
24+
DECLARE_EXPORT(_retonly)
25+
END_EXPORT_TABLE
26+
27+
void _retonly() {}

iop/system/msifrpc/src/imports.lst

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
sysmem_IMPORTS_start
3+
I_AllocSysMemory
4+
I_FreeSysMemory
5+
I_Kprintf
6+
sysmem_IMPORTS_end
7+
8+
loadcore_IMPORTS_start
9+
I_RegisterLibraryEntries
10+
loadcore_IMPORTS_end
11+
12+
intrman_IMPORTS_start
13+
I_CpuSuspendIntr
14+
I_CpuResumeIntr
15+
intrman_IMPORTS_end
16+
17+
stdio_IMPORTS_start
18+
I_printf
19+
stdio_IMPORTS_end
20+
21+
sifcmd_IMPORTS_start
22+
I_sceSifGetSreg
23+
I_sceSifAddCmdHandler
24+
I_sceSifSendCmd
25+
I_isceSifSendCmd
26+
sifcmd_IMPORTS_end
27+
28+
sifman_IMPORTS_start
29+
I_sceSifSetDma
30+
sifman_IMPORTS_end
31+
32+
thbase_IMPORTS_start
33+
I_CreateThread
34+
I_DeleteThread
35+
I_StartThread
36+
I_TerminateThread
37+
I_ChangeThreadPriority
38+
I_GetThreadId
39+
I_ReferThreadStatus
40+
I_SleepThread
41+
I_iWakeupThread
42+
I_DelayThread
43+
I_iSetAlarm
44+
thbase_IMPORTS_end
45+
46+
thmsgbx_IMPORTS_start
47+
I_CreateMbx
48+
I_DeleteMbx
49+
I_iSendMbx
50+
I_ReceiveMbx
51+
thmsgbx_IMPORTS_end
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
# _____ ___ ____ ___ ____
3+
# ____| | ____| | | |____|
4+
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5+
#-----------------------------------------------------------------------
6+
# Copyright ps2dev - http://www.ps2dev.org
7+
# Licenced under Academic Free License version 2.0
8+
# Review ps2sdk README & LICENSE files for further details.
9+
#
10+
# Defines all IRX imports.
11+
*/
12+
13+
#ifndef IOP_IRX_IMPORTS_H
14+
#define IOP_IRX_IMPORTS_H
15+
16+
#include <irx.h>
17+
18+
/* Please keep these in alphabetical order! */
19+
20+
#include <intrman.h>
21+
#include <loadcore.h>
22+
#include <sifcmd.h>
23+
#include <sifman.h>
24+
#include <stdio.h>
25+
#include <sysmem.h>
26+
#include <thbase.h>
27+
#include <thmsgbx.h>
28+
29+
#endif /* IOP_IRX_IMPORTS_H */

0 commit comments

Comments
 (0)