psl1ght
A free SDK for Sony's PS3 console
Loading...
Searching...
No Matches
spu.h File Reference

SPU management syscalls. More...

#include <ppu-asm.h>
#include <ppu-lv2.h>
#include <lv2/spu.h>

Go to the source code of this file.

Data Structures

struct  _sys_spu_thread_arg
 A structure containing the arguments passed to the SPU main function. More...
 
struct  _sys_spu_thread_attr
 A structure containing SPU thread attributes. More...
 
struct  _sys_spu_thread_group_attr
 A structure containing SPU thread group attributes. More...
 

Macros

#define MFC_LSA   0x3004
 local store address
 
#define MFC_EAH   0x3008
 effective address high
 
#define MFC_EAL   0x300C
 effective address low
 
#define MFC_Size   0x3010
 size of MFC DMA transfer
 
#define MFC_Class_CMD   0x3014
 class of MFC command
 
#define MFC_CMD_Status   0x3014
 MFC command status.
 
#define MFC_QStatus   0x3104
 MFC query status.
 
#define Prxy_QueryType   0x3204
 Proxy query type.
 
#define Prxy_QueryMask   0x321C
 Proxy Query mask.
 
#define Prxy_TagStatus   0x322C
 Proxy tag status.
 
#define SPU_Out_MBox   0x4004
 Outbound mailbox.
 
#define SPU_In_MBox   0x400C
 Inbound mailbox.
 
#define SPU_MBox_Status   0x4014
 Outbound mailbox status.
 
#define SPU_RunCtrl   0x401C
 SPU Run control.
 
#define SPU_Status   0x4024
 SPU status.
 
#define SPU_NextPC   0x4034
 SPU next PC.
 
#define SPU_Sig_Notify_1   0x1400C
 Signal notification 1.
 
#define SPU_Sig_Notify_2   0x1C00C
 Signal notification 2.
 
#define SPU_THREAD_GROUP_TYPE_NORMAL   0x0
 
#define SPU_THREAD_GROUP_TYPE_SEQUENTIAL   0x1
 
#define SPU_THREAD_GROUP_TYPE_SYSTEM   0x2
 
#define SPU_THREAD_GROUP_TYPE_MEMORY_FROM_CONTAINER   0x4
 
#define SPU_THREAD_GROUP_JOIN_GROUP_EXIT   0x0001
 
#define SPU_THREAD_GROUP_JOIN_ALL_THREADS_EXIT   0x0002
 
#define SPU_THREAD_GROUP_JOIN_TERMINATED   0x0004
 
#define SPU_THREAD_GROUP_EVENT_RUN   0x1
 
#define SPU_THREAD_GROUP_EVENT_RUN_KEY   0xFFFFFFFF53505500ULL
 
#define SPU_THREAD_GROUP_EVENT_EXCEPTION   0x2
 
#define SPU_THREAD_GROUP_EVENT_EXCEPTION_KEY   0xFFFFFFFF53505503ULL
 
#define SPU_THREAD_ATTR_NONE   0x00
 No thread attributes.
 
#define SPU_THREAD_ATTR_ASYNC_INT_ENABLE   0x01
 Enables interrupts.
 
#define SPU_THREAD_ATTR_DEC_SYNC_TB_ENABLE   0x02
 Synchronize SPU decrementer with PPU time base.
 
#define SPU_THREAD_EVENT_USER   0x01
 User SPU thread event.
 
#define SPU_THREAD_EVENT_DMA   0x02
 DMA SPU thread event.
 
#define SPU_THREAD_EVENT_USER_KEY   0xFFFFFFFF53505501ULL
 SPU thread event user key.
 
#define SPU_THREAD_EVENT_DMA_KEY   0xFFFFFFFF53505502ULL
 SPU thread event DMA key.
 
#define SPU_SIGNAL1_OVERWRITE   0x00
 Configure signal notification register 1 to overwrite mode.
 
#define SPU_SIGNAL1_OR   0x01
 Configure signal notification register 1 to OR mode.
 
#define SPU_SIGNAL2_OVERWRITE   0x00
 Configure signal notification register 2 to overwrite mode.
 
#define SPU_SIGNAL2_OR   0x02
 Configure signal notification register 2 to OR mode.
 
#define SPU_EXCEPTION_DMA_ALIGNMENT   0x0001U
 
#define SPU_EXCEPTION_DMA_COMMAND   0x0002U
 
#define SPU_EXCEPTION_SPU_ERROR   0x0004U
 
#define SPU_EXCEPTION_MFC_FIR   0x0008U
 
#define SPU_EXCEPTION_MFC_SEGMENT   0x0010U
 
#define SPU_EXCEPTION_MFC_STORAGE   0x0020U
 
#define SPU_EXCEPTION_STOP_CALL   0x0100U
 
#define SPU_EXCEPTION_STOP_BREAK   0x0200U
 
#define SPU_EXCEPTION_HALT   0x0400U
 
#define SPU_EXCEPTION_UNKNOWN_SIGNAL   0x0800U
 
#define SPU_EXCEPTION_NO_VALUE   0x0U
 
#define SPU_THREAD_BASE   0xF0000000ULL
 Base of memory-mapped SPU thread resources.
 
#define SPU_THREAD_OFFSET   0x00100000ULL
 Offset between resources for consecutive SPU threads.
 
#define SPU_RAW_BASE   0xE0000000ULL
 Base of memory-mapped raw SPU program resources.
 
#define SPU_RAW_OFFSET   0x00100000ULL
 Offset between resources for consecutive raw SPU programs.
 
#define SPU_LOCAL_OFFSET   0x00000000ULL
 Offset from the beginning of a SPU thread/raw program's resources for local store memory.
 
#define SPU_PROBLEM_OFFSET   0x00040000ULL
 Offset from the beginning of a SPU thread/raw program's resources for IO registers.
 
#define SPU_RAW_GET_BASE_OFFSET(spu)    (SPU_RAW_BASE + (SPU_RAW_OFFSET*(spu)))
 Get base offset for a raw SPU program.
 
