2017-05-30 03:38:38 +02:00
|
|
|
/*
|
2018-04-25 23:51:13 +02:00
|
|
|
* VARCem Virtual ARchaeological Computer EMulator.
|
|
|
|
|
* An emulator of (mostly) x86-based PC systems and devices,
|
|
|
|
|
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
|
|
|
|
* spanning the era between 1981 and 1995.
|
2017-05-30 03:38:38 +02:00
|
|
|
*
|
2018-04-25 23:51:13 +02:00
|
|
|
* This file is part of the VARCem Project.
|
2017-05-30 03:38:38 +02:00
|
|
|
*
|
2018-04-25 23:51:13 +02:00
|
|
|
* Definitions for the Intel DMA controller.
|
2017-05-30 03:38:38 +02:00
|
|
|
*
|
2018-04-25 23:51:13 +02:00
|
|
|
* Version: @(#)dma.h 1.0.2 2018/03/12
|
2017-05-30 03:38:38 +02:00
|
|
|
*
|
2018-04-25 23:51:13 +02:00
|
|
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
2017-05-30 03:38:38 +02:00
|
|
|
* Miran Grca, <mgrca8@gmail.com>
|
2018-04-25 23:51:13 +02:00
|
|
|
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
2017-11-02 02:28:00 -05:00
|
|
|
*
|
2018-04-25 23:51:13 +02:00
|
|
|
* Copyright 2017,2018 Fred N. van Kempen.
|
|
|
|
|
* Copyright 2016-2018 Miran Grca.
|
|
|
|
|
* Copyright 2008-2018 Sarah Walker.
|
|
|
|
|
*
|
|
|
|
|
* This program 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.
|
|
|
|
|
*
|
|
|
|
|
* This program 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 this program; if not, write to the:
|
|
|
|
|
*
|
|
|
|
|
* Free Software Foundation, Inc.
|
|
|
|
|
* 59 Temple Place - Suite 330
|
|
|
|
|
* Boston, MA 02111-1307
|
|
|
|
|
* USA.
|
2017-05-30 03:38:38 +02:00
|
|
|
*/
|
2017-06-04 02:11:19 -04:00
|
|
|
#ifndef EMU_DMA_H
|
|
|
|
|
# define EMU_DMA_H
|
2017-05-30 03:38:38 +02:00
|
|
|
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-11-02 02:28:00 -05:00
|
|
|
#define DMA_NODATA -1
|
|
|
|
|
#define DMA_OVER 0x10000
|
|
|
|
|
#define DMA_VERIFY 0x20000
|
|
|
|
|
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
typedef struct {
|
|
|
|
|
uint32_t ab, ac;
|
|
|
|
|
uint16_t cb;
|
|
|
|
|
int cc;
|
|
|
|
|
int wp;
|
|
|
|
|
uint8_t m, mode;
|
|
|
|
|
uint8_t page;
|
|
|
|
|
uint8_t stat, stat_rq;
|
|
|
|
|
uint8_t command;
|
|
|
|
|
int size;
|
|
|
|
|
|
|
|
|
|
uint8_t ps2_mode;
|
|
|
|
|
uint8_t arb_level;
|
|
|
|
|
uint16_t io_addr;
|
2018-03-11 18:26:44 +01:00
|
|
|
} dma_t;
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
extern dma_t dma[8];
|
|
|
|
|
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-06-04 02:11:19 -04:00
|
|
|
extern void dma_init(void);
|
|
|
|
|
extern void dma16_init(void);
|
|
|
|
|
extern void ps2_dma_init(void);
|
|
|
|
|
extern void dma_reset(void);
|
|
|
|
|
extern int dma_mode(int channel);
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-06-04 02:11:19 -04:00
|
|
|
extern void readdma0(void);
|
|
|
|
|
extern int readdma1(void);
|
|
|
|
|
extern uint8_t readdma2(void);
|
|
|
|
|
extern int readdma3(void);
|
2016-11-12 15:06:38 +01:00
|
|
|
|
2017-06-04 02:11:19 -04:00
|
|
|
extern void writedma2(uint8_t temp);
|
2017-05-05 01:49:42 +02:00
|
|
|
|
2017-06-04 02:11:19 -04:00
|
|
|
extern int dma_channel_read(int channel);
|
|
|
|
|
extern int dma_channel_write(int channel, uint16_t val);
|
|
|
|
|
|
|
|
|
|
extern void dma_alias_set(void);
|
|
|
|
|
extern void dma_alias_remove(void);
|
|
|
|
|
extern void dma_alias_remove_piix(void);
|
|
|
|
|
|
2017-12-15 21:16:25 -05:00
|
|
|
extern void DMAPageRead(uint32_t PhysAddress, uint8_t *DataRead,
|
2017-06-04 02:11:19 -04:00
|
|
|
uint32_t TotalSize);
|
2017-12-15 21:16:25 -05:00
|
|
|
extern void DMAPageWrite(uint32_t PhysAddress, const uint8_t *DataWrite,
|
2017-06-04 02:11:19 -04:00
|
|
|
uint32_t TotalSize);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /*EMU_DMA_H*/
|