Annotation of hatari/src/ide.c, revision 1.1.1.1

1.1       root        1: /*
                      2:   Hatari - ide.c
                      3: 
                      4:   This file is distributed under the GNU Public License, version 2 or at
                      5:   your option any later version. Read the file gpl.txt for details.
                      6: 
                      7:   This is where we intercept read/writes to/from the IDE controller hardware.
                      8: */
                      9: const char Ide_rcsid[] = "Hatari $Id: ide.c,v 1.3 2007/09/09 20:49:58 thothy Exp $";
                     10: 
                     11: #include "main.h"
                     12: #include "configuration.h"
                     13: #include "ide.h"
                     14: #include "m68000.h"
                     15: #include "stMemory.h"
                     16: #include "sysdeps.h"
                     17: 
                     18: 
                     19: #define IDE_DEBUG 0
                     20: 
                     21: #if IDE_DEBUG
                     22: #define Dprintf(a) printf a
                     23: #else
                     24: #define Dprintf(a)
                     25: #endif
                     26: 
                     27: 
                     28: /*-----------------------------------------------------------------------*/
                     29: /**
                     30:  * Handle byte read access from IDE IO memory.
                     31:  */
                     32: uae_u32 Ide_Mem_bget(uaecptr addr)
                     33: {
                     34:        Dprintf(("IdeMem_bget($%x)\n", addr));
                     35: 
                     36:        addr &= 0x00ffffff;                           /* Use a 24 bit address */
                     37: 
                     38:        if (addr >= 0xf00040 || !ConfigureParams.HardDisk.bUseIdeHardDiskImage)
                     39:        {
                     40:                /* invalid memory addressing --> bus error */
                     41:                M68000_BusError(addr, 1);
                     42:                return -1;
                     43:        }
                     44: 
                     45:        return STRam[addr];
                     46: }
                     47: 
                     48: 
                     49: /*-----------------------------------------------------------------------*/
                     50: /**
                     51:  * Handle word read access from IDE IO memory.
                     52:  */
                     53: uae_u32 Ide_Mem_wget(uaecptr addr)
                     54: {
                     55:        Dprintf(("IdeMem_wget($%x)\n", addr));
                     56: 
                     57:        addr &= 0x00ffffff;                           /* Use a 24 bit address */
                     58: 
                     59:        if (addr >= 0xf00040 || !ConfigureParams.HardDisk.bUseIdeHardDiskImage)
                     60:        {
                     61:                /* invalid memory addressing --> bus error */
                     62:                M68000_BusError(addr, 1);
                     63:                //fprintf(stderr, "Illegal IDE IO memory access: IdeMem_wget($%x)\n", addr);
                     64:                return -1;
                     65:        }
                     66: 
                     67:        return STMemory_ReadWord(addr);
                     68: }
                     69: 
                     70: 
                     71: /*-----------------------------------------------------------------------*/
                     72: /**
                     73:  * Handle long-word read access from IDE IO memory.
                     74:  */
                     75: uae_u32 Ide_Mem_lget(uaecptr addr)
                     76: {
                     77:        Dprintf(("IdeMem_lget($%x)\n", addr));
                     78: 
                     79:        addr &= 0x00ffffff;                           /* Use a 24 bit address */
                     80: 
                     81:        if (addr >= 0xf00040 || !ConfigureParams.HardDisk.bUseIdeHardDiskImage)
                     82:        {
                     83:                /* invalid memory addressing --> bus error */
                     84:                M68000_BusError(addr, 1);
                     85:                //fprintf(stderr, "Illegal IDE IO memory access: IdeMem_lget($%x)\n", addr);
                     86:                return -1;
                     87:        }
                     88: 
                     89:        return STMemory_ReadLong(addr);
                     90: }
                     91: 
                     92: 
                     93: /*-----------------------------------------------------------------------*/
                     94: /**
                     95:  * Handle byte write access to IDE IO memory.
                     96:  */
                     97: void Ide_Mem_bput(uaecptr addr, uae_u32 val)
                     98: {
                     99:        Dprintf(("IdeMem_bput($%x, $%x)\n", addr, val));
                    100: 
                    101:        addr &= 0x00ffffff;                           /* Use a 24 bit address */
                    102: 
                    103:        if (addr >= 0xf00040 || !ConfigureParams.HardDisk.bUseIdeHardDiskImage)
                    104:        {
                    105:                /* invalid memory addressing --> bus error */
                    106:                M68000_BusError(addr, 0);
                    107:                //fprintf(stderr, "Illegal IDE IO memory access: IdeMem_bput($%x)\n", addr);
                    108:                return;
                    109:        }
                    110: 
                    111:        STMemory_WriteByte(addr, val);
                    112: }
                    113: 
                    114: 
                    115: /*-----------------------------------------------------------------------*/
                    116: /**
                    117:  * Handle word write access to IDE IO memory.
                    118:  */
                    119: void Ide_Mem_wput(uaecptr addr, uae_u32 val)
                    120: {
                    121:        Dprintf(("IdeMem_wput($%x, $%x)\n", addr, val));
                    122: 
                    123:        addr &= 0x00ffffff;                           /* Use a 24 bit address */
                    124: 
                    125:        if (addr >= 0xf00040 || !ConfigureParams.HardDisk.bUseIdeHardDiskImage)
                    126:        {
                    127:                /* invalid memory addressing --> bus error */
                    128:                M68000_BusError(addr, 0);
                    129:                //fprintf(stderr, "Illegal IDE IO memory access: IdeMem_wput($%x)\n", addr);
                    130:                return;
                    131:        }
                    132: 
                    133:        STMemory_WriteWord(addr, val);
                    134: }
                    135: 
                    136: 
                    137: /*-----------------------------------------------------------------------*/
                    138: /**
                    139:  * Handle long-word write access to IDE IO memory.
                    140:  */
                    141: void Ide_Mem_lput(uaecptr addr, uae_u32 val)
                    142: {
                    143:        Dprintf(("IdeMem_lput($%x, $%x)\n", addr, val));
                    144: 
                    145:        addr &= 0x00ffffff;                           /* Use a 24 bit address */
                    146: 
                    147:        if (addr >= 0xf00040 || !ConfigureParams.HardDisk.bUseIdeHardDiskImage)
                    148:        {
                    149:                /* invalid memory addressing --> bus error */
                    150:                M68000_BusError(addr, 0);
                    151:                //fprintf(stderr, "Illegal IDE IO memory access: IdeMem_lput($%x)\n", addr);
                    152:                return;
                    153:        }
                    154: 
                    155:        STMemory_WriteLong(addr, val);
                    156: }

unix.superglobalmegacorp.com

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