#define SPU_RAW_GET_LOCAL_STORAGE(spu, reg)    (SPU_RAW_GET_BASE_OFFSET(spu) + SPU_LOCAL_OFFSET + (reg))
 Returns the memory-mapped address of local storage of a raw SPU.
 
#define SPU_RAW_GET_PROBLEM_STORAGE(spu, reg)    (SPU_RAW_GET_BASE_OFFSET(spu) + SPU_PROBLEM_OFFSET + (reg))
 Returns the memory-mapped address of problem storage of a raw SPU.
 
#define SPU_THREAD_GET_BASE_OFFSET(spu)    (SPU_THREAD_BASE + (SPU_THREAD_OFFSET*(spu)))
 Get base offset for a SPU thread.
 
#define SPU_THREAD_GET_LOCAL_STORAGE(spu, reg)    (SPU_THREAD_GET_BASE_OFFSET(spu) + SPU_LOCAL_OFFSET + (reg))
 Returns the memory-mapped address of local storage of a SPU thread.
 
#define SPU_THREAD_GET_PROBLEM_STORAGE(spu, reg)    (SPU_THREAD_GET_BASE_OFFSET(spu) + SPU_PROBLEM_OFFSET + (reg))
 Returns the memory-mapped address of problem storage of a SPU thread.
 
#define sysSpuThreadAttributeInitialize(x)
 
#define sysSpuThreadAttributeName(x, s)
 
#define sysSpuThreadAttributeOption(x, f)
 
#define sysSpuThreadArgumentInitialize(x)
 
#define sysSpuThreadGroupAttributeInitialize(x)
 
#define sysSpuThreadGroupAttributeName(x, s)
 
#define sysSpuThreadGroupAttributeType(x, t)
 
#define sysSpuThreadGroupAttributeMemoryContainer(x, ct)
 

Typedefs

typedef struct _sys_spu_thread_arg sysSpuThreadArgument
 A structure containing the arguments passed to the SPU main function.
 
typedef struct _sys_spu_thread_attr sysSpuThreadAttribute
 A structure containing SPU thread attributes.
 
typedef struct _sys_spu_thread_group_attr sysSpuThreadGroupAttribute
 A structure containing SPU thread group attributes.
 

Functions

LV2_SYSCALL sysSpuInitialize (u32 spus, u32 rawspus)
 Initialize the SPU management.
 
LV2_SYSCALL sysSpuRawCreate (sys_raw_spu_t *spu, u32 *attributes)
 Allocate a raw SPU.
 
LV2_SYSCALL sysSpuRawDestroy (sys_raw_spu_t spu)
 De-allocate a raw SPU.
 
LV2_SYSCALL sysSpuRawCreateInterrupTag (sys_raw_spu_t spu, u32 classid, u32 hardwarethread, u32 *tag)
 Create an interrupt tag for a raw SPU.
 
LV2_SYSCALL sysSpuRawSetIntMask (sys_raw_spu_t spu, u32 classid, u64 mask)
 Set the value of the interrupt mask register for a raw SPU.
 
LV2_SYSCALL sysSpuRawGetIntMask (sys_raw_spu_t spu, u32 classid, u64 *mask)
 Get the value of the interrupt mask register for a raw SPU.
 
LV2_SYSCALL sysSpuRawSetIntStat (sys_raw_spu_t spu, u32 classid, u64 stat)
 Set the value of the interrupt status register for a raw SPU.
 
LV2_SYSCALL sysSpuRawGetIntStat (sys_raw_spu_t spu, u32 classid, u64 *stat)
 Get the value of the interrupt status register for a raw SPU.
 
LV2_SYSCALL sysSpuRawReadPuintMb (sys_raw_spu_t spu, u32 *value)
 Read from the raw SPU's outbound interrupt mailbox register.
 
LV2_SYSCALL sysSpuRawSetConfiguration (sys_raw_spu_t spu, u32 value)
 Configure the raw SPU's signal notification.
 
LV2_SYSCALL sysSpuRawGetConfirugation (sys_raw_spu_t spu, u32 *value)
 Get the configuration of the raw SPU's signal notification.
 
LV2_SYSCALL sysSpuRawRecoverPageFault (sys_raw_spu_t spu)
 Recover a raw SPU from a page fault.
 
LV2_SYSCALL sysSpuImageOpen (sysSpuImage *image, const char *path)
 Create a SPU image from an ELF file.
 
LV2_SYSCALL sysSpuImageOpenFd (sysSpuImage *image, s32 fd, u64 offset)
 Create a SPU image from an open binary file.
 
LV2_SYSCALL sysSpuThreadInitialize (sys_spu_thread_t *thread, sys_spu_group_t group, u32 spu, sysSpuImage *image, sysSpuThreadAttribute *attributes, sysSpuThreadArgument *arguments)
 Initialize a SPU thread.
 
LV2_SYSCALL sysSpuThreadSetArguments (sys_spu_thread_t thread, sysSpuThreadArgument *arguments)
 Set the SPU thread arguments.
 
LV2_SYSCALL sysSpuThreadGetExitStatus (sys_spu_thread_t thread, s32 *status)
 Get the exit status of a thread.
 
LV2_SYSCALL sysSpuThreadConnectEvent (sys_spu_thread_t thread, sys_event_queue_t queue, u32 type, u8 spup)
 Connect an event queue to a SPU thread.
 
LV2_SYSCALL sysSpuThreadDisconnectEvent (sys_spu_thread_t thread, u32 type, u8 spup)
 Disconnect an event queue from a SPU thread.
 
LV2_SYSCALL sysSpuThreadBindQueue (sys_spu_thread_t thread, sys_event_queue_t queue, u32 spuq_num)
 Bind an event queue to a SPU thread.
 
LV2_SYSCALL sysSpuThreadUnbindQueue (sys_spu_thread_t thread, u32 spuq_num)
 Unbind an event queue from a SPU thread.
 
