PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
spu2regs.h
Go to the documentation of this file.
1
6
#ifndef __SPU2REGS_H__
7
#define __SPU2REGS_H__
8
9
// Base of SPU2 regs is 0x0xBF900000
10
// Cores are 0x400 bytes apart
11
12
#define U16_REGISTER(x) ((volatile u16 *) (0xBF900000 | (x)))
13
#define U32_REGISTER(x) ((volatile u32 *) (0xBF800000 | (x)))
14
15
#define U16_REGISTER_READ(x) (*((volatile u16 *) (x)))
16
#define U32_REGISTER_READ(x) (*((volatile u32 *) (x)))
17
#define U16_REGISTER_WRITE(x, y) (*((volatile u16 *) (x)) = y)
18
#define U32_REGISTER_WRITE(x, y) (*((volatile u32 *) (x)) = y)
19
#define U16_REGISTER_WRITEOR(x, y) (*((volatile u16 *) (x)) |= y)
20
#define U32_REGISTER_WRITEOR(x, y) (*((volatile u32 *) (x)) |= y)
21
#define U16_REGISTER_WRITEAND(x, y) (*((volatile u16 *) (x)) &= y)
22
#define U32_REGISTER_WRITEAND(x, y) (*((volatile u32 *) (x)) &= y)
23
24
#define SD_BASE_REG(reg) ((volatile u16 *)(0xBF900000 + reg))
25
26
#define SD_VP_REG(core, voice, reg) SD_BASE_REG(((core) << 10) + ((voice) << 4) + (reg))
27
#define SD_VP_VOLL(core, voice) SD_VP_REG((core), (voice), 0x00)
28
#define SD_VP_VOLR(core, voice) SD_VP_REG((core), (voice), 0x02)
29
#define SD_VP_PITCH(core, voice) SD_VP_REG((core), (voice), 0x04)
30
#define SD_VP_ADSR1(core, voice) SD_VP_REG((core), (voice), 0x06)
31
#define SD_VP_ADSR2(core, voice) SD_VP_REG((core), (voice), 0x08)
32
#define SD_VP_ENVX(core, voice) SD_VP_REG((core), (voice), 0x0A)
33
#define SD_VP_VOLXL(core, voice) SD_VP_REG((core), (voice), 0x0C)
34
#define SD_VP_VOLXR(core, voice) SD_VP_REG((core), (voice), 0x0E)
35
36
#define SD_S_REG(core, reg) SD_BASE_REG(0x180 + ((core) << 10) + (reg))
37
#define SD_S_PMON_HI(core) SD_S_REG((core), 0x00)
38
#define SD_S_PMON_LO(core) SD_S_REG((core), 0x02)
39
#define SD_S_NON_HI(core) SD_S_REG((core), 0x04)
40
#define SD_S_NON_LO(core) SD_S_REG((core), 0x06)
41
#define SD_S_VMIXL_HI(core) SD_S_REG((core), 0x08)
42
#define SD_S_VMIXL_LO(core) SD_S_REG((core), 0x0A)
43
#define SD_S_VMIXEL_HI(core) SD_S_REG((core), 0x0C)
44
#define SD_S_VMIXEL_LO(core) SD_S_REG((core), 0x0E)
45
#define SD_S_VMIXR_HI(core) SD_S_REG((core), 0x10)
46
#define SD_S_VMIXR_LO(core) SD_S_REG((core), 0x12)
47
#define SD_S_VMIXER_HI(core) SD_S_REG((core), 0x14)
48
#define SD_S_VMIXER_LO(core) SD_S_REG((core), 0x16)
49
#define SD_P_MMIX(core) SD_S_REG((core), 0x18)
50
#define SD_CORE_ATTR(core) SD_S_REG((core), 0x1A)
51
#define SD_CORE_IRQA(core) SD_S_REG((core), 0x1C)
52
53
#define SD_A_REG(core, reg) SD_BASE_REG(0x1A0 + ((core) << 10) + (reg))
54
#define SD_A_KON_HI(core) SD_A_REG((core), 0x00)
// Key on (start sound generation)
55
#define SD_A_KON_LO(core) SD_A_REG((core), 0x02)
56
#define SD_A_KOFF_HI(core) SD_A_REG((core), 0x04)
// Key off (end sound generation)
57
#define SD_A_KOFF_LO(core) SD_A_REG((core), 0x06)
58
#define SD_A_TSA_HI(core) SD_A_REG((core), 0x08)
// Transfer start address
59
#define SD_A_TSA_LO(core) SD_A_REG((core), 0x0A)
60
#define SD_A_STD(core) SD_A_REG((core), 0x0C)
// Sound Transfer Data
61
62
#define SD_VA_REG(core, voice, reg) SD_BASE_REG(0x1C0 + ((core) << 10) + ((voice) * 12) + (reg))
63
#define SD_VA_SSA_HI(core, voice) SD_VA_REG((core), (voice), 0x00)
64
#define SD_VA_SSA_LO(core, voice) SD_VA_REG((core), (voice), 0x02)
65
#define SD_VA_LSAX(core, voice) SD_VA_REG((core), (voice), 0x04)
66
#define SD_VA_NAX(core, voice) SD_VA_REG((core), (voice), 0x08)
67
68
//#define SD_C_STATX(core) ((volatile u16*)(0xBF900334 + ((core) << 10))) // This is not the official name
69
70
#define SD_S_ENDX_HI(core) ((volatile u16*)(0xBF900340 + ((core) << 10)))
71
#define SD_S_ENDX_LO(core) ((volatile u16*)(0xBF900342 + ((core) << 10)))
72
73
#define SD_P_REG(core, reg) SD_BASE_REG(0x760 + ((core) * 40) + (reg))
74
#define SD_P_MVOLL(core) SD_P_REG((core), 0x00)
75
#define SD_P_MVOLR(core) SD_P_REG((core), 0x02)
76
#define SD_P_EVOLL(core) SD_P_REG((core), 0x04)
77
#define SD_P_EVOLR(core) SD_P_REG((core), 0x06)
78
#define SD_P_AVOLL(core) SD_P_REG((core), 0x08)
79
#define SD_P_AVOLR(core) SD_P_REG((core), 0x0A)
80
#define SD_P_BVOLL(core) SD_P_REG((core), 0x0C)
81
#define SD_P_BVOLR(core) SD_P_REG((core), 0x0E)
82
#define SD_P_MVOLXL(core) SD_P_REG((core), 0x10)
83
#define SD_P_MVOLXR(core) SD_P_REG((core), 0x12)
84
85
#define SD_C_SPDIF_OUT ((volatile u16*)0xBF9007C0)
86
#define SD_C_IRQINFO ((volatile u16*)0xBF9007C2)
87
#define SD_C_SPDIF_MODE ((volatile u16*)0xBF9007C6)
88
#define SD_C_SPDIF_MEDIA ((volatile u16*)0xBF9007C8)
89
90
// Reverb / Effect Registers
91
#define SD_R_REG(core, reg) SD_BASE_REG(0x2E0 + ((core) << 10) + reg)
92
// These registers are 1 word long, but low/high is accessed as halfwords
93
#define SD_A_ESA_HI(core) SD_R_REG((core), 0x00)
94
#define SD_A_ESA_LO(core) SD_R_REG((core), 0x02)
95
#define SD_R_FB_SRC_A(core) SD_R_REG((core), 0x04)
96
#define SD_R_FB_SRC_B(core) SD_R_REG((core), 0x08)
97
#define SD_R_IIR_DEST_A0(core) SD_R_REG((core), 0x0C)
98
#define SD_R_IIR_DEST_A1(core) SD_R_REG((core), 0x10)
99
#define SD_R_ACC_SRC_A0(core) SD_R_REG((core), 0x14)
100
#define SD_R_ACC_SRC_A1(core) SD_R_REG((core), 0x18)
101
#define SD_R_ACC_SRC_B0(core) SD_R_REG((core), 0x1C)
102
#define SD_R_ACC_SRC_B1(core) SD_R_REG((core), 0x20)
103
#define SD_R_IIR_SRC_A0(core) SD_R_REG((core), 0x24)
104
#define SD_R_IIR_SRC_A1(core) SD_R_REG((core), 0x28)
105
#define SD_R_IIR_DEST_B0(core) SD_R_REG((core), 0x2C)
106
#define SD_R_IIR_DEST_B1(core) SD_R_REG((core), 0x30)
107
#define SD_R_ACC_SRC_C0(core) SD_R_REG((core), 0x34)
108
#define SD_R_ACC_SRC_C1(core) SD_R_REG((core), 0x38)
109
#define SD_R_ACC_SRC_D0(core) SD_R_REG((core), 0x3C)
110
#define SD_R_ACC_SRC_D1(core) SD_R_REG((core), 0x40)
111
#define SD_R_IIR_SRC_B1(core) SD_R_REG((core), 0x44)
112
#define SD_R_IIR_SRC_B0(core) SD_R_REG((core), 0x48)
113
#define SD_R_MIX_DEST_A0(core) SD_R_REG((core), 0x4C)
114
#define SD_R_MIX_DEST_A1(core) SD_R_REG((core), 0x50)
115
#define SD_R_MIX_DEST_B0(core) SD_R_REG((core), 0x54)
116
#define SD_R_MIX_DEST_B1(core) SD_R_REG((core), 0x58)
117
#define SD_A_EEA_HI(core) SD_R_REG((core), 0x5C)
118
#define SD_A_EEA_LO(core) SD_R_REG((core), 0x5E)
119
// Halfwords
120
#define SD_R_IIR_ALPHA(core) SD_P_REG((core), 0x14)
121
#define SD_R_ACC_COEF_A(core) SD_P_REG((core), 0x16)
122
#define SD_R_ACC_COEF_B(core) SD_P_REG((core), 0x18)
123
#define SD_R_ACC_COEF_C(core) SD_P_REG((core), 0x1A)
124
#define SD_R_ACC_COEF_D(core) SD_P_REG((core), 0x1C)
125
#define SD_R_IIR_COEF(core) SD_P_REG((core), 0x1E)
126
#define SD_R_FB_ALPHA(core) SD_P_REG((core), 0x20)
127
#define SD_R_FB_X(core) SD_P_REG((core), 0x22)
128
#define SD_R_IN_COEF_L(core) SD_P_REG((core), 0x24)
129
#define SD_R_IN_COEF_R(core) SD_P_REG((core), 0x26)
130
131
// SPU DMA Channels 0,1 - 1088 bytes apart
132
#define SD_DMA_ADDR(ch) ((volatile u32*)(0xBF8010C0+(ch*1088)))
133
#define SD_DMA_MODE(ch) ((volatile u16*)(0xBF8010C4+(ch*1088)))
134
#define SD_DMA_SIZE(ch) ((volatile u16*)(0xBF8010C6+(ch*1088)))
135
#define SD_DMA_MSIZE(ch) ((volatile u32*)(0xBF8010C4+(ch*1088)))
136
#define SD_DMA_CHCR(ch) ((volatile u32*)(0xBF8010C8+(ch*1088)))
137
// CHCR
138
#define SD_DMA_CS (1 << 9)
// Continuous stream
139
#define SD_DMA_START (1 << 24)
140
#define SD_DMA_DIR_SPU2IOP 0
141
#define SD_DMA_DIR_IOP2SPU 1
142
143
#endif
/* __SPU2REGS_H__ */
iop
sound
libsd
include
spu2regs.h
Generated on Thu Nov 14 2024 05:25:28 for PS2SDK by
1.9.8