#include <stdio.h>
#include <csl.h>
#include <csl_chip.h>
#include <csl_irq.h>
#include <csl_gpt.h>
#include <csl_uart.h>
#include \"Uart_Function.h\"
/* Reference start of interrupt vector table */
/* This symbol is defined in file, vectors.s55 */
extern void VECSTART(void);
/* Function/ISR prototypes */
interrupt void Timer0Isr(void);
/* Create a TIMER_Handle object for use with TIMER_open */
GPT_Handle hGpt;
Uint16 Counter;
Uint16 EventId0; // 定时器0所对应的事件ID号
/****************************************************************/
/* Define and initialize the GPT module configuration structure */
/* Input fast peripheral clock is 100MHz */
/* Generate character interval interrupt Note:1etu=1/9600秒 */
/*--------------------------------------------------------------*/
/* 10etu 0x19708 1.042ms */
/* 12etu 0x1E870 1.250ms */
/* 14etu 0x239D8 1.459ms */
/* 20etu 0x32E10 2.084ms */
/* 40etu 0x65C20 4.168ms */
/****************************************************************/
GPT_Config MyGptConfig = {
0, //Emulation management register
0, //GPIO interrupt control register
0, //GPIO enable register
0, //GPIO direction register
0, //GPIO data register
//0x39D8, //Timer period register 1(主频为200MHz)
//0x0002, //Timer period register 2
0x56C4, //Timer period register 1(主频为300MHz)
0x0003, //Timer period register 2
0, //Timer period register 3
0,
GPT_GPTCTL1_RMK( //Timer control register 1
GPT_GPTCTL1_TIEN_NOT_GATED,
GPT_GPTCTL1_CLKSRC_VBUS,
GPT_GPTCTL1_ENAMODE_CONTINUOUS,
GPT_GPTCTL1_PWID_INACTIVE_1CYCLE,
GPT_GPTCTL1_CP_CLOCK_MODE,
GPT_GPTCTL1_INVIN_DONT_INVERT_OUTPUT,
GPT_GPTCTL1_INVOUT_DONT_INVERT_OUTPUT
,
GPT_GPTCTL2_RMK( //Timer control register 2
GPT_GPTCTL2_TIEN_NOT_GATED,
GPT_GPTCTL2_CLKSRC_VBUS,
GPT_GPTCTL2_ENAMODE_CONTINUOUS,
GPT_GPTCTL2_PWID_INACTIVE_1CYCLE,
GPT_GPTCTL2_CP_CLOCK_MODE,
GPT_GPTCTL2_INVIN_DONT_INVERT_OUTPUT,
GPT_GPTCTL2_INVOUT_DONT_INVERT_OUTPUT
,
GPT_GPTGCTL1_RMK( //Global timer control register
GPT_GPTGCTL1_PSC34_DEFAULT,
GPT_GPTGCTL1_TIMMODE_DEFAULT,
GPT_GPTGCTL1_TIM34RS_IN_RESET,
GPT_GPTGCTL1_TIM12RS_IN_RESET
}; |