LV2_SYSCALL sysSpuThreadWriteLocalStorage (sys_spu_thread_t thread, u32 address, u64 value, u32 type)
 Write a value to a SPU thread's local store memory.
 
LV2_SYSCALL sysSpuThreadReadLocalStorage (sys_spu_thread_t thread, u32 address, u64 *value, u32 type)
 Read a value From the SPU thread's local store memory.
 
LV2_SYSCALL sysSpuThreadWriteSignal (sys_spu_thread_t thread, u32 signal, u32 value)
 Write to the SPU thread's signal notification register.
 
LV2_SYSCALL sysSpuThreadSetConfiguration (sys_spu_thread_t thread, u64 value)
 Configure the SPU thread's signal notification.
 
LV2_SYSCALL sysSpuThreadGetConfiguration (sys_spu_thread_t thread, u64 *value)
 Get the configuration of the SPU thread's signal notification.
 
LV2_SYSCALL sysSpuThreadWriteMb (sys_spu_thread_t thread, u32 value)
 Write to the SPU thread's inbound mailbox register.
 
LV2_SYSCALL sysSpuThreadRecoverPageFault (sys_spu_thread_t thread)
 Recover from a SPU thread page fault.
 
LV2_SYSCALL sysSpuThreadGroupCreate (sys_spu_group_t *group, u32 num, u32 prio, sysSpuThreadGroupAttribute *attr)
 Create a SPU thread group.
 
LV2_SYSCALL sysSpuThreadGroupDestroy (sys_spu_group_t group)
 Destroy a SPU thread group.
 
LV2_SYSCALL sysSpuThreadGroupStart (sys_spu_group_t group)
 Start a SPU thread group.
 
LV2_SYSCALL sysSpuThreadGroupSuspend (sys_spu_group_t group)
 Suspend a SPU thread group.
 
LV2_SYSCALL sysSpuThreadGroupResume (sys_spu_group_t group)
 Resume a SPU thread group.
 
LV2_SYSCALL sysSpuThreadGroupYield (sys_spu_group_t group)
 Yield a SPU thread group.
 
LV2_SYSCALL sysSpuThreadGroupTerminate (sys_spu_group_t group, u32 value)
 Terminate a SPU thread group.
 
LV2_SYSCALL sysSpuThreadGroupJoin (sys_spu_group_t group, u32 *cause, u32 *status)
 Wait for a SPU thread group to finish its execution.
 
LV2_SYSCALL sysSpuThreadGroupSetPriority (sys_spu_group_t group, u32 prio)
 Set a SPU thread group's priority.
 
LV2_SYSCALL sysSpuThreadGroupGetPriority (sys_spu_group_t group, u32 *prio)
 Get a SPU thread group's priority.
 
LV2_SYSCALL sysSpuThreadGroupConnectEvent (sys_spu_group_t group, sys_event_queue_t eventQ, u32 eventType)
 
LV2_SYSCALL sysSpuThreadGroupDisconnectEvent (sys_spu_group_t group, u32 eventType)
 
LV2_SYSCALL sysSpuThreadGroupConnectEventAllThreads (sys_spu_group_t group, sys_event_queue_t eventQ, u64 req, u8 *spup)
 
LV2_SYSCALL sysSpuThreadGroupDisonnectEventAllThreads (sys_spu_group_t group, u8 spup)
 
static void sysSpuRawWriteProblemStorage (sys_raw_spu_t spu, u32 reg, u32 value)
 
static u32 sysSpuRawReadProblemStorage (sys_raw_spu_t spu, u32 reg)
 
static void sysSpuRawWriteLocalStorage (sys_raw_spu_t spu, u32 reg, u32 value)
 
static u32 sysSpuRawReadLocalStorage (sys_raw_spu_t spu, u32 reg)
 
static void sysSpuThreadWriteProblemStorage (sys_raw_spu_t spu, u32 reg, u32 value)
 
static u32 sysSpuThreadReadProblemStorage (sys_raw_spu_t spu, u32 reg)
 

Detailed Description

SPU management syscalls.

These are the LV2 syscalls for SPU management (raw SPUs and SPU threads).

See also
Quick guide to SPU management

Definition in file spu.h.

Macro Definition Documentation

◆ MFC_Class_CMD

#define MFC_Class_CMD   0x3014

class of MFC command

Definition at line 110 of file spu.h.

◆ MFC_CMD_Status

#define MFC_CMD_Status   0x3014

MFC command status.

Definition at line 111 of file spu.h.

◆ MFC_EAH

#define MFC_EAH   0x3008

effective address high

Definition at line 107 of file spu.h.

◆ MFC_EAL

#define MFC_EAL   0x300C

effective address low

Definition at line 108 of file spu.h.

◆ MFC_LSA

#define MFC_LSA   0x3004

local store address

Definition at line 106 of file spu.h.

◆ MFC_QStatus

#define MFC_QStatus   0x3104

MFC query status.

Definition at line 112 of file spu.h.

◆ MFC_Size

#define MFC_Size   0x3010

size of MFC DMA transfer

Definition at line 109 of file spu.h.

◆ Prxy_QueryMask

#define Prxy_QueryMask   0x321C

Proxy Query mask.

Definition at line 114 of file spu.h.

◆ Prxy_QueryType

#define Prxy_QueryType   0x3204

Proxy query type.

Definition at line 113 of file spu.h.

◆ Prxy_TagStatus

#define Prxy_TagStatus   0x322C

Proxy tag status.

Definition at line 115 of file spu.h.

◆ SPU_EXCEPTION_DMA_ALIGNMENT

#define SPU_EXCEPTION_DMA_ALIGNMENT   0x0001U

Definition at line 166 of file spu.h.

◆ SPU_EXCEPTION_DMA_COMMAND

#define SPU_EXCEPTION_DMA_COMMAND   0x0002U

Definition at line 167 of file spu.h.

◆ SPU_EXCEPTION_HALT

#define SPU_EXCEPTION_HALT   0x0400U

