USB-BDI
|
00001 /* USB-BDI Used for programming and debugging a MPC555 over USB 00002 * 00003 * Copyright 2005 NTB Interstate University of Applied Sciences of Technology Buchs 00004 * 00005 * This program is free software: you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation, either version 3 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 */ 00015 00024 #include "timer.h" 00025 #include "fx2regs.h" 00026 #include "isr.h" 00027 00037 #define RELOAD_VALUE ((unsigned short) -40000) 00038 00044 void hook_timer_tick (unsigned short isr_tick_handler){ 00045 ET2 = 0; // disable timer 2 interrupts 00046 hook_sv (SV_TIMER_2, isr_tick_handler); 00047 00048 RCAP2H = RELOAD_VALUE >> 8; // setup the auto reload value 00049 RCAP2L = RELOAD_VALUE & 0x00FF; 00050 00051 T2CON = 0x04; // interrupt on overflow; reload; run 00052 ET2 = 1; // enable timer 2 interrupts 00053 }