xref: /reactos/subsystems/mvdm/ntvdm/hardware/dma.h (revision 8a978a17)
1 /*
2  * COPYRIGHT:       GPL - See COPYING in the top level directory
3  * PROJECT:         ReactOS Virtual DOS Machine
4  * FILE:            subsystems/mvdm/ntvdm/hardware/dma.h
5  * PURPOSE:         ISA DMA - Direct Memory Access Controller emulation -
6  *                  i8237A compatible with 74LS612 Memory Mapper extension
7  * PROGRAMMERS:     Hermes Belusca-Maito (hermes.belusca@sfr.fr)
8  */
9 
10 #ifndef _DMA_H_
11 #define _DMA_H_
12 
13 /* DEFINES ********************************************************************/
14 
15 #define DMA_CONTROLLERS         2
16 #define DMA_CONTROLLER_CHANNELS 4 // Each DMA controller has 4 channels
17 
18 typedef struct _DMA_CHANNEL
19 {
20     WORD BaseAddress;
21     WORD BaseElemCnt;
22     WORD CurrAddress;
23     WORD CurrElemCnt;
24     BYTE Mode;
25 } DMA_CHANNEL, *PDMA_CHANNEL;
26 
27 typedef struct _DMA_CONTROLLER
28 {
29     DMA_CHANNEL DmaChannel[DMA_CONTROLLER_CHANNELS];
30 
31     WORD TempAddress;
32     WORD TempElemCnt;
33 
34     BYTE TempReg;
35 
36     BYTE Command;
37     BYTE Request;
38     BYTE Mask;
39     BYTE Status;
40 
41     BOOLEAN FlipFlop; // 0: LSB ; 1: MSB
42 
43 } DMA_CONTROLLER, *PDMA_CONTROLLER;
44 
45 /* 74LS612 Memory Mapper extension */
46 typedef struct _DMA_PAGE_REGISTER
47 {
48     BYTE Page;
49 } DMA_PAGE_REGISTER, *PDMA_PAGE_REGISTER;
50 
51 // The 74LS612 contains 16 bytes, each of them being a page register.
52 // They are accessible via ports 0x80 through 0x8F.
53 
54 /* FUNCTIONS ******************************************************************/
55 
56 DWORD DmaRequest(IN WORD      iChannel,
57                  IN OUT PVOID Buffer,
58                  IN DWORD     length);
59 
60 VOID DmaInitialize(VOID);
61 
62 #endif /* _DMA_H_ */
63