Definition at line 174 of file spu.h.

◆ SPU_EXCEPTION_MFC_FIR

#define SPU_EXCEPTION_MFC_FIR   0x0008U

Definition at line 169 of file spu.h.

◆ SPU_EXCEPTION_MFC_SEGMENT

#define SPU_EXCEPTION_MFC_SEGMENT   0x0010U

Definition at line 170 of file spu.h.

◆ SPU_EXCEPTION_MFC_STORAGE

#define SPU_EXCEPTION_MFC_STORAGE   0x0020U

Definition at line 171 of file spu.h.

◆ SPU_EXCEPTION_NO_VALUE

#define SPU_EXCEPTION_NO_VALUE   0x0U

Definition at line 176 of file spu.h.

◆ SPU_EXCEPTION_SPU_ERROR

#define SPU_EXCEPTION_SPU_ERROR   0x0004U

Definition at line 168 of file spu.h.

◆ SPU_EXCEPTION_STOP_BREAK

#define SPU_EXCEPTION_STOP_BREAK   0x0200U

Definition at line 173 of file spu.h.

◆ SPU_EXCEPTION_STOP_CALL

#define SPU_EXCEPTION_STOP_CALL   0x0100U

Definition at line 172 of file spu.h.

◆ SPU_EXCEPTION_UNKNOWN_SIGNAL

#define SPU_EXCEPTION_UNKNOWN_SIGNAL   0x0800U

Definition at line 175 of file spu.h.

◆ SPU_In_MBox

#define SPU_In_MBox   0x400C

Inbound mailbox.

Definition at line 117 of file spu.h.

◆ SPU_LOCAL_OFFSET

#define SPU_LOCAL_OFFSET   0x00000000ULL

Offset from the beginning of a SPU thread/raw program's resources for local store memory.

Definition at line 187 of file spu.h.

◆ SPU_MBox_Status

#define SPU_MBox_Status   0x4014

Outbound mailbox status.

Definition at line 118 of file spu.h.

◆ SPU_NextPC

#define SPU_NextPC   0x4034

SPU next PC.

Definition at line 121 of file spu.h.

◆ SPU_Out_MBox

#define SPU_Out_MBox   0x4004

Outbound mailbox.

Definition at line 116 of file spu.h.

◆ SPU_PROBLEM_OFFSET

#define SPU_PROBLEM_OFFSET   0x00040000ULL

Offset from the beginning of a SPU thread/raw program's resources for IO registers.

Definition at line 189 of file spu.h.

◆ SPU_RAW_BASE

#define SPU_RAW_BASE   0xE0000000ULL

Base of memory-mapped raw SPU program resources.

Definition at line 183 of file spu.h.

◆ SPU_RAW_GET_BASE_OFFSET

#define SPU_RAW_GET_BASE_OFFSET (   spu)     (SPU_RAW_BASE + (SPU_RAW_OFFSET*(spu)))

Get base offset for a raw SPU program.

Parameters
spuSPU number (0-5)

Definition at line 194 of file spu.h.

◆ SPU_RAW_GET_LOCAL_STORAGE

#define SPU_RAW_GET_LOCAL_STORAGE (   spu,
  reg 
)     (SPU_RAW_GET_BASE_OFFSET(spu) + SPU_LOCAL_OFFSET + (reg))

Returns the memory-mapped address of local storage of a raw SPU.

Definition at line 198 of file spu.h.

◆ SPU_RAW_GET_PROBLEM_STORAGE

#define SPU_RAW_GET_PROBLEM_STORAGE (   spu,
  reg 
)     (SPU_RAW_GET_BASE_OFFSET(spu) + SPU_PROBLEM_OFFSET + (reg))

Returns the memory-mapped address of problem storage of a raw SPU.

Definition at line 202 of file spu.h.

◆ SPU_RAW_OFFSET

#define SPU_RAW_OFFSET   0x00100000ULL

Offset between resources for consecutive raw SPU programs.

Definition at line 185 of file spu.h.

◆ SPU_RunCtrl

#define SPU_RunCtrl   0x401C

SPU Run control.

Definition at line 119 of file spu.h.

◆ SPU_Sig_Notify_1

#define SPU_Sig_Notify_1   0x1400C

Signal notification 1.

Definition at line 122 of file spu.h.

◆ SPU_Sig_Notify_2

#define SPU_Sig_Notify_2   0x1C00C

Signal notification 2.

Definition at line 123 of file spu.h.

◆ SPU_SIGNAL1_OR

#define SPU_SIGNAL1_OR   0x01

Configure signal notification register 1 to OR mode.

Definition at line 159 of file spu.h.

◆ SPU_SIGNAL1_OVERWRITE

#define SPU_SIGNAL1_OVERWRITE   0x00

Configure signal notification register 1 to overwrite mode.

Definition at line 157 of file spu.h.

◆ SPU_SIGNAL2_OR

#define SPU_SIGNAL2_OR   0x02

Configure signal notification register 2 to OR mode.

Definition at line 163 of file spu.h.

◆ SPU_SIGNAL2_OVERWRITE

#define SPU_SIGNAL2_OVERWRITE   0x00

Configure signal notification register 2 to overwrite mode.

Definition at line 161 of file spu.h.

◆ SPU_Status

#define SPU_Status   0x4024

SPU status.

Definition at line 120 of file spu.h.

◆ SPU_THREAD_ATTR_ASYNC_INT_ENABLE

#define SPU_THREAD_ATTR_ASYNC_INT_ENABLE   0x01

Enables interrupts.

Definition at line 142 of file spu.h.

◆ SPU_THREAD_ATTR_DEC_SYNC_TB_ENABLE

#define SPU_THREAD_ATTR_DEC_SYNC_TB_ENABLE   0x02

Synchronize SPU decrementer with PPU time base.

Definition at line 144 of file spu.h.

◆ SPU_THREAD_ATTR_NONE

#define SPU_THREAD_ATTR_NONE   0x00

No thread attributes.

Definition at line 140 of file spu.h.

