altos: ADS124S0X driver compiles now
[fw/altos] / src / cortexelf-v1 / ao_1802.h
1 /*
2  * Copyright © 2017 Keith Packard <keithp@keithp.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  */
14
15 #ifndef _AO_1802_H_
16 #define _AO_1802_H_
17
18 /* Decoded address driven by TPA/TPB signals */
19 extern uint16_t         ADDRESS;
20
21 /* Decoded data, driven by TPB signal */
22 extern uint8_t          DATA;
23
24 uint8_t
25 MRD(void);
26
27 void
28 MRD_set(uint8_t value);
29
30 uint8_t
31 MWR(void);
32
33 void
34 MWR_set(uint8_t value);
35
36 uint8_t
37 TPA(void);
38
39 void
40 TPA_set(uint8_t tpa);
41
42 uint8_t
43 TPB(void);
44
45 void
46 TPB_set(uint8_t tpb);
47
48 uint8_t
49 MA(void);
50
51 void
52 MA_set(uint8_t ma);
53
54 /* Tri-state data bus */
55
56 uint8_t
57 BUS(void);
58
59 void
60 BUS_set(uint8_t bus);
61
62 void
63 BUS_stm(void);
64
65 void
66 BUS_1802(void);
67
68 /* Pins controlled by 1802 */
69 uint8_t
70 SC(void);
71
72 uint8_t
73 Q(void);
74
75 uint8_t
76 N(void);
77
78 /* Pins controlled by STM */
79 uint8_t
80 EF(void);
81
82 void
83 EF_set(uint8_t ef);
84
85 uint8_t
86 DMA_IN(void);
87
88 void
89 DMA_IN_set(uint8_t dma_in);
90
91 uint8_t
92 DMA_OUT(void);
93
94 void
95 DMA_OUT_set(uint8_t dma_out);
96
97 uint8_t
98 INT(void);
99
100 void
101 INT_set(uint8_t dma_out);
102
103 uint8_t
104 CLEAR(void);
105
106 void
107 CLEAR_set(uint8_t dma_out);
108
109 uint8_t
110 WAIT(void);
111
112 void
113 WAIT_set(uint8_t dma_out);
114
115 #define SC_FETCH        0
116 #define SC_EXECUTE      1
117 #define SC_DMA          2
118 #define SC_INTERRUPT    3
119
120 void
121 MUX_1802(void);
122
123 void
124 MUX_stm(void);
125
126 void
127 ao_1802_init(void);
128
129 #endif /* _AO_1802_H_ */