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