ports.h

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

Generated on Mon Jul 2 19:10:16 2007 for CanFestival by  doxygen 1.5.1