PS2SDK
PS2 Homebrew Libraries
usbd_sys.c
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 #include "usbdpriv.h"
12 
13 void *AllocSysMemoryWrap(int size)
14 {
15  void *ptr;
16  int state;
17 
18  CpuSuspendIntr(&state);
19  ptr = AllocSysMemory(ALLOC_FIRST, size, NULL);
20  CpuResumeIntr(state);
21  return ptr;
22 }
23 
24 int FreeSysMemoryWrap(void *ptr)
25 {
26  int res;
27  int state;
28 
29  CpuSuspendIntr(&state);
30  res = FreeSysMemory(ptr);
31  CpuResumeIntr(state);
32  return res;
33 }
34 
35 int usbdLock(void)
36 {
37  return WaitSema(usbKernelResources.m_usbdSema);
38 }
39 
40 int usbdUnlock(void)
41 {
42  return SignalSema(usbKernelResources.m_usbdSema);
43 }
CpuSuspendIntr
int CpuSuspendIntr(int *state)
Definition: intrman.c:195
usbdpriv.h
CpuResumeIntr
int CpuResumeIntr(int state)
Definition: intrman.c:217