-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfe2010.h
More file actions
86 lines (72 loc) · 1.79 KB
/
fe2010.h
File metadata and controls
86 lines (72 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef _FE2010_H
#define _FE2010_H
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include "i8088.h"
#include "mem.h"
#include "io.h"
typedef struct pit_s {
union {
struct {
uint8_t bcd : 1;
uint8_t mode : 3;
uint8_t rl : 2;
uint8_t sc : 2;
};
uint8_t control;
};
union {
struct {
uint8_t counter_lsb;
uint8_t counter_msb;
};
uint16_t counter;
};
union {
struct {
uint8_t latch_lsb;
uint8_t latch_msb;
};
uint16_t latch;
};
bool flip_flop;
bool timer_hack;
} pit_t;
typedef struct fe2010_s {
uint8_t ctrl; /* Control Register */
uint8_t conf; /* Configuration Register */
uint8_t scancode;
uint8_t switches;
bool timer_2_output;
uint16_t dma_reg[8];
bool dma_flip_flop;
uint8_t dma_page[4];
uint8_t dma_mode[4];
uint8_t irq_mask;
uint8_t nmi_mask;
bool irq_pending[8];
pit_t pit[3];
i8088_t *cpu;
mem_t *mem;
} fe2010_t;
#define FE2010_IRQ_TIMER 0
#define FE2010_IRQ_KEYBOARD 1
#define FE2010_IRQ_MOUSE 2
#define FE2010_IRQ_COM2 3
#define FE2010_IRQ_COM1 4
#define FE2010_IRQ_HARD_DISK 5
#define FE2010_IRQ_FLOPPY_DISK 6
#define FE2010_IRQ_LPT1 7
#define FE2010_DMA_FLOPPY_DISK 2
#define FE2010_DMA_HARD_DISK 3
void fe2010_init(fe2010_t *fe2010, io_t *io, i8088_t *cpu, mem_t *mem);
void fe2010_execute(fe2010_t *fe2010);
void fe2010_irq(fe2010_t *fe2010, int irq_no);
void fe2010_dma_write(fe2010_t *fe2010, int channel_no,
uint8_t (*callback_func)(void *), void *callback_data);
void fe2010_dma_read(fe2010_t *fe2010, int channel_no,
void (*callback_func)(void *, uint8_t), void *callback_data);
void fe2010_keyboard_press(fe2010_t *fe2010, int scancode);
void fe2010_dump(FILE *fh, fe2010_t *fe2010);
#endif /* _FE2010_H */