我现在使用DM642开发板做实验 在bios中单独的网络通信程序,以及单独的定时器程序都运行正常,但是如果把这两个程序合在一块,定时器运行一瞬间就不运行了,不知怎么回事?
下面的程序是我用LOG_printf在bios中用message log输出定时器的计数情况,在message log中只能输出几行,后面的就输不出来了,这是怎么回事? 这是我的定时程序: #include <std.h> #include <log.h> #include <tsk.h> #include <sem.h> #include <gio.h> #include <csl.h> #include <csl_emifa.h> #include <csl_timer.h> #include <csl_irq.h>
#include "appData.h" #include "scom.h" #include "seeddm642.h" #include "Tcpip_loopbackcfg.h" static TIMER_Handle hTimer1;
static Uint32 TimerEventId;
static int cnt = 0; static Uint32 TimerControl =
TIMER_CTL_RMK
(
TIMER_CTL_SPND_EMUSTOP,
TIMER_CTL_INVINP_NO, // TINP inverter control(INVINP)
TIMER_CTL_CLKSRC_CPUOVR8, // Timer input clock source (CLKSRC)
TIMER_CTL_CP_PULSE, // Clock/pulse mode(CP)
TIMER_CTL_HLD_YES, // Hold(HLD)
TIMER_CTL_GO_NO, // Go bit(GO)-
// resets & starts timer counter
TIMER_CTL_PWID_ONE, // Pulse width(PWID)-
// used only in pulse mode
TIMER_CTL_DATOUT_0, // Data output (DATOUT)
TIMER_CTL_INVOUT_NO, // TOUT inverter control (INVOUT)
TIMER_CTL_FUNC_GPIO // Function of TOUT pin(FUNC)
); main() { TIMER_Config myTimConfig; CSL_init(); /*.................网络通信部分.......................*/ CACHE_enableCaching(CACHE_EMIFA_CE00); CACHE_enableCaching(CACHE_EMIFA_CE01); DAT_open(DAT_CHAANY, DAT_PRI_LOW, DAT_OPEN_2D); SCOM_init(); CACHE_setL2Queue(0x3, 0x7); CACHE_setL2Queue(0x1, 0x7); CACHE_setPriL2Req(CACHE_L2PRIHIGH); // create all SCOM and message objects SCOM_create("NETOK", NULL); /*..............................定时器部分............*/
hTimer1 = TIMER_open(TIMER_DEV1, 0); TimerEventId = TIMER_getEventId(hTimer1); IRQ_globalDisable(); IRQ_nmiDisable(); IRQ_globalEnable(); IRQ_nmiEnable(); IRQ_map(TimerEventId, 15); IRQ_reset(TimerEventId); myTimConfig.cnt = 0x0; myTimConfig.ctl = TimerControl; myTimConfig.prd = 0x00124f8;//1ms定时,即每1ms,cnt计数增1 TIMER_config(hTimer1, &myTimConfig); IRQ_enable(TimerEventId); TIMER_start(hTimer1); } void CLK_cnt() { cnt++; LOG_printf(&trace,"cnt VAL is %d
", cnt); }
在message log里输出的结果: 0 cnt VAL is 1
1 cnt VAL is 2
2 cnt VAL is 3 为什么只有这三行呢?下面的就输不出来了,这是怎么回事?
|