文件头: #include "c5410_clkcfg.h"
#include <clk.h> LgUns ticks,ticks_now=0,ticks_old=0; void my_clk() { ticks_old=ticks_now; /* 保存上一次的ticks记数 */ ticks_now=CLK_gethtime(); ticks=ticks_now-ticks_old; LOG_printf(&LOG_msg1,"The current tick count -> 0x%x\n", (unsigned int)(ticks & 0xffff)); //STS_delta(&STS0,CLK_gethtime()); //ticks=CLK_gethtime(); // STS_set(&STS0,CLK_gethtime()); ticks=CLK_countspms(); LOG_printf(&LOG_msg1,"The current tick count -> 0x%x:0x%x\n", (unsigned int)((ticks & 0xffff0000l) >> 16),(unsigned int)(ticks & 0xffff)); /* ticks=CLK_gethtime(); LOG_printf(&LOG_msg,"The current tick count -> %d\n", (unsigned int)(ticks & 0xffff)); */ } main() { STS_set(&STS0,CLK_gethtime()); } |