[Lapetus-cvs] lapetus dma.h, NONE, 1.1 sound.c, NONE, 1.1 sound.h, NONE, 1.1 lapetus.c, 1.1, 1.2 la
Status: Inactive
Brought to you by:
cyberwarriorx
From: Theo B. <cyb...@us...> - 2008-01-09 05:03:48
|
Update of /cvsroot/lapetus/lapetus In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5263 Modified Files: lapetus.c lapetus.h Added Files: dma.h sound.c sound.h Log Message: -Moved sound functions and other fixes Index: lapetus.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/lapetus.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- lapetus.c 28 Feb 2007 02:06:31 -0000 1.1 +++ lapetus.c 9 Jan 2008 05:03:44 -0000 1.2 @@ -46,6 +46,9 @@ DebugInit(); #endif + // Unpause and stop dsp + SCUREG_PPAF = 0x4000000; + if (InterruptGetLevelMask() > 0x7) InterruptSetLevelMask(0x7); } Index: lapetus.h =================================================================== RCS file: /cvsroot/lapetus/lapetus/lapetus.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- lapetus.h 3 Mar 2007 05:19:48 -0000 1.8 +++ lapetus.h 9 Jan 2008 05:03:44 -0000 1.9 @@ -26,12 +26,14 @@ #include "cd.h" #include "cdfs.h" #include "commlink.h" +#include "dma.h" #include "dsp.h" #include "int.h" #include "mpeg.h" #include "netlink.h" #include "sci.h" #include "smpc.h" +#include "sound.h" #include "text.h" #include "timer.h" #include "vdp.h" --- NEW FILE: sound.h --- /* Copyright 2006-2007 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef SOUND_H #define SOUND_H #define SCSP_REG_MVOL (*(volatile u8 *)0x25B00401) #define SCSP_REG_MIBUF (*(volatile u8 *)0x25B00405) #define SCSP_REG_SCIEB (*(volatile u16 *)0x25B0041E) #define SCSP_REG_SCIPD (*(volatile u16 *)0x25B00420) #define SCSP_REG_SCIRE (*(volatile u16 *)0x25B00422) #define SCSP_REG_SCILV0 (*(volatile u8 *)0x25B00424) #define SCSP_REG_SCILV1 (*(volatile u8 *)0x25B00426) #define SCSP_REG_SCILV2 (*(volatile u8 *)0x25B00428) #define SoundKeyOffAll() (*(volatile u8 *)(0x25B00000) = 0x10) void SoundInit(void); void SoundLoadDriver(u8 *data, u32 size); void SoundExternalAudioEnable(u8 vol_l, u8 vol_r); #endif --- NEW FILE: dma.h --- #ifndef DMA_H #define DMA_H int ScuDMAInit(void); int ScuDMAStart(int chan, void *src, void *dst, u32 size, u32 add, u32 mode); BOOL IsScuDMARunning(int chan); void ScuDMAStopAll(void); int Sh2DMAInit(void); int Sh2DMAStart(int chan, void *src, void *dst, u32 size, u32 mode); BOOL IsSh2DMARunning(int chan); void Sh2DMAStopAll(void); #endif --- NEW FILE: sound.c --- /* Copyright 2006-2007 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "lapetus.h" ////////////////////////////////////////////////////////////////////////////// void SoundInit(void) { int i; // Turn off Sound CPU SmpcIssueCommand(0x07); // Make sure SCSP is set to 512k mode *(volatile u8 *)(0x25B00400) = 0x02; // Clear Sound Ram for (i = 0; i < 0x80000; i+=4) *(volatile u32 *)(0x25A00000 + i) = 0x00000000; // Clear MIDI input i = SCSP_REG_MIBUF; i = SCSP_REG_MIBUF; i = SCSP_REG_MIBUF; i = SCSP_REG_MIBUF; // Clear DSP micro program for (i = 0; i < 0x400; i+=4) *(volatile u16 *)(0x25B00800 + i) = 0; // Clear DSP memory address for (i = 0; i < 0x80; i+=4) *(volatile u16 *)(0x25B00780 + i) = 0; // Clear DSP coefficient table for (i = 0; i < 0x80; i+=4) *(volatile u16 *)(0x25B00700 + i) = 0; // Clear DSP temporary work area for (i = 0; i < 0x200; i+=4) *(volatile u16 *)(0x25B00C00 + i) = 0; // Clear all slots for (i = 0; i < 0x400; i+=4) *(volatile u16 *)(0x25B00000 + i) = 0; // Key off all slots SoundKeyOffAll(); // Set TL to max for all slots for (i = 0; i < 32; i++) *(volatile u8 *)(0x25B00000 + (i * 32) + 0x0D) = 0xFF; // Set Master Volume to max SCSP_REG_MVOL = 0xF; } ////////////////////////////////////////////////////////////////////////////// void SoundLoadDriver(u8 *data, u32 size) { int i; // Turn off Sound CPU SmpcIssueCommand(0x07); // Make sure SCSP is set to 512k mode *(volatile u8 *)(0x25B00400) = 0x02; // Clear Sound Ram for (i = 0; i < 0x80000; i+=4) *(volatile u32 *)(0x25A00000 + i) = 0x00000000; // Copy driver over for (i = 0; i < size; i++) *(volatile u8 *)(0x25A00000 + i) = data[i]; // Turn on Sound CPU again SmpcIssueCommand(0x06); } ////////////////////////////////////////////////////////////////////////////// void SoundExternalAudioEnable(u8 vol_l, u8 vol_r) { volatile u16 *slot_ptr; vol_l &= 0x7; vol_r &= 0x7; // Setup SCSP Slot 16 and Slot 17 for playing slot_ptr = (volatile u16 *)(0x25B00000 + (0x20 * 16)); slot_ptr[0] = 0x1000; slot_ptr[1] = 0x0000; slot_ptr[2] = 0x0000; slot_ptr[3] = 0x0000; slot_ptr[4] = 0x0000; slot_ptr[5] = 0x0000; slot_ptr[6] = 0x00FF; slot_ptr[7] = 0x0000; slot_ptr[8] = 0x0000; slot_ptr[9] = 0x0000; slot_ptr[10] = 0x0000; slot_ptr[11] = 0x001F | (vol_l << 5); slot_ptr[12] = 0x0000; slot_ptr[13] = 0x0000; slot_ptr[14] = 0x0000; slot_ptr[15] = 0x0000; slot_ptr = (volatile u16 *)(0x25B00000 + (0x20 * 17)); slot_ptr[0] = 0x1000; slot_ptr[1] = 0x0000; slot_ptr[2] = 0x0000; slot_ptr[3] = 0x0000; slot_ptr[4] = 0x0000; slot_ptr[5] = 0x0000; slot_ptr[6] = 0x00FF; slot_ptr[7] = 0x0000; slot_ptr[8] = 0x0000; slot_ptr[9] = 0x0000; slot_ptr[10] = 0x0000; slot_ptr[11] = 0x000F | (vol_r << 5); slot_ptr[12] = 0x0000; slot_ptr[13] = 0x0000; slot_ptr[14] = 0x0000; slot_ptr[15] = 0x0000; *((volatile u16 *)(0x25B00400)) = 0x020F; } ////////////////////////////////////////////////////////////////////////////// |