Permalink
Browse files

Completed the lv2 syscalls for spu threads.

  • Loading branch information...
1 parent 66ce6f2 commit 72361744be3735ab1b9fafc677522769d978905a @zerkman zerkman committed Jan 10, 2011
Showing with 54 additions and 1 deletion.
  1. +54 −1 psl1ght/include/psl1ght/lv2/spu.h
@@ -21,6 +21,13 @@ typedef struct {
u32 attribute;
} Lv2SpuThreadAttributes;
+typedef struct {
+ u32 nameSize;
+ u32 nameAddress;
+ u32 groupType;
+ u32 memContainer;
+} Lv2SpuThreadGroupAttributes;
+
LV2_SYSCALL lv2SpuInitialize(u32 spus, u32 rawspus) { return Lv2Syscall2(169, spus, rawspus); }
LV2_SYSCALL lv2SpuRawCreate(u32* spu, u32* attributes) { return Lv2Syscall2(160, (u64)spu, (u64)attributes); }
@@ -38,7 +45,7 @@ LV2_SYSCALL lv2SpuRawRecoverPageFault(u32 spu) { return Lv2Syscall1(199, spu); }
LV2_SYSCALL lv2SpuImageOpen(sysSpuImage* image, const char* path) { return Lv2Syscall2(156, (u64)image, (u64)path); }
LV2_SYSCALL lv2SpuImageOpenFd(sysSpuImage* image, Lv2FsFile fd, u64 offset) { return Lv2Syscall3(260, (u64)image, fd, offset); }
-LV2_SYSCALL lv2SpuThreadInitialize(u32* thread, u32* group, u32 spu, sysSpuImage* image, Lv2SpuThreadAttributes* attributes, Lv2SpuThreadArguments* arguments) { return Lv2Syscall6(172, (u64)thread, (u64)group, spu, (u64)image, (u64)attributes, (u64)arguments); }
+LV2_SYSCALL lv2SpuThreadInitialize(u32* thread, u32 group, u32 spu, sysSpuImage* image, Lv2SpuThreadAttributes* attributes, Lv2SpuThreadArguments* arguments) { return Lv2Syscall6(172, (u64)thread, (u64)group, spu, (u64)image, (u64)attributes, (u64)arguments); }
LV2_SYSCALL lv2SpuThreadSetArguments(u32 thread, Lv2SpuThreadArguments* arguments) { return Lv2Syscall2(166, thread, (u64)arguments); }
LV2_SYSCALL lv2SpuThreadGetExitStatus(u32 thread, int* status) { return Lv2Syscall2(165, thread, (u64)status); }
LV2_SYSCALL lv2SpuThreadConnectEvent(u32 thread, u32 queue, u32 type, u8 spup) { return Lv2Syscall4(191, thread, queue, type, spup); }
@@ -52,11 +59,29 @@ LV2_SYSCALL lv2SpuThreadGetConfiguration(u32 thread, u64* value) { return Lv2Sys
LV2_SYSCALL lv2SpuThreadWriteMb(u32 thread, u32 value) { return Lv2Syscall2(190, thread, value); }
LV2_SYSCALL lv2SpuThreadRecoverPageFault(u32 thread) { return Lv2Syscall1(198, thread); }
+LV2_SYSCALL lv2SpuThreadGroupCreate(u32* group, u32 num, u32 pri, Lv2SpuThreadGroupAttributes * attr) { return Lv2Syscall4(170, (u64)group, num, pri, (u64)attr); }
+LV2_SYSCALL lv2SpuThreadGroupDestroy(u32 group) { return Lv2Syscall1(171, group); }
+LV2_SYSCALL lv2SpuThreadGroupStart(u32 group) { return Lv2Syscall1(173, group); }
+LV2_SYSCALL lv2SpuThreadGroupSuspend(u32 group) { return Lv2Syscall1(174, group); }
+LV2_SYSCALL lv2SpuThreadGroupResume(u32 group) { return Lv2Syscall1(175, group); }
+LV2_SYSCALL lv2SpuThreadGroupYield(u32 group) { return Lv2Syscall1(176, group); }
+LV2_SYSCALL lv2SpuThreadGroupTerminate(u32 group, u32 value) { return Lv2Syscall2(177, group, value); }
+LV2_SYSCALL lv2SpuThreadGroupJoin(u32 gid, u32 *cause, u32 *status) { return Lv2Syscall3(178, gid, (u64) cause, (u64)status); }
+LV2_SYSCALL lv2SpuThreadGroupSetPriority(u32 group, u32 pri) { return Lv2Syscall2(179, group, pri); }
+LV2_SYSCALL lv2SpuThreadGroupGetPriority(u32 group, u32 *pri) { return Lv2Syscall2(180, group, (u64)pri); }
+LV2_SYSCALL lv2SpuThreadGroupConnectEvent(u32 group, u32 eq, u32 et) { return Lv2Syscall3(185, group, eq, et); }
+LV2_SYSCALL lv2SpuThreadGroupDisconnectEvent(u32 group, u32 et) { return Lv2Syscall2(186, group, et); }
+LV2_SYSCALL lv2SpuThreadGroupConnectEventAllThreads(u32 group, u32 eq, u64 req, u8 *spup) { return Lv2Syscall4(251, group, eq, req, (u64)spup); }
+LV2_SYSCALL lv2SpuThreadGroupDisconnectEventAllThreads(u32 group, u8 spup) { return Lv2Syscall2(252, group, spup); }
+
#define LV2_SPU_RAW_BASE 0xE0000000ULL
#define LV2_SPU_RAW_OFFSET 0x00100000ULL
#define LV2_SPU_RAW_LOCAL_OFFSET 0x00000000ULL
#define LV2_SPU_RAW_PROBLEM_OFFSET 0x00040000ULL
+#define LV2_SPU_THREAD_BASE 0xF0000000ULL
+#define LV2_SPU_THREAD_OFFSET 0x00100000ULL
+
// Problem State Registers
#define MFC_LSA 0x00003004
#define MFC_EAH 0x00003008
@@ -80,6 +105,7 @@ LV2_SYSCALL lv2SpuThreadRecoverPageFault(u32 thread) { return Lv2Syscall1(198, t
#define LV2_SPU_RAW_GET_PROBLEM_STORAGE(spu, reg) \
(vu32*)(LV2_SPU_RAW_GET_BASE_OFFSET(spu) + LV2_SPU_RAW_PROBLEM_OFFSET + reg)
+
static inline void lv2SpuRawWriteProblemStorage(u32 spu, u32 reg, u32 value) {
*LV2_SPU_RAW_GET_PROBLEM_STORAGE(spu, reg) = value;
}
@@ -97,3 +123,30 @@ static inline void lv2SpuRawWriteLocalStorage(u32 spu, u32 reg, u32 value) {
static inline u32 lv2SpuRawReadLocalStorage(u32 spu, u32 reg) {
return *LV2_SPU_RAW_GET_LOCAL_STORAGE(spu, reg);
}
+
+#define LV2_SPU_THREAD_GET_BASE_OFFSET(spu) \
+ (LV2_SPU_THREAD_BASE + LV2_SPU_THREAD_OFFSET * (spu))
+
+#define LV2_SPU_THREAD_GET_PROBLEM_STORAGE(spu, reg) \
+ (vu32*)(LV2_SPU_THREAD_GET_BASE_OFFSET(spu) + LV2_SPU_RAW_PROBLEM_OFFSET + reg)
+
+static inline void lv2SpuThreadWriteProblemStorage(u32 spu, u32 reg, u32 value) {
+ *LV2_SPU_THREAD_GET_PROBLEM_STORAGE(spu, reg) = value;
+}
+
+static inline u32 lv2SpuThreadReadProblemStorage(u32 spu, u32 reg) {
+ return *LV2_SPU_THREAD_GET_PROBLEM_STORAGE(spu, reg);
+}
+
+#define LV2_SPU_THREAD_GET_LOCAL_STORAGE(spu, reg) \
+ (vu32*)(LV2_SPU_THREAD_GET_BASE_OFFSET(spu) + LV2_SPU_RAW_LOCAL_OFFSET + reg)
+
+/*
+static inline void lv2SpuThreadWriteLocalStorage(u32 spu, u32 reg, u32 value) {
+ *LV2_SPU_THREAD_GET_LOCAL_STORAGE(spu, reg) = value;
+}
+
+static inline u32 lv2SpuThreadReadLocalStorage(u32 spu, u32 reg) {
+ return *LV2_SPU_THREAD_GET_LOCAL_STORAGE(spu, reg);
+}
+*/

0 comments on commit 7236174

Please sign in to comment.