Annotation of hatari/src/falcon/dsp.c, revision 1.1.1.2

1.1       root        1: /*
1.1.1.2 ! root        2:        DSP M56001 emulation
        !             3:        Dummy emulation, Hatari glue
1.1       root        4: 
1.1.1.2 ! root        5:        (C) 2001-2008 ARAnyM developer team
        !             6:        Adaption to Hatari (C) 2008 by Thomas Huth
        !             7: 
        !             8:        This program is free software; you can redistribute it and/or modify
        !             9:        it under the terms of the GNU General Public License as published by
        !            10:        the Free Software Foundation; either version 2 of the License, or
        !            11:        (at your option) any later version.
        !            12: 
        !            13:        This program is distributed in the hope that it will be useful,
        !            14:        but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            15:        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            16:        GNU General Public License for more details.
        !            17: 
        !            18:        You should have received a copy of the GNU General Public License
        !            19:        along with this program; if not, write to the Free Software
        !            20:        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
        !            21: */
        !            22: 
        !            23: #include "araglue.h"
1.1       root       24: #include "main.h"
                     25: #include "sysdeps.h"
1.1.1.2 ! root       26: #include "newcpu.h"
1.1       root       27: #include "ioMem.h"
                     28: #include "dsp.h"
                     29: 
1.1.1.2 ! root       30: #define DEBUG 0
        !            31: #include "araglue.h"
1.1       root       32: 
                     33: #if DSP_EMULATION
1.1.1.2 ! root       34: static dsp_core_t dsp_core;
        !            35: #endif
1.1       root       36: 
1.1.1.2 ! root       37: #define DSP_HW_OFFSET  0xFFA200
1.1       root       38: 
                     39: 
                     40: void DSP_Init(void)
                     41: {
1.1.1.2 ! root       42: #if DSP_EMULATION
        !            43:        dsp_core_init(&dsp_core);
1.1       root       44: #endif
                     45: }
                     46: 
                     47: void DSP_UnInit(void)
                     48: {
1.1.1.2 ! root       49: #if DSP_EMULATION
        !            50:        dsp_core_shutdown(&dsp_core);
        !            51: #endif
1.1       root       52: }
                     53: 
                     54: /* Other functions to init/shutdown dsp emulation */
                     55: void DSP_Reset(void)
                     56: {
1.1.1.2 ! root       57: #if DSP_EMULATION
        !            58:        dsp_core_reset(&dsp_core);
1.1       root       59: #endif
                     60: }
                     61: 
                     62: /**********************************
                     63:  *     Hardware address read/write by CPU
                     64:  **********************************/
                     65: 
1.1.1.2 ! root       66: static Uint8 DSP_handleRead(Uint32 addr)
1.1       root       67: {
1.1.1.2 ! root       68:        Uint8 value;
1.1       root       69: #if DSP_EMULATION
1.1.1.2 ! root       70:        value = dsp_core_read_host(&dsp_core, addr-DSP_HW_OFFSET);
        !            71: #else
        !            72:        /* this value prevents TOS from hanging in the DSP init code */
        !            73:        value = 0xff;
1.1       root       74: #endif
                     75: 
1.1.1.2 ! root       76:        D(bug("HWget_b(0x%08x)=0x%02x at 0x%08x", addr, value, showPC()));
1.1       root       77:        return value;
                     78: }
                     79: 
                     80: void DSP_HandleReadAccess(void)
                     81: {
                     82:        Uint32 a;
                     83:        Uint8 v;
                     84:        for (a = IoAccessBaseAddress; a < IoAccessBaseAddress+nIoMemAccessSize; a++)
                     85:        {
                     86:                v = DSP_handleRead(a);
                     87:                IoMem_WriteByte(a, v);
                     88:        }
                     89: }
                     90: 
1.1.1.2 ! root       91: 
        !            92: static void DSP_handleWrite(Uint32 addr, Uint8 value)
1.1       root       93: {
1.1.1.2 ! root       94:        D(bug("HWput_b(0x%08x,0x%02x) at 0x%08x", addr, value, showPC()));
1.1       root       95: #if DSP_EMULATION
1.1.1.2 ! root       96:        dsp_core_write_host(&dsp_core, addr-DSP_HW_OFFSET, value);
1.1       root       97: #endif
                     98: }
                     99: 
                    100: void DSP_HandleWriteAccess(void)
                    101: {
                    102:        Uint32 a;
                    103:        Uint8 v;
                    104:        for (a = IoAccessBaseAddress; a < IoAccessBaseAddress+nIoMemAccessSize; a++)
                    105:        {
                    106:                v = IoMem_ReadByte(a);
                    107:                DSP_handleWrite(a,v);
                    108:        }
                    109: }
                    110: 
1.1.1.2 ! root      111: /*
        !           112: vim:ts=4:sw=4:
        !           113: */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.