psl1ght
A free SDK for Sony's PS3 console
Loading...
Searching...
No Matches
sem.h
Go to the documentation of this file.
1
5#ifndef __SYS_SEM_H__
6#define __SYS_SEM_H__
7
8#include <ppu-lv2.h>
9
11#define SYS_SEM_ATTR_PROTOCOL 0x0002
13#define SYS_SEM_ATTR_PSHARED 0x0200
14
15#ifdef __cplusplus
16 extern "C" {
17#endif
18
20typedef struct sys_sem_attr
21{
27 u64 key;
29 s32 flags;
31 u32 pad;
33 char name[8];
35
43LV2_SYSCALL sysSemCreate(sys_sem_t *sem,const sys_sem_attr_t *attr,s32 initial_val,s32 max_val)
44{
45 lv2syscall4(90,(u64)sem,(u64)attr,initial_val,max_val);
46 return_to_user_prog(s32);
47}
48
53LV2_SYSCALL sysSemDestroy(sys_sem_t sem)
54{
55 lv2syscall1(91,sem);
56 return_to_user_prog(s32);
57}
58
65LV2_SYSCALL sysSemWait(sys_sem_t sem,u64 timeout_usec)
66{
67 lv2syscall2(92,sem,timeout_usec);
68 return_to_user_prog(s32);
69}
70
76LV2_SYSCALL sysSemTryWait(sys_sem_t sem)
77{
78 lv2syscall1(93,sem);
79 return_to_user_prog(s32);
80}
81
87LV2_SYSCALL sysSemPost(sys_sem_t sem,s32 count)
88{
89 lv2syscall2(94,sem,count);
90 return_to_user_prog(s32);
91}
92
98LV2_SYSCALL sysSemGetValue(sys_sem_t sem,s32 *count)
99{
100 lv2syscall2(114,sem,(u64)count);
101 return_to_user_prog(s32);
102}
103
104#ifdef __cplusplus
105 }
106#endif
107
108#endif
LV2_SYSCALL sysSemTryWait(sys_sem_t sem)
Reserve a semaphore (non-blocking).
Definition sem.h:76
LV2_SYSCALL sysSemWait(sys_sem_t sem, u64 timeout_usec)
Wait and reserve a semaphore.
Definition sem.h:65
LV2_SYSCALL sysSemDestroy(sys_sem_t sem)
Destroy a semaphore.
Definition sem.h:53
LV2_SYSCALL sysSemCreate(sys_sem_t *sem, const sys_sem_attr_t *attr, s32 initial_val, s32 max_val)
Create a semaphore.
Definition sem.h:43
struct sys_sem_attr sys_sem_attr_t
Semaphore sttributes data structure.
LV2_SYSCALL sysSemPost(sys_sem_t sem, s32 count)
Release a semaphore.
Definition sem.h:87
LV2_SYSCALL sysSemGetValue(sys_sem_t sem, s32 *count)
Get the value of a semaphore.
Definition sem.h:98
Semaphore sttributes data structure.
Definition sem.h:21
u32 attr_protocol
Management protocol (default is SYS_SEM_ATTR_PROTOCOL)
Definition sem.h:23
u32 pad
Unused padding member.
Definition sem.h:31
u32 attr_pshared
Sharing policy (default is SYS_SEM_ATTR_PSHARED)
Definition sem.h:25
s32 flags
Flags.
Definition sem.h:29
u64 key
Key.
Definition sem.h:27
char name[8]
Semaphore name.
Definition sem.h:33