comparison src/pin8gba_sound.h @ 2:80a2761bd3a4

change DS keys (add alt. rotate)
author paulo@localhost
date Mon, 23 Mar 2009 01:19:12 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e658b93584e2
1 /*
2 * pin8gba_sound.h
3 * Header file for GBA sound registers
4 */
5
6
7 /* Copyright 2001-2006 Damian Yerrick
8
9 (insert zlib license here)
10
11 */
12
13
14 /* Why the funny register names?
15
16 The register names do not match the names in the official GBA
17 documentation. I choose the names that seem most logical to me.
18 In addition, I do slick macro tricks with the VRAM addresses for
19 maps and the like and with registers that control timers, DMA,
20 and backgrounds. The gba.h that comes with wintermute's libgba
21 incorporates some but not all of these tricks. In addition,
22 the names in gba.h for the sound registers aren't descriptive
23 at all.
24
25 */
26
27 #ifndef PIN8GBA_SOUND_H
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 #define PIN8GBA_SOUND_H
32
33
34 #define DMGSNDCTRL (*(volatile u16 *)0x04000080)
35 #define DMGSNDCTRL_LVOL(x) (x)
36 #define DMGSNDCTRL_RVOL(x) ((x) << 4)
37 #define DMGSNDCTRL_LSQR1 0x0100
38 #define DMGSNDCTRL_LSQR2 0x0200
39 #define DMGSNDCTRL_LTRI 0x0400
40 #define DMGSNDCTRL_LNOISE 0x0800
41 #define DMGSNDCTRL_RSQR1 0x1000
42 #define DMGSNDCTRL_RSQR2 0x2000
43 #define DMGSNDCTRL_RTRI 0x4000
44 #define DMGSNDCTRL_RNOISE 0x8000
45
46 #define DSOUNDCTRL (*(volatile u16 *)0x04000082)
47 #define DSOUNDCTRL_DMG25 0x0000
48 #define DSOUNDCTRL_DMG50 0x0001
49 #define DSOUNDCTRL_DMG100 0x0002
50 #define DSOUNDCTRL_A50 0x0000
51 #define DSOUNDCTRL_A100 0x0004
52 #define DSOUNDCTRL_B50 0x0000
53 #define DSOUNDCTRL_B100 0x0008
54 #define DSOUNDCTRL_AR 0x0100
55 #define DSOUNDCTRL_AL 0x0200
56 #define DSOUNDCTRL_ATIMER(x) ((x) << 10)
57 #define DSOUNDCTRL_ARESET 0x0400
58 #define DSOUNDCTRL_BR 0x1000
59 #define DSOUNDCTRL_BL 0x2000
60 #define DSOUNDCTRL_BTIMER(x) ((x) << 14)
61 #define DSOUNDCTRL_BRESET 0x8000
62
63 #define SNDSTAT (*(volatile u16*)0x04000084)
64 #define SNDSTAT_SQR1 0x0001
65 #define SNDSTAT_SQR2 0x0002
66 #define SNDSTAT_TRI 0x0004
67 #define SNDSTAT_NOISE 0x0008
68 #define SNDSTAT_ENABLE 0x0080
69
70 #define SNDBIAS (*(volatile u16 *)0x04000088)
71 #define SETSNDRES(x) SNDBIAS = (SNDBIAS & 0x3fff) | (x << 14)
72
73 #define DSOUND_FIFOA (*(volatile u32 *)0x040000a0)
74 #define DSOUND_FIFOB (*(volatile u32 *)0x040000a4)
75
76
77 #define SQR1SWEEP (*(volatile u16 *)0x04000060)
78 #define SQR1SWEEP_OFF 0x0008
79
80 #define SQR1CTRL (*(volatile u16 *)0x04000062)
81 #define SQR2CTRL (*(volatile u16 *)0x04000068)
82 #define NOISECTRL (*(volatile u16 *)0x04000078)
83 #define SQR_DUTY(n) ((n) << 6)
84 #define SQR_VOL(n) ((n) << 12)
85
86 #define SQR1FREQ (*(volatile u16 *)0x04000064)
87 #define SQR2FREQ (*(volatile u16 *)0x0400006c)
88 #define TRIFREQ (*(volatile u16 *)0x04000074)
89 #define FREQ_HOLD 0x0000
90 #define FREQ_TIMED 0x4000
91 #define FREQ_RESET 0x8000
92
93 #define NOISEFREQ (*(volatile u16 *)0x0400007c)
94 #define NOISEFREQ_127 0x0008
95 #define NOISEFREQ_OCT(x) ((x) << 4)
96
97 #define TRICTRL (*(volatile u16 *)0x04000070)
98 #define TRICTRL_2X32 0x0000
99 #define TRICTRL_1X64 0x0020
100 #define TRICTRL_BANK(x) ((x) << 6)
101 #define TRICTRL_ENABLE 0x0080
102
103 #define TRILENVOL (*(volatile u16 *)0x04000072)
104 #define TRILENVOL_LEN(x) (256 - (x))
105 #define TRILENVOL_MUTE 0x0000
106 #define TRILENVOL_25 0x6000
107 #define TRILENVOL_50 0x4000
108 #define TRILENVOL_75 0x8000
109 #define TRILENVOL_100 0x2000
110
111 #define TRIWAVERAM ((volatile u32 *)0x04000090)
112
113
114 #ifdef __cplusplus
115 }
116 #endif
117 #endif