◆ SPU_THREAD_BASE

#define SPU_THREAD_BASE   0xF0000000ULL

Base of memory-mapped SPU thread resources.

Definition at line 179 of file spu.h.

◆ SPU_THREAD_EVENT_DMA

#define SPU_THREAD_EVENT_DMA   0x02

DMA SPU thread event.

Definition at line 149 of file spu.h.

◆ SPU_THREAD_EVENT_DMA_KEY

#define SPU_THREAD_EVENT_DMA_KEY   0xFFFFFFFF53505502ULL

SPU thread event DMA key.

Definition at line 154 of file spu.h.

◆ SPU_THREAD_EVENT_USER

#define SPU_THREAD_EVENT_USER   0x01

User SPU thread event.

Definition at line 147 of file spu.h.

◆ SPU_THREAD_EVENT_USER_KEY

#define SPU_THREAD_EVENT_USER_KEY   0xFFFFFFFF53505501ULL

SPU thread event user key.

Definition at line 152 of file spu.h.

◆ SPU_THREAD_GET_BASE_OFFSET

#define SPU_THREAD_GET_BASE_OFFSET (   spu)     (SPU_THREAD_BASE + (SPU_THREAD_OFFSET*(spu)))

Get base offset for a SPU thread.

Parameters
spuSPU thread id

Definition at line 208 of file spu.h.

◆ SPU_THREAD_GET_LOCAL_STORAGE

#define SPU_THREAD_GET_LOCAL_STORAGE (   spu,
  reg 
)     (SPU_THREAD_GET_BASE_OFFSET(spu) + SPU_LOCAL_OFFSET + (reg))

Returns the memory-mapped address of local storage of a SPU thread.

Definition at line 212 of file spu.h.

◆ SPU_THREAD_GET_PROBLEM_STORAGE

#define SPU_THREAD_GET_PROBLEM_STORAGE (   spu,
  reg 
)     (SPU_THREAD_GET_BASE_OFFSET(spu) + SPU_PROBLEM_OFFSET + (reg))

Returns the memory-mapped address of problem storage of a SPU thread.

Definition at line 216 of file spu.h.

◆ SPU_THREAD_GROUP_EVENT_EXCEPTION

#define SPU_THREAD_GROUP_EVENT_EXCEPTION   0x2

Definition at line 136 of file spu.h.

◆ SPU_THREAD_GROUP_EVENT_EXCEPTION_KEY

#define SPU_THREAD_GROUP_EVENT_EXCEPTION_KEY   0xFFFFFFFF53505503ULL

Definition at line 137 of file spu.h.

◆ SPU_THREAD_GROUP_EVENT_RUN

#define SPU_THREAD_GROUP_EVENT_RUN   0x1

Definition at line 134 of file spu.h.

◆ SPU_THREAD_GROUP_EVENT_RUN_KEY

#define SPU_THREAD_GROUP_EVENT_RUN_KEY   0xFFFFFFFF53505500ULL

Definition at line 135 of file spu.h.

◆ SPU_THREAD_GROUP_JOIN_ALL_THREADS_EXIT

#define SPU_THREAD_GROUP_JOIN_ALL_THREADS_EXIT   0x0002

Definition at line 131 of file spu.h.

◆ SPU_THREAD_GROUP_JOIN_GROUP_EXIT

#define SPU_THREAD_GROUP_JOIN_GROUP_EXIT   0x0001

Definition at line 130 of file spu.h.

◆ SPU_THREAD_GROUP_JOIN_TERMINATED

#define SPU_THREAD_GROUP_JOIN_TERMINATED   0x0004

Definition at line 132 of file spu.h.

◆ SPU_THREAD_GROUP_TYPE_MEMORY_FROM_CONTAINER

#define SPU_THREAD_GROUP_TYPE_MEMORY_FROM_CONTAINER   0x4

Definition at line 128 of file spu.h.

◆ SPU_THREAD_GROUP_TYPE_NORMAL

#define SPU_THREAD_GROUP_TYPE_NORMAL   0x0

Definition at line 125 of file spu.h.

◆ SPU_THREAD_GROUP_TYPE_SEQUENTIAL

#define SPU_THREAD_GROUP_TYPE_SEQUENTIAL   0x1

Definition at line 126 of file spu.h.

◆ SPU_THREAD_GROUP_TYPE_SYSTEM

#define SPU_THREAD_GROUP_TYPE_SYSTEM   0x2

Definition at line 127 of file spu.h.

◆ SPU_THREAD_OFFSET

#define SPU_THREAD_OFFSET   0x00100000ULL

Offset between resources for consecutive SPU threads.

Definition at line 181 of file spu.h.

◆ sysSpuThreadArgumentInitialize

#define sysSpuThreadArgumentInitialize (   x)
Value:
do { \
x.arg0 = x.arg1 = x.arg2 = x.arg3 = 0; \
} while(0)

Definition at line 282 of file spu.h.

◆ sysSpuThreadAttributeInitialize

#define sysSpuThreadAttributeInitialize (   x)
Value:
do { \
x.name = NULL; \
x.nsize = 0; \
x.option = SPU_THREAD_ATTR_NONE; \
} while(0)
#define SPU_THREAD_ATTR_NONE
No thread attributes.
Definition spu.h:140

Definition at line 257 of file spu.h.

◆ sysSpuThreadAttributeName

#define sysSpuThreadAttributeName (   x,
 
)
Value:
do { \
x.name = s; \
if(s == NULL) { \
x.nsize = 0; \
} else { \
int n = 0; \
for(; (n<127) && (s[n] != '\0'); n++) \
; \
x.nsize = n + 1; \
} \
} while(0)

Definition at line 264 of file spu.h.

◆ sysSpuThreadAttributeOption

#define sysSpuThreadAttributeOption (   x,
 
)
Value:
do { \
x.option = f; \
} while(0)

Definition at line 277 of file spu.h.

◆ sysSpuThreadGroupAttributeInitialize

