Nugget
Bare-metal libraries and examples for the original PlayStation
Loading...
Searching...
No Matches
Macros | Functions
spu-volsweep.c File Reference
#include <stdint.h>
#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 dependency graph for spu-volsweep.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)    ((((step) & 3) << 22) | (((shift) & 31) << 24) | (((level) & 15) << 0) | (!!(direction) << 30) | (!!(exp) << 31))
 
#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 VOLXL(n)   (*(volatile int16_t *)(0x1f801e00 + 4 * (n)))
 
#define VOLXR(n)   (*(volatile int16_t *)(0x1f801e02 + 4 * (n)))
 
#define SWEEP(exp, dec, neg, shift, step)    (0x8000 | (!!(exp) << 14) | (!!(dec) << 13) | (!!(neg) << 12) | (((shift) & 31) << 2) | ((step) & 3))
 
#define TRACE_LEN   40
 
#define RIGHT_CTRL   0x1111
 
#define NUM_CASES   14
 
#define TOLERANCE   16
 

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)

◆ HOLD_AT_PEAK

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

◆ NUM_CASES

#define NUM_CASES   14

◆ RELEASE

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

◆ RIGHT_CTRL

#define RIGHT_CTRL   0x1111

◆ 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 
)     ((((step) & 3) << 22) | (((shift) & 31) << 24) | (((level) & 15) << 0) | (!!(direction) << 30) | (!!(exp) << 31))

◆ SWEEP

#define SWEEP (   exp,
  dec,
  neg,
  shift,
  step 
)     (0x8000 | (!!(exp) << 14) | (!!(dec) << 13) | (!!(neg) << 12) | (((shift) & 31) << 2) | ((step) & 3))

◆ TOLERANCE

#define TOLERANCE   16

◆ TRACE_LEN

#define TRACE_LEN   40

◆ VOLXL

#define VOLXL (   n)    (*(volatile int16_t *)(0x1f801e00 + 4 * (n)))

◆ VOLXR

#define VOLXR (   n)    (*(volatile int16_t *)(0x1f801e02 + 4 * (n)))

Function Documentation

◆ main()

int main ( void  )