paulo@0: /* paulo@0: * pin8gba_sound.h paulo@0: * Header file for GBA sound registers paulo@0: */ paulo@0: paulo@0: paulo@0: /* Copyright 2001-2006 Damian Yerrick paulo@0: paulo@0: (insert zlib license here) paulo@0: paulo@0: */ paulo@0: paulo@0: paulo@0: /* Why the funny register names? paulo@0: paulo@0: The register names do not match the names in the official GBA paulo@0: documentation. I choose the names that seem most logical to me. paulo@0: In addition, I do slick macro tricks with the VRAM addresses for paulo@0: maps and the like and with registers that control timers, DMA, paulo@0: and backgrounds. The gba.h that comes with wintermute's libgba paulo@0: incorporates some but not all of these tricks. In addition, paulo@0: the names in gba.h for the sound registers aren't descriptive paulo@0: at all. paulo@0: paulo@0: */ paulo@0: paulo@0: #ifndef PIN8GBA_SOUND_H paulo@0: #ifdef __cplusplus paulo@0: extern "C" { paulo@0: #endif paulo@0: #define PIN8GBA_SOUND_H paulo@0: paulo@0: paulo@0: #define DMGSNDCTRL (*(volatile u16 *)0x04000080) paulo@0: #define DMGSNDCTRL_LVOL(x) (x) paulo@0: #define DMGSNDCTRL_RVOL(x) ((x) << 4) paulo@0: #define DMGSNDCTRL_LSQR1 0x0100 paulo@0: #define DMGSNDCTRL_LSQR2 0x0200 paulo@0: #define DMGSNDCTRL_LTRI 0x0400 paulo@0: #define DMGSNDCTRL_LNOISE 0x0800 paulo@0: #define DMGSNDCTRL_RSQR1 0x1000 paulo@0: #define DMGSNDCTRL_RSQR2 0x2000 paulo@0: #define DMGSNDCTRL_RTRI 0x4000 paulo@0: #define DMGSNDCTRL_RNOISE 0x8000 paulo@0: paulo@0: #define DSOUNDCTRL (*(volatile u16 *)0x04000082) paulo@0: #define DSOUNDCTRL_DMG25 0x0000 paulo@0: #define DSOUNDCTRL_DMG50 0x0001 paulo@0: #define DSOUNDCTRL_DMG100 0x0002 paulo@0: #define DSOUNDCTRL_A50 0x0000 paulo@0: #define DSOUNDCTRL_A100 0x0004 paulo@0: #define DSOUNDCTRL_B50 0x0000 paulo@0: #define DSOUNDCTRL_B100 0x0008 paulo@0: #define DSOUNDCTRL_AR 0x0100 paulo@0: #define DSOUNDCTRL_AL 0x0200 paulo@0: #define DSOUNDCTRL_ATIMER(x) ((x) << 10) paulo@0: #define DSOUNDCTRL_ARESET 0x0400 paulo@0: #define DSOUNDCTRL_BR 0x1000 paulo@0: #define DSOUNDCTRL_BL 0x2000 paulo@0: #define DSOUNDCTRL_BTIMER(x) ((x) << 14) paulo@0: #define DSOUNDCTRL_BRESET 0x8000 paulo@0: paulo@0: #define SNDSTAT (*(volatile u16*)0x04000084) paulo@0: #define SNDSTAT_SQR1 0x0001 paulo@0: #define SNDSTAT_SQR2 0x0002 paulo@0: #define SNDSTAT_TRI 0x0004 paulo@0: #define SNDSTAT_NOISE 0x0008 paulo@0: #define SNDSTAT_ENABLE 0x0080 paulo@0: paulo@0: #define SNDBIAS (*(volatile u16 *)0x04000088) paulo@0: #define SETSNDRES(x) SNDBIAS = (SNDBIAS & 0x3fff) | (x << 14) paulo@0: paulo@0: #define DSOUND_FIFOA (*(volatile u32 *)0x040000a0) paulo@0: #define DSOUND_FIFOB (*(volatile u32 *)0x040000a4) paulo@0: paulo@0: paulo@0: #define SQR1SWEEP (*(volatile u16 *)0x04000060) paulo@0: #define SQR1SWEEP_OFF 0x0008 paulo@0: paulo@0: #define SQR1CTRL (*(volatile u16 *)0x04000062) paulo@0: #define SQR2CTRL (*(volatile u16 *)0x04000068) paulo@0: #define NOISECTRL (*(volatile u16 *)0x04000078) paulo@0: #define SQR_DUTY(n) ((n) << 6) paulo@0: #define SQR_VOL(n) ((n) << 12) paulo@0: paulo@0: #define SQR1FREQ (*(volatile u16 *)0x04000064) paulo@0: #define SQR2FREQ (*(volatile u16 *)0x0400006c) paulo@0: #define TRIFREQ (*(volatile u16 *)0x04000074) paulo@0: #define FREQ_HOLD 0x0000 paulo@0: #define FREQ_TIMED 0x4000 paulo@0: #define FREQ_RESET 0x8000 paulo@0: paulo@0: #define NOISEFREQ (*(volatile u16 *)0x0400007c) paulo@0: #define NOISEFREQ_127 0x0008 paulo@0: #define NOISEFREQ_OCT(x) ((x) << 4) paulo@0: paulo@0: #define TRICTRL (*(volatile u16 *)0x04000070) paulo@0: #define TRICTRL_2X32 0x0000 paulo@0: #define TRICTRL_1X64 0x0020 paulo@0: #define TRICTRL_BANK(x) ((x) << 6) paulo@0: #define TRICTRL_ENABLE 0x0080 paulo@0: paulo@0: #define TRILENVOL (*(volatile u16 *)0x04000072) paulo@0: #define TRILENVOL_LEN(x) (256 - (x)) paulo@0: #define TRILENVOL_MUTE 0x0000 paulo@0: #define TRILENVOL_25 0x6000 paulo@0: #define TRILENVOL_50 0x4000 paulo@0: #define TRILENVOL_75 0x8000 paulo@0: #define TRILENVOL_100 0x2000 paulo@0: paulo@0: #define TRIWAVERAM ((volatile u32 *)0x04000090) paulo@0: paulo@0: paulo@0: #ifdef __cplusplus paulo@0: } paulo@0: #endif paulo@0: #endif