nico@207: nico@207:
nico@207:00001 /* nico@207: 00002 This file is part of CanFestival, a library implementing CanOpen Stack. nico@207: 00003 nico@207: 00004 Copyright (C): Edouard TISSERANT and Francis DUPIN nico@207: 00005 nico@207: 00006 See COPYING file for copyrights details. nico@207: 00007 nico@207: 00008 This library is free software; you can redistribute it and/or nico@207: 00009 modify it under the terms of the GNU Lesser General Public nico@207: 00010 License as published by the Free Software Foundation; either nico@207: 00011 version 2.1 of the License, or (at your option) any later version. nico@207: 00012 nico@207: 00013 This library is distributed in the hope that it will be useful, nico@207: 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of nico@207: 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU nico@207: 00016 Lesser General Public License for more details. nico@207: 00017 nico@207: 00018 You should have received a copy of the GNU Lesser General Public nico@207: 00019 License along with this library; if not, write to the Free Software nico@207: 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA nico@207: 00021 */ nico@207: 00022 /* m68hc11/ports.h -- Definition of 68HC11 ports nico@207: 00023 Copyright 1999, 2000 Free Software Foundation, Inc. nico@207: 00024 Written by Stephane Carrez (stcarrez@worldnet.fr) nico@207: 00025 nico@207: 00026 This file is part of GDB, GAS, and the GNU binutils. nico@207: 00027 nico@207: 00028 GDB, GAS, and the GNU binutils are free software; you can redistribute nico@207: 00029 them and/or modify them under the terms of the GNU General Public nico@207: 00030 License as published by the Free Software Foundation; either version nico@207: 00031 1, or (at your option) any later version. nico@207: 00032 nico@207: 00033 GDB, GAS, and the GNU binutils are distributed in the hope that they nico@207: 00034 will be useful, but WITHOUT ANY WARRANTY; without even the implied nico@207: 00035 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See nico@207: 00036 the GNU General Public License for more details. nico@207: 00037 nico@207: 00038 You should have received a copy of the GNU General Public License nico@207: 00039 along with this file; see the file COPYING. If not, write to the Free nico@207: 00040 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ nico@207: 00041 nico@207: 00042 nico@207: 00043 /* Revised francis.dupin@inrets.fr 2003-07 */ nico@207: 00044 nico@207: 00045 #ifndef _M68HC11_PORTS_H nico@207: 00046 #define _M68HC11_PORTS_H nico@207: 00047 nico@207: 00048 nico@207: 00049 nico@207: 00050 #include <asm-m68hc12/ports_def.h> nico@207: 00051 nico@207: 00052 /* Prototypes */ nico@207: 00053 unsigned short get_timer_counter (void); nico@207: 00054 void set_timer_counter (unsigned short value); nico@207: 00055 void cop_reset (void); nico@207: 00056 nico@207: 00057 nico@207: 00058 /* Must me adapted to hc12 nico@207: 00059 void timer_acknowledge (void); nico@207: 00060 void timer_initialize_rate (unsigned char divisor); nico@207: 00061 void set_bus_expanded (void); nico@207: 00062 void set_bus_single_chip (void); nico@207: 00063 unsigned short * get_input_capture_1 (void); nico@207: 00064 void set_input_capture_1 (unsigned short value); nico@207: 00065 unsigned short * get_input_capture_2 (void); nico@207: 00066 void set_input_capture_2 (unsigned short value); nico@207: 00067 unsigned short * get_input_capture_3 (void); nico@207: 00068 void set_input_capture_3 (unsigned short value); nico@207: 00069 unsigned short * get_output_compare_1 (void); nico@207: 00070 void set_output_compare_1 (unsigned short value); nico@207: 00071 unsigned short * get_output_compare_2 (void); nico@207: 00072 void set_output_compare_2 (unsigned short value); nico@207: 00073 unsigned short * get_output_compare_3 (void); nico@207: 00074 void set_output_compare_3 (unsigned short value); nico@207: 00075 unsigned short * get_output_compare_4 (void); nico@207: 00076 void set_output_compare_4 (unsigned short value); nico@207: 00077 unsigned short * get_output_compare_5 (void); nico@207: 00078 void set_output_compare_5 (unsigned short value); nico@207: 00079 */ nico@207: 00080 nico@207: 00081 nico@207: 00082 extern inline unsigned short nico@207: 00083 get_timer_counter (void) nico@207: 00084 { nico@207: 00085 return ((unsigned volatile short*) &_io_ports[TCNTH])[0]; nico@207: 00086 } nico@207: 00087 nico@207: 00088 extern inline void nico@207: 00089 set_timer_counter (unsigned short value) nico@207: 00090 { nico@207: 00091 ((unsigned volatile short*) &_io_ports[TCNTH])[0] = value; nico@207: 00092 } nico@207: 00093 nico@207: 00094 nico@207: 00095 /* Reset the COP. */ nico@207: 00096 extern inline void nico@207: 00097 cop_reset (void) nico@207: 00098 { nico@207: 00099 _io_ports[ARMCOP] = 0x55; nico@207: 00100 _io_ports[ARMCOP] = 0xAA; nico@207: 00101 } nico@207: 00102 nico@207: 00103 nico@207: 00104 #if 0 nico@207: 00105 /* Acknowledge the timer interrupt. */ nico@207: 00106 extern inline void nico@207: 00107 timer_acknowledge (void) nico@207: 00108 { nico@207: 00109 _io_ports[TFLG2] = 0x80; nico@207: 00110 } nico@207: 00111 nico@207: 00112 /* Initialize the timer. */ nico@207: 00113 extern inline void nico@207: 00114 timer_initialize_rate (unsigned char divisor) nico@207: 00115 { nico@207: 00116 _io_ports[M6811_TMSK2] = M6811_RTII | divisor; nico@207: 00117 } nico@207: 00118 nico@207: 00119 extern inline void nico@207: 00120 cop_optional_reset (void) nico@207: 00121 { nico@207: 00122 #if defined(M6811_USE_COP) && M6811_USE_COP == 1 nico@207: 00123 cop_reset (); nico@207: 00124 #endif nico@207: 00125 } nico@207: 00126 nico@207: 00127 /* Set the board in the expanded mode to get access to external bus. */ nico@207: 00128 extern inline void nico@207: 00129 set_bus_expanded (void) nico@207: 00130 { nico@207: 00131 _io_ports[M6811_HPRIO] |= M6811_MDA; nico@207: 00132 } nico@207: 00133 nico@207: 00134 nico@207: 00135 /* Set the board in single chip mode. */ nico@207: 00136 extern inline void nico@207: 00137 set_bus_single_chip (void) nico@207: 00138 { nico@207: 00139 _io_ports[M6811_HPRIO] &= ~M6811_MDA; nico@207: 00140 } nico@207: 00141 nico@207: 00142 extern inline unsigned short nico@207: 00143 get_input_capture_1 (void) nico@207: 00144 { nico@207: 00145 return ((unsigned volatile short*) &_io_ports[M6811_TIC1_H])[0]; nico@207: 00146 } nico@207: 00147 nico@207: 00148 extern inline void nico@207: 00149 set_input_capture_1 (unsigned short value) nico@207: 00150 { nico@207: 00151 ((unsigned volatile short*) &_io_ports[M6811_TIC1_H])[0] = value; nico@207: 00152 } nico@207: 00153 nico@207: 00154 extern inline unsigned short nico@207: 00155 get_input_capture_2 (void) nico@207: 00156 { nico@207: 00157 return ((unsigned volatile short*) &_io_ports[M6811_TIC2_H])[0]; nico@207: 00158 } nico@207: 00159 nico@207: 00160 extern inline void nico@207: 00161 set_input_capture_2 (unsigned short value) nico@207: 00162 { nico@207: 00163 ((unsigned volatile short*) &_io_ports[M6811_TIC2_H])[0] = value; nico@207: 00164 } nico@207: 00165 nico@207: 00166 extern inline unsigned short nico@207: 00167 get_input_capture_3 (void) nico@207: 00168 { nico@207: 00169 return ((unsigned volatile short*) &_io_ports[M6811_TIC3_H])[0]; nico@207: 00170 } nico@207: 00171 nico@207: 00172 extern inline void nico@207: 00173 set_input_capture_3 (unsigned short value) nico@207: 00174 { nico@207: 00175 ((unsigned volatile short*) &_io_ports[M6811_TIC3_H])[0] = value; nico@207: 00176 } nico@207: 00177 nico@207: 00178 /* Get output compare 16-bit register. */ nico@207: 00179 extern inline unsigned short nico@207: 00180 get_output_compare_1 (void) nico@207: 00181 { nico@207: 00182 return ((unsigned volatile short*) &_io_ports[M6811_TOC1_H])[0]; nico@207: 00183 } nico@207: 00184 nico@207: 00185 extern inline void nico@207: 00186 set_output_compare_1 (unsigned short value) nico@207: 00187 { nico@207: 00188 ((unsigned volatile short*) &_io_ports[M6811_TOC1_H])[0] = value; nico@207: 00189 } nico@207: 00190 nico@207: 00191 extern inline unsigned short nico@207: 00192 get_output_compare_2 (void) nico@207: 00193 { nico@207: 00194 return ((unsigned volatile short*) &_io_ports[M6811_TOC2_H])[0]; nico@207: 00195 } nico@207: 00196 nico@207: 00197 extern inline void nico@207: 00198 set_output_compare_2 (unsigned short value) nico@207: 00199 { nico@207: 00200 ((unsigned volatile short*) &_io_ports[M6811_TOC2_H])[0] = value; nico@207: 00201 } nico@207: 00202 nico@207: 00203 extern inline unsigned short nico@207: 00204 get_output_compare_3 (void) nico@207: 00205 { nico@207: 00206 return ((unsigned volatile short*) &_io_ports[M6811_TOC3_H])[0]; nico@207: 00207 } nico@207: 00208 nico@207: 00209 extern inline void nico@207: 00210 set_output_compare_3 (unsigned short value) nico@207: 00211 { nico@207: 00212 ((unsigned volatile short*) &_io_ports[M6811_TOC3_H])[0] = value; nico@207: 00213 } nico@207: 00214 nico@207: 00215 extern inline unsigned short nico@207: 00216 get_output_compare_4 (void) nico@207: 00217 { nico@207: 00218 return ((unsigned volatile short*) &_io_ports[M6811_TOC4_H])[0]; nico@207: 00219 } nico@207: 00220 nico@207: 00221 extern inline void nico@207: 00222 set_output_compare_4 (unsigned short value) nico@207: 00223 { nico@207: 00224 ((unsigned volatile short*) &_io_ports[M6811_TOC4_H])[0] = value; nico@207: 00225 } nico@207: 00226 nico@207: 00227 extern inline unsigned short nico@207: 00228 get_output_compare_5 (void) nico@207: 00229 { nico@207: 00230 return ((unsigned volatile short*) &_io_ports[M6811_TOC5_H])[0]; nico@207: 00231 } nico@207: 00232 nico@207: 00233 extern inline void nico@207: 00234 set_output_compare_5 (unsigned short value) nico@207: 00235 { nico@207: 00236 ((unsigned volatile short*) &_io_ports[M6811_TOC5_H])[0] = value; nico@207: 00237 } nico@207: 00238 nico@207: 00239 #endif nico@207: 00240 nico@207: 00241 nico@207: 00242 nico@207: 00243 nico@207: 00244 #endif /* _M68HC11_PORTS_H */ nico@207: 00245 nico@207: