version 4.2.0
[fx2fw-sdcc] / fx2 / timer.c
index 44e46e8..3b268ac 100644 (file)
@@ -1,94 +1,47 @@
 /* -*- c++ -*- */\r
-\r
 /*-----------------------------------------------------------------------------\r
-\r
  * Timer handling for FX2\r
-\r
  *-----------------------------------------------------------------------------\r
-\r
  * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2,\r
-\r
  * Copyright 2003 Free Software Foundation, Inc.\r
-\r
  *-----------------------------------------------------------------------------\r
-\r
  * This code is part of usbjtag. usbjtag is free software; you can redistribute\r
-\r
  * it and/or modify it under the terms of the GNU General Public License as\r
-\r
  * published by the Free Software Foundation; either version 2 of the License,\r
-\r
  * or (at your option) any later version. usbjtag is distributed in the hope\r
-\r
  * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied\r
-\r
  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-\r
  * GNU General Public License for more details.  You should have received a\r
-\r
  * copy of the GNU General Public License along with this program in the file\r
-\r
  * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin\r
-\r
  * St, Fifth Floor, Boston, MA  02110-1301  USA\r
-\r
  *-----------------------------------------------------------------------------\r
-\r
  */\r
 \r
-\r
-\r
 #include "timer.h"\r
-\r
 #include "fx2regs.h"\r
-\r
 #include "isr.h"\r
 \r
-\r
-\r
 /*\r
-\r
  * Arrange to have isr_tick_handler called at 100 Hz.\r
-\r
  *\r
-\r
  * The cpu clock is running at 48e6.  The input to the timer\r
-\r
  * is 48e6 / 12 = 4e6.\r
-\r
  *\r
-\r
  * We arrange to have the timer overflow every 40000 clocks == 100 Hz\r
-\r
  */\r
 \r
-\r
-\r
 #define        RELOAD_VALUE    ((unsigned short) -40000)\r
 \r
-\r
-\r
 void \r
-\r
 hook_timer_tick (unsigned short isr_tick_handler)\r
-\r
 {\r
-\r
   ET2 = 0;                     // disable timer 2 interrupts\r
-\r
   hook_sv (SV_TIMER_2, isr_tick_handler);\r
-\r
   \r
-\r
   RCAP2H = RELOAD_VALUE >> 8;  // setup the auto reload value\r
-\r
   RCAP2L = RELOAD_VALUE & 0xFF;\r
 \r
-\r
-\r
   T2CON = 0x04;                        // interrupt on overflow; reload; run\r
-\r
   ET2 = 1;                     // enable timer 2 interrupts\r
-\r
 }\r
-\r