📄 gpt.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 );
/* 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;
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 )
{
#ifdef GIII
*(RP)GPT1_CNTL = 0X007; //0-select gpt
//;0-disable software reset
//;0-restar mode
//;11-cancel catch the rising edge and falling edge and send a int signal function
//;0-comparament irq disable
//;01-sysclk/16 to prescaler
//;1-gpt disable
*(RP)GPT1_SCAL = 0X07; //set prescaler regment
*(RP)GPT1_COMP = 0X186a0; ////set count value,10ms ,70MHZ
*(RP)GPT1_CNTL = 0X17; //interrupt enable
#else
*(RP)GPT1_LCR = 0xAAE60*5/7; //10ms under 70MHz
*(RP)GPT1_CR = 0x03; //normal work and interrupt enable
#endif
unmask_irq(INT_GPT);
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -