4.27

来源:互联网 发布:网络中继 编辑:程序博客网 时间:2024/06/05 02:11
#include "S3C2451_Timer.h"
#include "S3C2451_vector.h"
//#include "SAMSUNG2440_it.h"
#include "S3C2451_irq.h"




TIM_MemMapPtr const TIMER_BASE_PTR = TIM_BASE_PTR;


void TIM_TimeBaseInit(TIM_TypeDef timx ,TIM_TimeBaseInitTypeDef tim_timbaseinit_structure)
{
if(timx == Timer_Ch0)
{
TIMER_BASE_PTR->TCFG0 &= ~(0xff);
TIMER_BASE_PTR->TCFG0 |= tim_timbaseinit_structure.TIM_Prescale;

TIMER_BASE_PTR->TCFG1 &= ~(0xf);
TIMER_BASE_PTR->TCFG1 |= tim_timbaseinit_structure.TIM_Scale;

TIMER_BASE_PTR->TCNTB0 = tim_timbaseinit_structure.TIM_CountVal;
TIMER_BASE_PTR->TCMPB0 = tim_timbaseinit_structure.TIM_CompareVal;

TIMER_BASE_PTR->TCON |= (1<<1);
TIMER_BASE_PTR->TCON = 0x09;
}
}


void TIM_Interrupt_IRQInit(TIM_TypeDef timx,U32 addr)
{
if(timx == Timer_Ch0)
{
pISR_TIMER0 = addr ;
}
}
0 0