#define sysSpuThreadGroupAttributeInitialize (   x)
Value:
do { \
x.name = NULL; \
x.nsize = 0; \
} while(0)
#define SPU_THREAD_GROUP_TYPE_NORMAL
Definition spu.h:125

Definition at line 287 of file spu.h.

◆ sysSpuThreadGroupAttributeMemoryContainer

#define sysSpuThreadGroupAttributeMemoryContainer (   x,
  ct 
)
Value:
do { \
x.option.ct = ct; \
} while(0)
#define SPU_THREAD_GROUP_TYPE_MEMORY_FROM_CONTAINER
Definition spu.h:128

Definition at line 312 of file spu.h.

◆ sysSpuThreadGroupAttributeName

#define sysSpuThreadGroupAttributeName (   x,
 
)
Value:
do { \
x.name = s; \
if(s == NULL) { \
x.nsize = 0; \
} else { \
int n = 0; \
for(; (n<127) && (s[n] != '\0'); n++) \
; \
x.nsize = n + 1; \
} \
} while(0)

Definition at line 294 of file spu.h.

◆ sysSpuThreadGroupAttributeType

#define sysSpuThreadGroupAttributeType (   x,
 
)
Value:
do { \
x.type = t; \
} while(0)

Definition at line 307 of file spu.h.

Typedef Documentation

◆ sysSpuThreadArgument

A structure containing the arguments passed to the SPU main function.

◆ sysSpuThreadAttribute

A structure containing SPU thread attributes.

Possible values for attribute flags are SPU_THREAD_ATTR_NONE or an OR'ed list of the following flags:

◆ sysSpuThreadGroupAttribute

A structure containing SPU thread group attributes.

Function Documentation

◆ sysSpuImageOpen()

LV2_SYSCALL sysSpuImageOpen ( sysSpuImage image,
const char *  path 
)

Create a SPU image from an ELF file.

Parameters
imagePointer to the SPU image structure.
pathThe pathname of the ELF file to be read from.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 511 of file spu.h.

◆ sysSpuImageOpenFd()

LV2_SYSCALL sysSpuImageOpenFd ( sysSpuImage image,
s32  fd,
u64  offset 
)

Create a SPU image from an open binary file.

Parameters
imagePointer to the SPU image structure.
fdFile descriptor of the opened file.
offsetOffset to the beginning of the SPU image in the file.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 527 of file spu.h.

◆ sysSpuInitialize()

LV2_SYSCALL sysSpuInitialize ( u32  spus,
u32  rawspus 
)

Initialize the SPU management.

Parameters
spusTotal number of needed SPUs (from 1 to 6).
rawspusNumber of required raw SPUs (from 1 to 5).
Returns
zero if no error occured, nonzero otherwise.

Definition at line 326 of file spu.h.

◆ sysSpuRawCreate()

LV2_SYSCALL sysSpuRawCreate ( sys_raw_spu_t *  spu,
u32 *  attributes 
)

Allocate a raw SPU.

Parameters
spuPointer to a returned raw SPU identifier.
attributesPointer to an attributes structure (or NULL if default attributes are used).
Returns
zero if no error occured, nonzero otherwise.

Definition at line 340 of file spu.h.

◆ sysSpuRawCreateInterrupTag()

LV2_SYSCALL sysSpuRawCreateInterrupTag ( sys_raw_spu_t  spu,
u32  classid,
u32  hardwarethread,
u32 *  tag 
)

Create an interrupt tag for a raw SPU.

Parameters
spuThe raw SPU identifier.
classidThe interrupt class identifier.
hardwarethreadThe hardware thread identifier.
tagPointer to the returned interrupt tag identifier.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 370 of file spu.h.

◆ sysSpuRawDestroy()

LV2_SYSCALL sysSpuRawDestroy ( sys_raw_spu_t  spu)

De-allocate a raw SPU.

Parameters
spuThe raw SPU identifier.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 352 of file spu.h.

◆ sysSpuRawGetConfirugation()

LV2_SYSCALL sysSpuRawGetConfirugation ( sys_raw_spu_t  spu,
u32 *  value 
)

Get the configuration of the raw SPU's signal notification.

Parameters
spuThe raw SPU identifier.
valuePointer to the read configuration value, which is a OR combination of the following values:
Returns
zero if no error occured, nonzero otherwise.

Definition at line 485 of file spu.h.

◆ sysSpuRawGetIntMask()

LV2_SYSCALL sysSpuRawGetIntMask ( sys_raw_spu_t  spu,
u32  classid,
u64 *  mask 
)

Get the value of the interrupt mask register for a raw SPU.

Parameters
spuThe raw SPU identifier.
classidThe interrupt class identifier.
maskPointer to the returned interrupt mask register value.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 402 of file spu.h.

◆ sysSpuRawGetIntStat()

LV2_SYSCALL sysSpuRawGetIntStat ( sys_raw_spu_t  spu,
u32  classid,
u64 *  stat 
)

Get the value of the interrupt status register for a raw SPU.

Parameters
spuThe raw SPU identifier.
classidThe interrupt class identifier.
maskPointer to the returned interrupt status register value.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 434 of file spu.h.

◆ sysSpuRawReadLocalStorage()

static u32 sysSpuRawReadLocalStorage ( sys_raw_spu_t  spu,
u32  reg 
)
inlinestatic

Definition at line 961 of file spu.h.

◆ sysSpuRawReadProblemStorage()

static u32 sysSpuRawReadProblemStorage ( sys_raw_spu_t  spu,
u32  reg 
)
inlinestatic

Definition at line 951 of file spu.h.

◆ sysSpuRawReadPuintMb()

LV2_SYSCALL sysSpuRawReadPuintMb ( sys_raw_spu_t  spu,
u32 *  value 
)

Read from the raw SPU's outbound interrupt mailbox register.

Parameters
spuThe raw SPU identifier.
valuePointer to the read value.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 448 of file spu.h.

◆ sysSpuRawRecoverPageFault()

