etisserant@0: /* etisserant@0: This file is part of CanFestival, a library implementing CanOpen Stack. etisserant@0: etisserant@0: Copyright (C): Edouard TISSERANT and Francis DUPIN etisserant@0: etisserant@0: See COPYING file for copyrights details. etisserant@0: etisserant@0: This library is free software; you can redistribute it and/or etisserant@0: modify it under the terms of the GNU Lesser General Public etisserant@0: License as published by the Free Software Foundation; either etisserant@0: version 2.1 of the License, or (at your option) any later version. etisserant@0: etisserant@0: This library is distributed in the hope that it will be useful, etisserant@0: but WITHOUT ANY WARRANTY; without even the implied warranty of etisserant@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU etisserant@0: Lesser General Public License for more details. etisserant@0: etisserant@0: You should have received a copy of the GNU Lesser General Public etisserant@0: License along with this library; if not, write to the Free Software etisserant@0: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA etisserant@0: */ etisserant@0: /* m68hc11/ports.h -- Definition of 68HC11 ports etisserant@0: Copyright 1999, 2000 Free Software Foundation, Inc. etisserant@0: Written by Stephane Carrez (stcarrez@worldnet.fr) etisserant@0: etisserant@0: This file is part of GDB, GAS, and the GNU binutils. etisserant@0: etisserant@0: GDB, GAS, and the GNU binutils are free software; you can redistribute etisserant@0: them and/or modify them under the terms of the GNU General Public etisserant@0: License as published by the Free Software Foundation; either version etisserant@0: 1, or (at your option) any later version. etisserant@0: etisserant@0: GDB, GAS, and the GNU binutils are distributed in the hope that they etisserant@0: will be useful, but WITHOUT ANY WARRANTY; without even the implied etisserant@0: warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See etisserant@0: the GNU General Public License for more details. etisserant@0: etisserant@0: You should have received a copy of the GNU General Public License etisserant@0: along with this file; see the file COPYING. If not, write to the Free etisserant@0: Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ etisserant@0: etisserant@0: etisserant@0: // Revised francis.dupin@inrets.fr 2003-07 etisserant@0: etisserant@0: #ifndef _M68HC11_PORTS_H etisserant@0: #define _M68HC11_PORTS_H etisserant@0: etisserant@0: etisserant@0: etisserant@0: #include etisserant@0: etisserant@0: /* Prototypes */ etisserant@0: unsigned short get_timer_counter (void); etisserant@0: void set_timer_counter (unsigned short value); etisserant@0: void cop_reset (void); etisserant@0: etisserant@0: etisserant@0: /* Must me adapted to hc12 etisserant@0: void timer_acknowledge (void); etisserant@0: void timer_initialize_rate (unsigned char divisor); etisserant@0: void set_bus_expanded (void); etisserant@0: void set_bus_single_chip (void); etisserant@0: unsigned short * get_input_capture_1 (void); etisserant@0: void set_input_capture_1 (unsigned short value); etisserant@0: unsigned short * get_input_capture_2 (void); etisserant@0: void set_input_capture_2 (unsigned short value); etisserant@0: unsigned short * get_input_capture_3 (void); etisserant@0: void set_input_capture_3 (unsigned short value); etisserant@0: unsigned short * get_output_compare_1 (void); etisserant@0: void set_output_compare_1 (unsigned short value); etisserant@0: unsigned short * get_output_compare_2 (void); etisserant@0: void set_output_compare_2 (unsigned short value); etisserant@0: unsigned short * get_output_compare_3 (void); etisserant@0: void set_output_compare_3 (unsigned short value); etisserant@0: unsigned short * get_output_compare_4 (void); etisserant@0: void set_output_compare_4 (unsigned short value); etisserant@0: unsigned short * get_output_compare_5 (void); etisserant@0: void set_output_compare_5 (unsigned short value); etisserant@0: */ etisserant@0: etisserant@0: etisserant@0: extern inline unsigned short etisserant@0: get_timer_counter (void) etisserant@0: { etisserant@0: return ((unsigned volatile short*) &_io_ports[TCNTH])[0]; etisserant@0: } etisserant@0: etisserant@0: extern inline void etisserant@0: set_timer_counter (unsigned short value) etisserant@0: { etisserant@0: ((unsigned volatile short*) &_io_ports[TCNTH])[0] = value; etisserant@0: } etisserant@0: etisserant@0: etisserant@0: /* Reset the COP. */ etisserant@0: extern inline void etisserant@0: cop_reset (void) etisserant@0: { etisserant@0: _io_ports[ARMCOP] = 0x55; etisserant@0: _io_ports[ARMCOP] = 0xAA; etisserant@0: } etisserant@0: etisserant@0: etisserant@0: #if 0 etisserant@0: /* Acknowledge the timer interrupt. */ etisserant@0: extern inline void etisserant@0: timer_acknowledge (void) etisserant@0: { etisserant@0: _io_ports[TFLG2] = 0x80; etisserant@0: } etisserant@0: etisserant@0: /* Initialize the timer. */ etisserant@0: extern inline void etisserant@0: timer_initialize_rate (unsigned char divisor) etisserant@0: { etisserant@0: _io_ports[M6811_TMSK2] = M6811_RTII | divisor; etisserant@0: } etisserant@0: etisserant@0: extern inline void etisserant@0: cop_optional_reset (void) etisserant@0: { etisserant@0: #if defined(M6811_USE_COP) && M6811_USE_COP == 1 etisserant@0: cop_reset (); etisserant@0: #endif etisserant@0: } etisserant@0: etisserant@0: /* Set the board in the expanded mode to get access to external bus. */ etisserant@0: extern inline void etisserant@0: set_bus_expanded (void) etisserant@0: { etisserant@0: _io_ports[M6811_HPRIO] |= M6811_MDA; etisserant@0: } etisserant@0: etisserant@0: etisserant@0: /* Set the board in single chip mode. */ etisserant@0: extern inline void etisserant@0: set_bus_single_chip (void) etisserant@0: { etisserant@0: _io_ports[M6811_HPRIO] &= ~M6811_MDA; etisserant@0: } etisserant@0: etisserant@0: extern inline unsigned short etisserant@0: get_input_capture_1 (void) etisserant@0: { etisserant@0: return ((unsigned volatile short*) &_io_ports[M6811_TIC1_H])[0]; etisserant@0: } etisserant@0: etisserant@0: extern inline void etisserant@0: set_input_capture_1 (unsigned short value) etisserant@0: { etisserant@0: ((unsigned volatile short*) &_io_ports[M6811_TIC1_H])[0] = value; etisserant@0: } etisserant@0: etisserant@0: extern inline unsigned short etisserant@0: get_input_capture_2 (void) etisserant@0: { etisserant@0: return ((unsigned volatile short*) &_io_ports[M6811_TIC2_H])[0]; etisserant@0: } etisserant@0: etisserant@0: extern inline void etisserant@0: set_input_capture_2 (unsigned short value) etisserant@0: { etisserant@0: ((unsigned volatile short*) &_io_ports[M6811_TIC2_H])[0] = value; etisserant@0: } etisserant@0: etisserant@0: extern inline unsigned short etisserant@0: get_input_capture_3 (void) etisserant@0: { etisserant@0: return ((unsigned volatile short*) &_io_ports[M6811_TIC3_H])[0]; etisserant@0: } etisserant@0: etisserant@0: extern inline void etisserant@0: set_input_capture_3 (unsigned short value) etisserant@0: { etisserant@0: ((unsigned volatile short*) &_io_ports[M6811_TIC3_H])[0] = value; etisserant@0: } etisserant@0: etisserant@0: /* Get output compare 16-bit register. */ etisserant@0: extern inline unsigned short etisserant@0: get_output_compare_1 (void) etisserant@0: { etisserant@0: return ((unsigned volatile short*) &_io_ports[M6811_TOC1_H])[0]; etisserant@0: } etisserant@0: etisserant@0: extern inline void etisserant@0: set_output_compare_1 (unsigned short value) etisserant@0: { etisserant@0: ((unsigned volatile short*) &_io_ports[M6811_TOC1_H])[0] = value; etisserant@0: } etisserant@0: etisserant@0: extern inline unsigned short etisserant@0: get_output_compare_2 (void) etisserant@0: { etisserant@0: return ((unsigned volatile short*) &_io_ports[M6811_TOC2_H])[0]; etisserant@0: } etisserant@0: etisserant@0: extern inline void etisserant@0: set_output_compare_2 (unsigned short value) etisserant@0: { etisserant@0: ((unsigned volatile short*) &_io_ports[M6811_TOC2_H])[0] = value; etisserant@0: } etisserant@0: etisserant@0: extern inline unsigned short etisserant@0: get_output_compare_3 (void) etisserant@0: { etisserant@0: return ((unsigned volatile short*) &_io_ports[M6811_TOC3_H])[0]; etisserant@0: } etisserant@0: etisserant@0: extern inline void etisserant@0: set_output_compare_3 (unsigned short value) etisserant@0: { etisserant@0: ((unsigned volatile short*) &_io_ports[M6811_TOC3_H])[0] = value; etisserant@0: } etisserant@0: etisserant@0: extern inline unsigned short etisserant@0: get_output_compare_4 (void) etisserant@0: { etisserant@0: return ((unsigned volatile short*) &_io_ports[M6811_TOC4_H])[0]; etisserant@0: } etisserant@0: etisserant@0: extern inline void etisserant@0: set_output_compare_4 (unsigned short value) etisserant@0: { etisserant@0: ((unsigned volatile short*) &_io_ports[M6811_TOC4_H])[0] = value; etisserant@0: } etisserant@0: etisserant@0: extern inline unsigned short etisserant@0: get_output_compare_5 (void) etisserant@0: { etisserant@0: return ((unsigned volatile short*) &_io_ports[M6811_TOC5_H])[0]; etisserant@0: } etisserant@0: etisserant@0: extern inline void etisserant@0: set_output_compare_5 (unsigned short value) etisserant@0: { etisserant@0: ((unsigned volatile short*) &_io_ports[M6811_TOC5_H])[0] = value; etisserant@0: } etisserant@0: etisserant@0: #endif etisserant@0: etisserant@0: etisserant@0: etisserant@0: etisserant@0: #endif /* _M68HC11_PORTS_H */ etisserant@0: