Nugget
Bare-metal libraries and examples for the original PlayStation
Loading...
Searching...
No Matches
Macros | Functions
spu-envx.c File Reference
#include "common/hardware/dma.h"
#include "common/hardware/hwregs.h"
#include "common/hardware/pcsxhw.h"
#include "common/hardware/spu.h"
#include "common/syscalls/syscalls.h"
#include <stdint.h>
Include dependency graph for spu-envx.c:

Macros

#define SPU_DELAY   (*(volatile uint32_t *)0xbf801014)
 
#define SPU_ENDX_LOW   (*(volatile uint16_t *)0x1f801d9c)
 
#define SPU_UPLOAD_ADDR   0x1080u
 
#define ATTACK(step, shift, exp)   ((((step) & 3) << 8) | (((shift) & 31) << 10) | (!!(exp) << 15))
 
#define DECAY(shift)   (((shift) & 15) << 4)
 
#define SUSTAIN(step, shift, level, direction, exp)
 
#define RELEASE(shift, exp)   ((((shift) & 31) << 16) | (!!(exp) << 21))
 
#define HOLD_AT_PEAK   (ATTACK(0, 0, 0) | DECAY(0) | SUSTAIN(3, 0, 15, 0, 0))
 
#define MAX_TICKS   512 /* 512 * 5.805ms = 2.97s per bounded wait */
 
#define TRACE_LEN   16
 
#define FINE_LEN   32
 
#define FINE_SPACING   2000 /* volatile loop iterations, ~3 cycles each */
 

Functions

int main ()
 

Macro Definition Documentation

◆ ATTACK

#define ATTACK (   step,
  shift,
  exp 
)    ((((step) & 3) << 8) | (((shift) & 31) << 10) | (!!(exp) << 15))

◆ DECAY

#define DECAY (   shift)    (((shift) & 15) << 4)

◆ FINE_LEN

#define FINE_LEN   32

◆ FINE_SPACING

#define FINE_SPACING   2000 /* volatile loop iterations, ~3 cycles each */

◆ HOLD_AT_PEAK

#define HOLD_AT_PEAK   (ATTACK(0, 0, 0) | DECAY(0) | SUSTAIN(3, 0, 15, 0, 0))

◆ MAX_TICKS

#define MAX_TICKS   512 /* 512 * 5.805ms = 2.97s per bounded wait */

◆ RELEASE

#define RELEASE (   shift,
  exp 
)    ((((shift) & 31) << 16) | (!!(exp) << 21))

◆ SPU_DELAY

#define SPU_DELAY   (*(volatile uint32_t *)0xbf801014)

◆ SPU_ENDX_LOW

#define SPU_ENDX_LOW   (*(volatile uint16_t *)0x1f801d9c)

◆ SPU_UPLOAD_ADDR

#define SPU_UPLOAD_ADDR   0x1080u

◆ SUSTAIN

#define SUSTAIN (   step,
  shift,
  level,
  direction,
  exp 
)
Value:
((((step) & 3) << 22) | (((shift) & 31) << 24) | (((level) & 15) << 0) | \
(!!(direction) << 30) | (!!(exp) << 31))

◆ TRACE_LEN

#define TRACE_LEN   16

Function Documentation

◆ main()

int main ( void  )