LV2_SYSCALL sysSpuRawRecoverPageFault ( sys_raw_spu_t  spu)

Recover a raw SPU from a page fault.

Parameters
spuThe raw SPU identifier.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 497 of file spu.h.

◆ sysSpuRawSetConfiguration()

LV2_SYSCALL sysSpuRawSetConfiguration ( sys_raw_spu_t  spu,
u32  value 
)

Configure the raw SPU's signal notification.

Parameters
spuThe raw SPU identifier.
valueA OR combination of the following values:
Returns
zero if no error occured, nonzero otherwise.

Definition at line 466 of file spu.h.

◆ sysSpuRawSetIntMask()

LV2_SYSCALL sysSpuRawSetIntMask ( sys_raw_spu_t  spu,
u32  classid,
u64  mask 
)

Set the value of the interrupt mask register for a raw SPU.

Parameters
spuThe raw SPU identifier.
classidThe interrupt class identifier.
maskThe new interrupt mask register value.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 386 of file spu.h.

◆ sysSpuRawSetIntStat()

LV2_SYSCALL sysSpuRawSetIntStat ( sys_raw_spu_t  spu,
u32  classid,
u64  stat 
)

Set the value of the interrupt status register for a raw SPU.

Parameters
spuThe raw SPU identifier.
classidThe interrupt class identifier.
maskThe new interrupt status register value.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 418 of file spu.h.

◆ sysSpuRawWriteLocalStorage()

static void sysSpuRawWriteLocalStorage ( sys_raw_spu_t  spu,
u32  reg,
u32  value 
)
inlinestatic

Definition at line 956 of file spu.h.

◆ sysSpuRawWriteProblemStorage()

static void sysSpuRawWriteProblemStorage ( sys_raw_spu_t  spu,
u32  reg,
u32  value 
)
inlinestatic

Definition at line 946 of file spu.h.

◆ sysSpuThreadBindQueue()

LV2_SYSCALL sysSpuThreadBindQueue ( sys_spu_thread_t  thread,
sys_event_queue_t  queue,
u32  spuq_num 
)

Bind an event queue to a SPU thread.

Parameters
threadThread identifier.
queueEvent queue identifier.
spuq_numEvent queue binding id.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 635 of file spu.h.

◆ sysSpuThreadConnectEvent()

LV2_SYSCALL sysSpuThreadConnectEvent ( sys_spu_thread_t  thread,
sys_event_queue_t  queue,
u32  type,
u8  spup 
)

Connect an event queue to a SPU thread.

Parameters
threadThread identifier.
queueEvent queue identifier.
typeEvent queue type.
Possible values are:
spupSPU event port number (value in 0..63 interval).
Returns
zero if no error occured, nonzero otherwise.

Definition at line 600 of file spu.h.

◆ sysSpuThreadDisconnectEvent()

LV2_SYSCALL sysSpuThreadDisconnectEvent ( sys_spu_thread_t  thread,
u32  type,
u8  spup 
)

Disconnect an event queue from a SPU thread.

Parameters
threadThread identifier.
typeEvent queue type.
Possible values are:
spupSPU event port number.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 619 of file spu.h.

◆ sysSpuThreadGetConfiguration()

LV2_SYSCALL sysSpuThreadGetConfiguration ( sys_spu_thread_t  thread,
u64 *  value 
)

Get the configuration of the SPU thread's signal notification.

Parameters
threadThread identifier.
valuePointer to the read configuration value, which is a OR combination of the following values:
Returns
zero if no error occured, nonzero otherwise.

Definition at line 744 of file spu.h.

◆ sysSpuThreadGetExitStatus()

LV2_SYSCALL sysSpuThreadGetExitStatus ( sys_spu_thread_t  thread,
s32 *  status 
)

Get the exit status of a thread.

The exit status is the value the SPU program used as an argument to spu_thread_exit.

Parameters
threadThread identifier.
argumentsPointer to the returned exit status.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 579 of file spu.h.

◆ sysSpuThreadGroupConnectEvent()

LV2_SYSCALL sysSpuThreadGroupConnectEvent ( sys_spu_group_t  group,
sys_event_queue_t  eventQ,
u32  eventType 
)

Definition at line 922 of file spu.h.

◆ sysSpuThreadGroupConnectEventAllThreads()

LV2_SYSCALL sysSpuThreadGroupConnectEventAllThreads ( sys_spu_group_t  group,
sys_event_queue_t  eventQ,
u64  req,
u8 *  spup 
)

Definition at line 934 of file spu.h.

◆ sysSpuThreadGroupCreate()

LV2_SYSCALL sysSpuThreadGroupCreate ( sys_spu_group_t *  group,
u32  num,
u32  prio,
sysSpuThreadGroupAttribute attr 
)

Create a SPU thread group.

Parameters
groupPointer to the returned SPU thread group identifier.
numNumber of SPU threads in the thread group.
prioPriority of the thread group.
attrPointer to a SPU thread group attribute structure.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 791 of file spu.h.

◆ sysSpuThreadGroupDestroy()

LV2_SYSCALL sysSpuThreadGroupDestroy ( sys_spu_group_t  group)

Destroy a SPU thread group.

Parameters
groupSPU thread group identifier.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 804 of file spu.h.

◆ sysSpuThreadGroupDisconnectEvent()

LV2_SYSCALL sysSpuThreadGroupDisconnectEvent ( sys_spu_group_t  group,
u32  eventType 
)

Definition at line 928 of file spu.h.

◆ sysSpuThreadGroupDisonnectEventAllThreads()

LV2_SYSCALL sysSpuThreadGroupDisonnectEventAllThreads ( sys_spu_group_t  group,
u8  spup 
)

Definition at line 940 of file spu.h.

◆ sysSpuThreadGroupGetPriority()

LV2_SYSCALL sysSpuThreadGroupGetPriority ( sys_spu_group_t  group,
u32 *  prio 
)

Get a SPU thread group's priority.

Parameters
groupSPU thread group identifier.
prioPointer to returned priority value.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 916 of file spu.h.

