altos: Move common storage code to ao_storage.c. Add M25P80 driver
[fw/altos] / src / ao_pins.h
1 /*
2  * Copyright © 2010 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; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
16  */
17
18 #ifndef _AO_PINS_H_
19 #define _AO_PINS_H_
20
21 #if defined(TELEMETRUM_V_1_0)
22         #define HAS_SERIAL_1            1
23         #define HAS_ADC                 1
24         #define HAS_EEPROM              1
25         #define HAS_DBG                 1
26         #define DBG_ON_P1               1
27         #define DBG_ON_P0               0
28         #define PACKET_HAS_MASTER       0
29         #define PACKET_HAS_SLAVE        1
30
31         #define AO_LED_RED              1
32         #define LEDS_AVAILABLE          (AO_LED_RED)
33         #define HAS_EXTERNAL_TEMP       0
34 #endif
35
36 #if defined(TELEMETRUM_V_1_1)
37         #define HAS_SERIAL_1            1
38         #define HAS_ADC                 1
39         #define HAS_EEPROM              1
40         #define HAS_DBG                 1
41         #define DBG_ON_P1               1
42         #define DBG_ON_P0               0
43         #define PACKET_HAS_MASTER       0
44         #define PACKET_HAS_SLAVE        1
45
46         #define AO_LED_RED              1
47         #define LEDS_AVAILABLE          (AO_LED_RED)
48         #define HAS_EXTERNAL_TEMP       0
49         #define SPI_CS_ON_P1            1
50         #define SPI_CS_ON_P0            0
51         #define M25_CS_MASK             0x02    /* CS0 is P1_1 */
52         #define M25_MAX_CHIPS           1
53 #endif
54
55 #if defined(TELEDONGLE_V_0_2)
56         #define HAS_SERIAL_1            0
57         #define HAS_ADC                 0
58         #define HAS_DBG                 1
59         #define HAS_EEPROM              0
60         #define DBG_ON_P1               1
61         #define DBG_ON_P0               0
62         #define PACKET_HAS_MASTER       1
63         #define PACKET_HAS_SLAVE        0
64         #define AO_LED_RED              1
65         #define AO_LED_GREEN            2
66         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
67         #define SPI_CS_ON_P1            1
68         #define SPI_CS_ON_P0            0
69 #endif
70
71 #if defined(TELEMETRUM_V_0_1)
72         #define HAS_SERIAL_1            1
73         #define HAS_ADC                 1
74         #define HAS_DBG                 0
75         #define HAS_EEPROM              1
76         #define DBG_ON_P1               0
77         #define DBG_ON_P0               1
78         #define PACKET_HAS_MASTER       0
79         #define PACKET_HAS_SLAVE        1
80         #define AO_LED_RED              2
81         #define AO_LED_GREEN            1
82         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
83         #define HAS_EXTERNAL_TEMP       1
84         #define SPI_CS_ON_P1            1
85         #define SPI_CS_ON_P0            0
86 #endif
87
88 #if defined(TELEDONGLE_V_0_1)
89         #define HAS_SERIAL_1            0
90         #define HAS_ADC                 0
91         #define HAS_DBG                 0
92         #define HAS_EEPROM              0
93         #define DBG_ON_P1               0
94         #define DBG_ON_P0               1
95         #define PACKET_HAS_MASTER       1
96         #define PACKET_HAS_SLAVE        0
97         #define AO_LED_RED              2
98         #define AO_LED_GREEN            1
99         #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
100         #define SPI_CS_ON_P1            0
101         #define SPI_CS_ON_P0            1
102 #endif
103
104 #if defined(TIDONGLE)
105         #define HAS_SERIAL_1            0
106         #define HAS_ADC                 0
107         #define HAS_DBG                 1
108         #define HAS_EEPROM              0
109         #define DBG_ON_P1               0
110         #define DBG_ON_P0               1
111         #define PACKET_HAS_MASTER       1
112         #define PACKET_HAS_SLAVE        0
113         #define AO_LED_RED              2
114         #define LEDS_AVAILABLE          (AO_LED_RED)
115         #define SPI_CS_ON_P1            0
116         #define SPI_CS_ON_P0            1
117 #endif
118
119 #if DBG_ON_P1
120
121         #define DBG_CLOCK       (1 << 4)        /* mi0 */
122         #define DBG_DATA        (1 << 5)        /* mo0 */
123         #define DBG_RESET_N     (1 << 3)        /* c0 */
124
125         #define DBG_CLOCK_PIN   (P1_4)
126         #define DBG_DATA_PIN    (P1_5)
127         #define DBG_RESET_N_PIN (P1_3)
128
129         #define DBG_PORT_NUM    1
130         #define DBG_PORT        P1
131         #define DBG_PORT_SEL    P1SEL
132         #define DBG_PORT_INP    P1INP
133         #define DBG_PORT_DIR    P1DIR
134
135 #endif /* DBG_ON_P1 */
136
137 #if DBG_ON_P0
138
139         #define DBG_CLOCK       (1 << 3)
140         #define DBG_DATA        (1 << 4)
141         #define DBG_RESET_N     (1 << 5)
142
143         #define DBG_CLOCK_PIN   (P0_3)
144         #define DBG_DATA_PIN    (P0_4)
145         #define DBG_RESET_N_PIN (P0_5)
146
147         #define DBG_PORT_NUM    0
148         #define DBG_PORT        P0
149         #define DBG_PORT_SEL    P0SEL
150         #define DBG_PORT_INP    P0INP
151         #define DBG_PORT_DIR    P0DIR
152
153 #endif /* DBG_ON_P0 */
154
155 #if SPI_CS_ON_P1
156         #define SPI_CS_PORT     P1
157         #define SPI_CS_SEL      P1SEL
158         #define SPI_CS_DIR      P1DIR
159 #endif
160
161 #if SPI_CS_ON_P0
162         #define SPI_CS_PORT     P0
163         #define SPI_CS_SEL      P0SEL
164         #define SPI_CS_DIR      P0DIR
165 #endif
166
167 #ifndef HAS_SERIAL_1
168 #error Please define HAS_SERIAL_1
169 #endif
170
171 #ifndef HAS_ADC
172 #error Please define HAS_ADC
173 #endif
174
175 #ifndef HAS_EEPROM
176 #error Please define HAS_EEPROM
177 #endif
178
179 #ifndef HAS_DBG
180 #error Please define HAS_DBG
181 #endif
182
183 #ifndef PACKET_HAS_MASTER
184 #error Please define PACKET_HAS_MASTER
185 #endif
186
187 #ifndef PACKET_HAS_SLAVE
188 #error Please define PACKET_HAS_SLAVE
189 #endif
190
191 #endif /* _AO_PINS_H_ */