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

Go to the source code of this file.

Functions

int __memcmp (const void *s1, const void *s2, unsigned int length)
 
int smem_write_word (void *address, u32 value)
 

Variables

struct smem_buf smem_buf
 

Detailed Description

Internal, common functions and resources.

Definition in file common.c.

Function Documentation

◆ __memcmp()

int __memcmp ( const void *  s1,
const void *  s2,
unsigned int  length 
)

Definition at line 27 of file common.c.

28 {
29  const char *a = s1;
30  const char *b = s2;
31 
32  while (length--) {
33  if (*a++ != *b++)
34  return 1;
35  }
36 
37  return 0;
38 }
#define s1
Definition: as_reg_compat.h:73
#define s2
Definition: as_reg_compat.h:74

References s1, and s2.

Referenced by slib_exp_lib_list(), slib_get_exp_lib(), and smod_get_mod_by_name().

◆ smem_write_word()

int smem_write_word ( void *  address,
u32  value 
)

Definition at line 40 of file common.c.

41 {
42  SifRpcReceiveData_t RData;
43  void *pDestRounded;
44  int result;
45  SifDmaTransfer_t dmat;
46 
47  pDestRounded=(void*)(((u32)address)&0xFFFFFFC0);
49  if((result=SifRpcGetOtherData(&RData, pDestRounded, &smem_buf, 64, 0))>=0)
50  {
51  *(u32*)UNCACHED_SEG((&smem_buf.bytes[((u32)address&0x3F)]))=value;
52 
53  dmat.src=&smem_buf;
54  dmat.dest=pDestRounded;
55  dmat.size=64;
56  dmat.attr=0;
57  SifSetDma(&dmat, 1);
58  }
59 
60  return result;
61 }
struct smem_buf smem_buf
Definition: common.c:24
u32 SifSetDma(SifDmaTransfer_t *sdd, s32 len)
void SyncDCache(void *start, void *end)
#define UNCACHED_SEG(x)
Definition: kernel.h:35
s32 result
Definition: rpc_client.c:23
int SifRpcGetOtherData(SifRpcReceiveData_t *rd, void *src, void *dest, int size, int mode)
void * dest
Definition: sifdma.h:55
void * src
Definition: sifdma.h:54
Definition: common.h:3
u8 bytes[SMEM_BUF_SIZE/sizeof(u8)]
Definition: common.h:5
unsigned int u32
Definition: tamtypes.h:30

References SifDmaTransfer_t::attr, smem_buf::bytes, SifDmaTransfer_t::dest, result, SifRpcGetOtherData(), SifSetDma(), SifDmaTransfer_t::size, smem_buf, SifDmaTransfer_t::src, SyncDCache(), and UNCACHED_SEG.

Referenced by sbv_patch_enable_lmb(), and sbv_patch_fileio().

Variable Documentation

◆ smem_buf

Definition at line 1 of file common.c.

Referenced by smem_write_word().