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