|
1 /* |
|
2 This file is part of CanFestival, a library implementing CanOpen Stack. |
|
3 |
|
4 Copyright (C): Edouard TISSERANT and Francis DUPIN |
|
5 |
|
6 See COPYING file for copyrights details. |
|
7 |
|
8 This library is free software; you can redistribute it and/or |
|
9 modify it under the terms of the GNU Lesser General Public |
|
10 License as published by the Free Software Foundation; either |
|
11 version 2.1 of the License, or (at your option) any later version. |
|
12 |
|
13 This library is distributed in the hope that it will be useful, |
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 Lesser General Public License for more details. |
|
17 |
|
18 You should have received a copy of the GNU Lesser General Public |
|
19 License along with this library; if not, write to the Free Software |
|
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 */ |
|
22 /* m68hc11/ports.h -- Definition of 68HC11 ports |
|
23 Copyright 1999, 2000 Free Software Foundation, Inc. |
|
24 Written by Stephane Carrez (stcarrez@worldnet.fr) |
|
25 |
|
26 This file is part of GDB, GAS, and the GNU binutils. |
|
27 |
|
28 GDB, GAS, and the GNU binutils are free software; you can redistribute |
|
29 them and/or modify them under the terms of the GNU General Public |
|
30 License as published by the Free Software Foundation; either version |
|
31 1, or (at your option) any later version. |
|
32 |
|
33 GDB, GAS, and the GNU binutils are distributed in the hope that they |
|
34 will be useful, but WITHOUT ANY WARRANTY; without even the implied |
|
35 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
|
36 the GNU General Public License for more details. |
|
37 |
|
38 You should have received a copy of the GNU General Public License |
|
39 along with this file; see the file COPYING. If not, write to the Free |
|
40 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
|
41 |
|
42 |
|
43 // Revised francis.dupin@inrets.fr 2003-07 |
|
44 |
|
45 #ifndef _M68HC11_PORTS_H |
|
46 #define _M68HC11_PORTS_H |
|
47 |
|
48 |
|
49 |
|
50 #include <asm-m68hc12/ports_def.h> |
|
51 |
|
52 /* Prototypes */ |
|
53 unsigned short get_timer_counter (void); |
|
54 void set_timer_counter (unsigned short value); |
|
55 void cop_reset (void); |
|
56 |
|
57 |
|
58 /* Must me adapted to hc12 |
|
59 void timer_acknowledge (void); |
|
60 void timer_initialize_rate (unsigned char divisor); |
|
61 void set_bus_expanded (void); |
|
62 void set_bus_single_chip (void); |
|
63 unsigned short * get_input_capture_1 (void); |
|
64 void set_input_capture_1 (unsigned short value); |
|
65 unsigned short * get_input_capture_2 (void); |
|
66 void set_input_capture_2 (unsigned short value); |
|
67 unsigned short * get_input_capture_3 (void); |
|
68 void set_input_capture_3 (unsigned short value); |
|
69 unsigned short * get_output_compare_1 (void); |
|
70 void set_output_compare_1 (unsigned short value); |
|
71 unsigned short * get_output_compare_2 (void); |
|
72 void set_output_compare_2 (unsigned short value); |
|
73 unsigned short * get_output_compare_3 (void); |
|
74 void set_output_compare_3 (unsigned short value); |
|
75 unsigned short * get_output_compare_4 (void); |
|
76 void set_output_compare_4 (unsigned short value); |
|
77 unsigned short * get_output_compare_5 (void); |
|
78 void set_output_compare_5 (unsigned short value); |
|
79 */ |
|
80 |
|
81 |
|
82 extern inline unsigned short |
|
83 get_timer_counter (void) |
|
84 { |
|
85 return ((unsigned volatile short*) &_io_ports[TCNTH])[0]; |
|
86 } |
|
87 |
|
88 extern inline void |
|
89 set_timer_counter (unsigned short value) |
|
90 { |
|
91 ((unsigned volatile short*) &_io_ports[TCNTH])[0] = value; |
|
92 } |
|
93 |
|
94 |
|
95 /* Reset the COP. */ |
|
96 extern inline void |
|
97 cop_reset (void) |
|
98 { |
|
99 _io_ports[ARMCOP] = 0x55; |
|
100 _io_ports[ARMCOP] = 0xAA; |
|
101 } |
|
102 |
|
103 |
|
104 #if 0 |
|
105 /* Acknowledge the timer interrupt. */ |
|
106 extern inline void |
|
107 timer_acknowledge (void) |
|
108 { |
|
109 _io_ports[TFLG2] = 0x80; |
|
110 } |
|
111 |
|
112 /* Initialize the timer. */ |
|
113 extern inline void |
|
114 timer_initialize_rate (unsigned char divisor) |
|
115 { |
|
116 _io_ports[M6811_TMSK2] = M6811_RTII | divisor; |
|
117 } |
|
118 |
|
119 extern inline void |
|
120 cop_optional_reset (void) |
|
121 { |
|
122 #if defined(M6811_USE_COP) && M6811_USE_COP == 1 |
|
123 cop_reset (); |
|
124 #endif |
|
125 } |
|
126 |
|
127 /* Set the board in the expanded mode to get access to external bus. */ |
|
128 extern inline void |
|
129 set_bus_expanded (void) |
|
130 { |
|
131 _io_ports[M6811_HPRIO] |= M6811_MDA; |
|
132 } |
|
133 |
|
134 |
|
135 /* Set the board in single chip mode. */ |
|
136 extern inline void |
|
137 set_bus_single_chip (void) |
|
138 { |
|
139 _io_ports[M6811_HPRIO] &= ~M6811_MDA; |
|
140 } |
|
141 |
|
142 extern inline unsigned short |
|
143 get_input_capture_1 (void) |
|
144 { |
|
145 return ((unsigned volatile short*) &_io_ports[M6811_TIC1_H])[0]; |
|
146 } |
|
147 |
|
148 extern inline void |
|
149 set_input_capture_1 (unsigned short value) |
|
150 { |
|
151 ((unsigned volatile short*) &_io_ports[M6811_TIC1_H])[0] = value; |
|
152 } |
|
153 |
|
154 extern inline unsigned short |
|
155 get_input_capture_2 (void) |
|
156 { |
|
157 return ((unsigned volatile short*) &_io_ports[M6811_TIC2_H])[0]; |
|
158 } |
|
159 |
|
160 extern inline void |
|
161 set_input_capture_2 (unsigned short value) |
|
162 { |
|
163 ((unsigned volatile short*) &_io_ports[M6811_TIC2_H])[0] = value; |
|
164 } |
|
165 |
|
166 extern inline unsigned short |
|
167 get_input_capture_3 (void) |
|
168 { |
|
169 return ((unsigned volatile short*) &_io_ports[M6811_TIC3_H])[0]; |
|
170 } |
|
171 |
|
172 extern inline void |
|
173 set_input_capture_3 (unsigned short value) |
|
174 { |
|
175 ((unsigned volatile short*) &_io_ports[M6811_TIC3_H])[0] = value; |
|
176 } |
|
177 |
|
178 /* Get output compare 16-bit register. */ |
|
179 extern inline unsigned short |
|
180 get_output_compare_1 (void) |
|
181 { |
|
182 return ((unsigned volatile short*) &_io_ports[M6811_TOC1_H])[0]; |
|
183 } |
|
184 |
|
185 extern inline void |
|
186 set_output_compare_1 (unsigned short value) |
|
187 { |
|
188 ((unsigned volatile short*) &_io_ports[M6811_TOC1_H])[0] = value; |
|
189 } |
|
190 |
|
191 extern inline unsigned short |
|
192 get_output_compare_2 (void) |
|
193 { |
|
194 return ((unsigned volatile short*) &_io_ports[M6811_TOC2_H])[0]; |
|
195 } |
|
196 |
|
197 extern inline void |
|
198 set_output_compare_2 (unsigned short value) |
|
199 { |
|
200 ((unsigned volatile short*) &_io_ports[M6811_TOC2_H])[0] = value; |
|
201 } |
|
202 |
|
203 extern inline unsigned short |
|
204 get_output_compare_3 (void) |
|
205 { |
|
206 return ((unsigned volatile short*) &_io_ports[M6811_TOC3_H])[0]; |
|
207 } |
|
208 |
|
209 extern inline void |
|
210 set_output_compare_3 (unsigned short value) |
|
211 { |
|
212 ((unsigned volatile short*) &_io_ports[M6811_TOC3_H])[0] = value; |
|
213 } |
|
214 |
|
215 extern inline unsigned short |
|
216 get_output_compare_4 (void) |
|
217 { |
|
218 return ((unsigned volatile short*) &_io_ports[M6811_TOC4_H])[0]; |
|
219 } |
|
220 |
|
221 extern inline void |
|
222 set_output_compare_4 (unsigned short value) |
|
223 { |
|
224 ((unsigned volatile short*) &_io_ports[M6811_TOC4_H])[0] = value; |
|
225 } |
|
226 |
|
227 extern inline unsigned short |
|
228 get_output_compare_5 (void) |
|
229 { |
|
230 return ((unsigned volatile short*) &_io_ports[M6811_TOC5_H])[0]; |
|
231 } |
|
232 |
|
233 extern inline void |
|
234 set_output_compare_5 (unsigned short value) |
|
235 { |
|
236 ((unsigned volatile short*) &_io_ports[M6811_TOC5_H])[0] = value; |
|
237 } |
|
238 |
|
239 #endif |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 #endif /* _M68HC11_PORTS_H */ |
|
245 |