◆ sysSpuThreadGroupJoin()

LV2_SYSCALL sysSpuThreadGroupJoin ( sys_spu_group_t  group,
u32 *  cause,
u32 *  status 
)

Wait for a SPU thread group to finish its execution.

Parameters
groupSPU thread group identifier.
causePointer to returned cause of thread group termination.
statusPointer to returned status of thread group termination.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 886 of file spu.h.

◆ sysSpuThreadGroupResume()

LV2_SYSCALL sysSpuThreadGroupResume ( sys_spu_group_t  group)

Resume a SPU thread group.

Parameters
groupSPU thread group identifier.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 843 of file spu.h.

◆ sysSpuThreadGroupSetPriority()

LV2_SYSCALL sysSpuThreadGroupSetPriority ( sys_spu_group_t  group,
u32  prio 
)

Set a SPU thread group's priority.

Parameters
groupSPU thread group identifier.
prioNew priority value.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 901 of file spu.h.

◆ sysSpuThreadGroupStart()

LV2_SYSCALL sysSpuThreadGroupStart ( sys_spu_group_t  group)

Start a SPU thread group.

Parameters
groupSPU thread group identifier.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 817 of file spu.h.

◆ sysSpuThreadGroupSuspend()

LV2_SYSCALL sysSpuThreadGroupSuspend ( sys_spu_group_t  group)

Suspend a SPU thread group.

Parameters
groupSPU thread group identifier.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 830 of file spu.h.

◆ sysSpuThreadGroupTerminate()

LV2_SYSCALL sysSpuThreadGroupTerminate ( sys_spu_group_t  group,
u32  value 
)

Terminate a SPU thread group.

Parameters
groupSPU thread group identifier.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 869 of file spu.h.

◆ sysSpuThreadGroupYield()

LV2_SYSCALL sysSpuThreadGroupYield ( sys_spu_group_t  group)

Yield a SPU thread group.

Parameters
groupSPU thread group identifier.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 856 of file spu.h.

◆ sysSpuThreadInitialize()

LV2_SYSCALL sysSpuThreadInitialize ( sys_spu_thread_t *  thread,
sys_spu_group_t  group,
u32  spu,
sysSpuImage image,
sysSpuThreadAttribute attributes,
sysSpuThreadArgument arguments 
)

Initialize a SPU thread.

Parameters
threadPointer to the returned thread identifier.
groupGroup identifier.
spuIndex of thread in group (from 0 to the thread group size minus 1).
imagePointer to the SPU image structure.
attributesPointer to a SPU thread attribute structure.
argumentsPointer to the arguments for the thread's main function.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 549 of file spu.h.

◆ sysSpuThreadReadLocalStorage()

LV2_SYSCALL sysSpuThreadReadLocalStorage ( sys_spu_thread_t  thread,
u32  address,
u64 *  value,
u32  type 
)

Read a value From the SPU thread's local store memory.

Parameters
threadThread identifier.
addressAddress in local store to read from.
valuePointer to read value.
typeType of value to be read.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 687 of file spu.h.

◆ sysSpuThreadReadProblemStorage()

static u32 sysSpuThreadReadProblemStorage ( sys_raw_spu_t  spu,
u32  reg 
)
inlinestatic

Definition at line 971 of file spu.h.

◆ sysSpuThreadRecoverPageFault()

LV2_SYSCALL sysSpuThreadRecoverPageFault ( sys_spu_thread_t  thread)

Recover from a SPU thread page fault.

Parameters
threadThread identifier.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 772 of file spu.h.

◆ sysSpuThreadSetArguments()

LV2_SYSCALL sysSpuThreadSetArguments ( sys_spu_thread_t  thread,
sysSpuThreadArgument arguments 
)

Set the SPU thread arguments.

Parameters
threadThread identifier.
argumentsPointer to the arguments list.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 563 of file spu.h.

◆ sysSpuThreadSetConfiguration()

LV2_SYSCALL sysSpuThreadSetConfiguration ( sys_spu_thread_t  thread,
u64  value 
)

Configure the SPU thread's signal notification.

Parameters
threadThread identifier.
valueA OR combination of the following values:
Returns
zero if no error occured, nonzero otherwise.

Definition at line 724 of file spu.h.

◆ sysSpuThreadUnbindQueue()

LV2_SYSCALL sysSpuThreadUnbindQueue ( sys_spu_thread_t  thread,
u32  spuq_num 
)

Unbind an event queue from a SPU thread.

Parameters
threadThread identifier.
spuq_numEvent queue binding id.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 649 of file spu.h.

◆ sysSpuThreadWriteLocalStorage()

LV2_SYSCALL sysSpuThreadWriteLocalStorage ( sys_spu_thread_t  thread,
u32  address,
u64  value,
u32  type 
)

Write a value to a SPU thread's local store memory.

Parameters
threadThread identifier.
addressAddress in local store to write to.
valueValue to be written.
typeType of value to be written.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 668 of file spu.h.

◆ sysSpuThreadWriteMb()

LV2_SYSCALL sysSpuThreadWriteMb ( sys_spu_thread_t  thread,
u32  value 
)

Write to the SPU thread's inbound mailbox register.

Parameters
threadThread identifier.
valueValue to be written.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 759 of file spu.h.

◆ sysSpuThreadWriteProblemStorage()

static void sysSpuThreadWriteProblemStorage ( sys_raw_spu_t  spu,
u32  reg,
u32  value 
)
inlinestatic

Definition at line 966 of file spu.h.

◆ sysSpuThreadWriteSignal()

LV2_SYSCALL sysSpuThreadWriteSignal ( sys_spu_thread_t  thread,
u32  signal,
u32  value 
)

Write to the SPU thread's signal notification register.

Parameters
threadThread identifier.
signal
  • 0 : write to signal notification register 1
  • 1 : write to signal notification register 2
valueValue to be written.
Returns
zero if no error occured, nonzero otherwise.

Definition at line 705 of file spu.h.