📄 timer.c
字号:
/************************************************************************
* MODIFICATION HISTORY
* 2002/3/13 Pessia Delete unwanted prototypes of functions
************************************************************************/
//#include "M68328.h"
//#include <string.h>
#include "hardware.h"
#define IRQ_NR 255
#define TIMER_IRQ_NR 64
/* Prototype of Static Functions */
void boot(void);
void dummy(void);
void zero_div(void);
void addr_exp(void);
void ENT_INT_GPT(void);
/* Prototype of Extern Functions */
extern void sys_clk( void );
extern void ret_int( void );
extern void int_rtc( void );
extern void int_key( void );
//extern void int_touch_panel( void );
//extern void int_rtc_and_uart( void );
extern void PWM_isr(void);
//extern void key_isr( void );
//for idle times test
extern int Ttimes;
extern int Itimes;
extern int Iflags;
/* functions for init */
extern void main( void );
/*******************************************************************************
* dummy
* Type : void
* Ret val : none
* Argument : void
* Function : Dummy interrupt program.
*******************************************************************************/
/*void dummy(void)
{
INT_LOOP:
goto INT_LOOP;
}
void zero_div(void)
{
INT_LOOP:
goto INT_LOOP;
}
void addr_exp(void)
{
INT_LOOP:
goto INT_LOOP;
}
static void timer_isr( void )
{
volatile U32 clear_int;
//for idle times test:
Ttimes++;
if(Iflags == 1)
Itimes++;
sys_clk();
#ifdef GIII
if ( (read_reg(GPT1_STAT) & 0x1) == 1) //camparement interrupt
write_reg(GPT1_STAT, 1); //clear the comp int
#else
if(*(RP)(GPT1_MSR) & 0x01)
clear_int = *(RP)(GPT1_SCR);
#endif
}
/*
* System Timer Interrupt & Audio Interrupt:
void ENT_INT_GPT( void )
{
ent_int();
mask_irq(INT_GPT);
//ENABLE_INT;
timer_isr();
//DISABLE_INT;
unmask_irq(INT_GPT);
ret_int();
}
*/
/*#if 0
void int_key( void )
{
EXTEND_PSR_TO_32;
PUSH_ALL_COMM_REG;
ent_int();
key_isr();
ret_int();
}
#endif //gfd
void int_control_ini( void )
{
IVR = 0x40;
}
*/
void timer_ini( void )
{
*(RP)GPT1_LCR = 0xAAE60; //10ms under 70MHz
*(RP)GPT1_CR = 0x03; //normal work and interrupt enable
unmask_irq(INT_GPT);
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -