xref: /openbmc/qemu/include/hw/dma/i8257.h (revision e7bbc9b1)
1 #ifndef HW_I8257_H
2 #define HW_I8257_H
3 
4 #include "hw/hw.h"
5 #include "hw/isa/isa.h"
6 #include "exec/ioport.h"
7 
8 #define TYPE_I8257 "i8257"
9 
10 typedef struct I8257Regs {
11     int now[2];
12     uint16_t base[2];
13     uint8_t mode;
14     uint8_t page;
15     uint8_t pageh;
16     uint8_t dack;
17     uint8_t eop;
18     IsaDmaTransferHandler transfer_handler;
19     void *opaque;
20 } I8257Regs;
21 
22 typedef struct I8257State {
23     /* <private> */
24     ISADevice parent_obj;
25 
26     /* <public> */
27     int32_t base;
28     int32_t page_base;
29     int32_t pageh_base;
30     int32_t dshift;
31 
32     uint8_t status;
33     uint8_t command;
34     uint8_t mask;
35     uint8_t flip_flop;
36     I8257Regs regs[4];
37     MemoryRegion channel_io;
38     MemoryRegion cont_io;
39 
40     QEMUBH *dma_bh;
41     bool dma_bh_scheduled;
42     int running;
43     PortioList portio_page;
44     PortioList portio_pageh;
45 } I8257State;
46 
47 void i8257_dma_init(ISABus *bus, bool high_page_enable);
48 
49 #endif
50