timer_lpc2.c
Go to the documentation of this file.00001
00039 #include "cfg/cfg_timer.h"
00040 #include <cfg/macros.h>
00041 #include <cfg/debug.h>
00042
00043 #include <drv/vic_lpc2.h>
00044 #include <io/lpc23xx.h>
00045 #include "timer_lpc2.h"
00046
00048 #if (CONFIG_TIMER == TIMER0_COMPARE0)
00049 #define TIMER0_ID 4
00050 void timer_hw_init(void)
00051 {
00052
00053 PCONP |= BV(1);
00054
00055
00056 PCLKSEL0 &= ~0x0C;
00057 PCLKSEL0 |= 0x04;
00058
00059
00060 T0PR = 0;
00061
00062
00063 T0MR0 = TIMER_HW_CNT;
00064
00065 T0MCR &= ~0x03;
00066 T0MCR |= 0x03;
00067
00068 T0TCR = 0x02;
00069
00070 vic_setVector(TIMER0_ID, timer_handler);
00071 vic_enable(TIMER0_ID);
00072
00073
00074 T0TCR = 0x01;
00075 }
00076
00077
00078 #else
00079 #error Unimplemented value for CONFIG_TIMER
00080 #endif
00081