ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
smod.c File Reference
#include <tamtypes.h>
#include <kernel.h>
#include <string.h>
#include <sifrpc.h>
#include "smem.h"
#include "slib.h"
#include "smod.h"
#include "common.h"
+ Include dependency graph for smod.c:

Go to the source code of this file.

Functions

int smod_get_next_mod (smod_mod_info_t *cur_mod, smod_mod_info_t *next_mod)
 
int smod_get_mod_by_name (const char *name, smod_mod_info_t *info)
 

Variables

struct smem_buf smem_buf
 

Detailed Description

Sub-CPU module interface.

Definition in file smod.c.

Function Documentation

◆ smod_get_mod_by_name()

int smod_get_mod_by_name ( const char *  name,
smod_mod_info_t info 
)

Find and retreive a module by it's module name.

Definition at line 54 of file smod.c.

55 {
56  SifRpcReceiveData_t RData;
57  int len = strlen(name);
58 
60  return 0;
61 
62  smem_buf.bytes[64]='\0';
63  do {
65  if(SifRpcGetOtherData(&RData, info->name, &smem_buf, 64, 0)>=0){
66  if (!__memcmp(smem_buf.bytes, name, len))
67  return info->id;
68  }
69  } while (smod_get_next_mod(info, info) != 0);
70 
71  return 0;
72 }
jpgData * info
Definition: camera-test.c:14
int __memcmp(const void *s1, const void *s2, unsigned int length)
Definition: common.c:27
void SyncDCache(void *start, void *end)
int SifRpcGetOtherData(SifRpcReceiveData_t *rd, void *src, void *dest, int size, int mode)
int smod_get_next_mod(smod_mod_info_t *cur_mod, smod_mod_info_t *next_mod)
Definition: smod.c:30
Definition: common.h:3
u8 bytes[SMEM_BUF_SIZE/sizeof(u8)]
Definition: common.h:5
#define NULL
Definition: tamtypes.h:91

References __memcmp(), smem_buf::bytes, info, NULL, SifRpcGetOtherData(), smod_get_next_mod(), and SyncDCache().

Referenced by sbv_patch_enable_lmb(), and sbv_patch_fileio().

◆ smod_get_next_mod()

int smod_get_next_mod ( smod_mod_info_t cur_mod,
smod_mod_info_t next_mod 
)

Return the next module referenced in the global module list.

Definition at line 30 of file smod.c.

31 {
32  SifRpcReceiveData_t RData;
33  void *addr;
34 
35  /* If cur_mod is 0, return the head of the list (typically IOP address 0x800). */
36  if (!cur_mod) {
37  addr = (void *)0x800;
38  } else {
39  if (!cur_mod->next)
40  return 0;
41  else
42  addr = cur_mod->next;
43  }
44 
46  if(SifRpcGetOtherData(&RData, addr, &smem_buf, sizeof(smod_mod_info_t), 0)>=0){
47  memcpy(next_mod, &smem_buf.mod_info, sizeof(smod_mod_info_t));
48  return next_mod->id;
49  }
50 
51  return 0;
52 }
smod_mod_info_t mod_info
Definition: common.h:7
struct _smod_mod_info * next
Definition: smod.h:25

References smem_buf::bytes, smod_mod_info_t::id, smem_buf::mod_info, smod_mod_info_t::next, SifRpcGetOtherData(), and SyncDCache().

Referenced by smod_get_mod_by_name().

Variable Documentation

◆ smem_buf

struct smem_buf smem_buf
extern

Definition at line 1 of file common.c.

Referenced by smem_write_word().