|
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 /* |
|
23 Variables to access to the io_ports |
|
24 */ |
|
25 |
|
26 |
|
27 #ifndef __PORTS_ACCESS__ |
|
28 #define __PORTS_ACCESS__ |
|
29 |
|
30 /* |
|
31 By default the address is 0X0000 on HCS12. |
|
32 But the ports can be remaped. See the file ports.h |
|
33 */ |
|
34 |
|
35 |
|
36 extern volatile unsigned char _io_ports[]; |
|
37 |
|
38 /* To use for a 8 bits access */ |
|
39 #define IO_PORTS_8(adr) \ |
|
40 _io_ports[adr] |
|
41 |
|
42 /* To use for a 16 bits access */ |
|
43 /* Example : IO_PORTS_16(CAN0IDAR1)= 0xABCD; |
|
44 will put AB at @CAN0IDAR1 and CD at @CAN0IDAR1 + 1 |
|
45 */ |
|
46 #define IO_PORTS_16(adr) \ |
|
47 *((unsigned volatile short*) (_io_ports + (adr))) |
|
48 |
|
49 #endif |