Main Page | Modules | Data Structures | File List | Data Fields | Globals

ports.h

Go to the documentation of this file.
00001 /* m68hc11/ports.h -- Definition of 68HC11 ports
00002     Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
00003     Written by Stephane Carrez (stcarrez@nerim.fr)
00004     Modified by Paul Harvey (csirac@users.sourceforge.net)
00005     for use with the BeeOS project 2004/03.
00006 
00007     This file was part of GDB, GAS, and the GNU binutils.
00008     
00009     GDB, GAS, and the GNU binutils are free software; you can redistribute
00010     them and/or modify them under the terms of the GNU General Public
00011     License as published by the Free Software Foundation; either version
00012     1, or (at your option) any later version.
00013     
00014     GDB, GAS, and the GNU binutils are distributed in the hope that they
00015     will be useful, but WITHOUT ANY WARRANTY; without even the implied
00016     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
00017     the GNU General Public License for more details.
00018     
00019     You should have received a copy of the GNU General Public License
00020     along with this file; see the file COPYING.  If not, write to the Free
00021     Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00022  */
00023 
00034 #ifndef _M68HC11_PORTS_H
00035 #define _M68HC11_PORTS_H
00036 
00037 /*#include "../include/syscall/ports_def.h"*/
00038 
00039 extern __inline__ unsigned short
00040 get_timer_counter (void)
00041 {
00042   return ((unsigned volatile short*) &_io_ports[M6812_TCNT])[0];
00043 }
00044 
00045 extern __inline__ void
00046 set_timer_counter (unsigned short value)
00047 {
00048   ((unsigned volatile short*) &_io_ports[M6812_TCNT])[0] = value;
00049 }
00050 #if 0
00051 extern __inline__ unsigned short
00052 get_input_capture_1 (void)
00053 {
00054   return ((unsigned volatile short*) &_io_ports[M6811_TIC1_H])[0];
00055 }
00056 
00057 extern __inline__ void
00058 set_input_capture_1 (unsigned short value)
00059 {
00060   ((unsigned volatile short*) &_io_ports[M6811_TIC1_H])[0] = value;
00061 }
00062 
00063 extern __inline__ unsigned short
00064 get_input_capture_2 (void)
00065 {
00066   return ((unsigned volatile short*) &_io_ports[M6811_TIC2_H])[0];
00067 }
00068 
00069 extern __inline__ void
00070 set_input_capture_2 (unsigned short value)
00071 {
00072   ((unsigned volatile short*) &_io_ports[M6811_TIC2_H])[0] = value;
00073 }
00074 
00075 extern __inline__ unsigned short
00076 get_input_capture_3 (void)
00077 {
00078   return ((unsigned volatile short*) &_io_ports[M6811_TIC3_H])[0];
00079 }
00080 
00081 extern __inline__ void
00082 set_input_capture_3 (unsigned short value)
00083 {
00084   ((unsigned volatile short*) &_io_ports[M6811_TIC3_H])[0] = value;
00085 }
00086 
00087 /* Get output compare 16-bit register.  */
00088 extern __inline__ unsigned short
00089 get_output_compare_1 (void)
00090 {
00091   return ((unsigned volatile short*) &_io_ports[M6811_TOC1_H])[0];
00092 }
00093 
00094 extern __inline__ void
00095 set_output_compare_1 (unsigned short value)
00096 {
00097   ((unsigned volatile short*) &_io_ports[M6811_TOC1_H])[0] = value;
00098 }
00099 
00100 extern __inline__ unsigned short
00101 get_output_compare_2 (void)
00102 {
00103   return ((unsigned volatile short*) &_io_ports[M6811_TOC2_H])[0];
00104 }
00105 
00106 extern __inline__ void
00107 set_output_compare_2 (unsigned short value)
00108 {
00109   ((unsigned volatile short*) &_io_ports[M6811_TOC2_H])[0] = value;
00110 }
00111 
00112 extern __inline__ unsigned short
00113 get_output_compare_3 (void)
00114 {
00115   return ((unsigned volatile short*) &_io_ports[M6811_TOC3_H])[0];
00116 }
00117 
00118 extern __inline__ void
00119 set_output_compare_3 (unsigned short value)
00120 {
00121   ((unsigned volatile short*) &_io_ports[M6811_TOC3_H])[0] = value;
00122 }
00123 
00124 extern __inline__ unsigned short
00125 get_output_compare_4 (void)
00126 {
00127   return ((unsigned volatile short*) &_io_ports[M6811_TOC4_H])[0];
00128 }
00129 
00130 extern __inline__ void
00131 set_output_compare_4 (unsigned short value)
00132 {
00133   ((unsigned volatile short*) &_io_ports[M6811_TOC4_H])[0] = value;
00134 }
00135 
00136 extern __inline__ unsigned short
00137 get_output_compare_5 (void)
00138 {
00139   return ((unsigned volatile short*) &_io_ports[M6811_TOC5_H])[0];
00140 }
00141 
00142 extern __inline__ void
00143 set_output_compare_5 (unsigned short value)
00144 {
00145   ((unsigned volatile short*) &_io_ports[M6811_TOC5_H])[0] = value;
00146 }
00147 
00148 /* Set the board in the expanded mode to get access to external bus.  */
00149 extern __inline__ void
00150 set_bus_expanded (void)
00151 {
00152   _io_ports[M6812_HPRIO] |= M6811_MDA;
00153 }
00154 
00155 
00156 /* Set the board in single chip mode.  */
00157 extern __inline__ void
00158 set_bus_single_chip (void)
00159 {
00160   _io_ports[M6811_HPRIO] &= ~M6811_MDA;
00161 }
00162 #endif
00163 
00164 /* Reset the COP.  */
00165 extern __inline__ void
00166 cop_reset (void)
00167 {
00168   _io_ports[M6812_COPRST] = 0x55;
00169   _io_ports[M6812_COPRST] = 0xAA;
00170 }
00171 
00172 extern __inline__ void
00173 cop_optional_reset (void)
00174 {
00175 #if defined(M6811_USE_COP) && M6811_USE_COP == 1
00176   cop_reset ();
00177 #endif
00178 }
00179 
00180 /* Acknowledge the timer interrupt.  */
00181 extern __inline__ void
00182 timer_acknowledge (void)
00183 {
00184   _io_ports[M6812_RTIFLG] = M6812_RTIF;
00185 }
00186 
00187 /* Initialize the timer.  */
00188 extern __inline__ void
00189 timer_initialize_rate (unsigned char divisor)
00190 {
00191   _io_ports[M6812_RTICTL] = divisor;
00192 }
00193 
00194 #endif /* _M68HC11_PORTS_H */

Generated on Sat Apr 10 17:08:02 2004 for BeeOS by doxygen 1.3.6-20040222