ocs init
This commit is contained in:
72
plat/public/ut/timer/Makefile
Normal file
72
plat/public/ut/timer/Makefile
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
##----------------------------------------------------------##
|
||||
## ##
|
||||
## Universal Makefile for wxc2 module ##
|
||||
## --By Wei Liu 2007/04/11 ##
|
||||
## ##
|
||||
##----------------------------------------------------------##
|
||||
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Project correlation(Customer define)
|
||||
##
|
||||
##--------------------------------------
|
||||
|
||||
##Module Name
|
||||
MODULE = tmtest
|
||||
|
||||
#BUILD = lib/exef
|
||||
BUILD = exef
|
||||
|
||||
#CFG = debug / release
|
||||
CFG = debug
|
||||
|
||||
#Source file path
|
||||
SRC_PATH= ./
|
||||
|
||||
#include file path
|
||||
INC_PATH= ./
|
||||
|
||||
#extend wxc2plat module lib need
|
||||
WXC2_PLT_LIB= public
|
||||
|
||||
#extend wxc2plat module lib need
|
||||
WXC2_APP_LIB=
|
||||
|
||||
#extend wxc2plat path default to ./wxc2plat
|
||||
WXC2_PLT_PATH = ../../../../wxc2plat
|
||||
|
||||
#extend wxc2plat path default to ./wxc2app
|
||||
WXC2_APP_PATH =
|
||||
|
||||
#extend obj needed
|
||||
CFG_OBJ =
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Make configuration(Customer define)
|
||||
##
|
||||
##--------------------------------------
|
||||
|
||||
#gcc flag show on/off
|
||||
CCFLAG_SWITCH = on
|
||||
|
||||
#customer debug version flag add for compile
|
||||
DEBUG_CFLAGS_ADD = -D_MSCR83 -D_DEVELOPER
|
||||
|
||||
#customer release version flag add for compile
|
||||
RELEASE_CFLAGS_ADD = -D_MSCR83
|
||||
|
||||
#need cover fucntion of PTF for test = YES/NO
|
||||
COVER_NEED =
|
||||
|
||||
#cover fucntion output path of PTF for test
|
||||
COVER_REPORT_PATH = ./ut/ut_doc/output
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## include makefile.rules (Do not change)
|
||||
##
|
||||
##--------------------------------------
|
||||
include Makefile.rules
|
||||
5
plat/public/ut/timer/bin/.svn/all-wcprops
Normal file
5
plat/public/ut/timer/bin/.svn/all-wcprops
Normal file
@@ -0,0 +1,5 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 55
|
||||
/svn/wxc2/!svn/ver/1/trunk/R4S/plat/public/ut/timer/bin
|
||||
END
|
||||
28
plat/public/ut/timer/bin/.svn/entries
Normal file
28
plat/public/ut/timer/bin/.svn/entries
Normal file
@@ -0,0 +1,28 @@
|
||||
10
|
||||
|
||||
dir
|
||||
114
|
||||
http://172.25.201.20/svn/wxc2/trunk/R4S/plat/public/ut/timer/bin
|
||||
http://172.25.201.20/svn/wxc2
|
||||
|
||||
|
||||
|
||||
2011-09-23T09:01:37.023785Z
|
||||
1
|
||||
xueqiang.sheng
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
4a7aa47d-8bee-446f-9599-049dc37ff264
|
||||
|
||||
5
plat/public/ut/timer/ut/.svn/all-wcprops
Normal file
5
plat/public/ut/timer/ut/.svn/all-wcprops
Normal file
@@ -0,0 +1,5 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 54
|
||||
/svn/wxc2/!svn/ver/1/trunk/R4S/plat/public/ut/timer/ut
|
||||
END
|
||||
28
plat/public/ut/timer/ut/.svn/entries
Normal file
28
plat/public/ut/timer/ut/.svn/entries
Normal file
@@ -0,0 +1,28 @@
|
||||
10
|
||||
|
||||
dir
|
||||
114
|
||||
http://172.25.201.20/svn/wxc2/trunk/R4S/plat/public/ut/timer/ut
|
||||
http://172.25.201.20/svn/wxc2
|
||||
|
||||
|
||||
|
||||
2011-09-23T09:01:37.023785Z
|
||||
1
|
||||
xueqiang.sheng
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
4a7aa47d-8bee-446f-9599-049dc37ff264
|
||||
|
||||
155
plat/public/ut/timer/wxc_tmtest.c
Normal file
155
plat/public/ut/timer/wxc_tmtest.c
Normal file
@@ -0,0 +1,155 @@
|
||||
|
||||
#include "assert.h"
|
||||
#include "../../src/include/includes.h"
|
||||
#include "../../src/include/public.h"
|
||||
#include "../../src/include/wxc_timer.h"
|
||||
|
||||
|
||||
u32 hlr_timer_flag;
|
||||
u32 hlr_20ms_flag;
|
||||
|
||||
void system_init ( void )
|
||||
{
|
||||
sleep ( 3 );
|
||||
hlr_timer_flag = 0;
|
||||
hlr_20ms_flag = 0;
|
||||
}
|
||||
|
||||
void timer_callback ( )
|
||||
{
|
||||
hlr_20ms_flag++;
|
||||
hlr_timer_flag++;
|
||||
printf("10 ms call back : %d\n" , hlr_timer_flag);
|
||||
}
|
||||
|
||||
void set_timer ( )
|
||||
{
|
||||
struct sigaction act;
|
||||
struct itimerval value;
|
||||
struct itimerval old_value;
|
||||
|
||||
value.it_interval.tv_sec = 0;
|
||||
value.it_interval.tv_usec = 10000; // 10 ms
|
||||
value.it_value.tv_sec = 0;
|
||||
value.it_value.tv_usec = 10000; // 10 ms
|
||||
act.sa_handler = timer_callback;
|
||||
sigemptyset ( &act.sa_mask );
|
||||
act.sa_flags = 0;
|
||||
if( sigaction ( SIGALRM, &act, NULL ) == -1 )
|
||||
{
|
||||
printf ( "Timer error\n" );
|
||||
exit ( 0 );
|
||||
}
|
||||
setitimer ( ITIMER_REAL, &value, &old_value );
|
||||
iopl ( 3 );
|
||||
}
|
||||
|
||||
void tm_app_callback_10ms ( u16 dSuitId, u16 dData )
|
||||
{
|
||||
printf("10 ms call back\n");
|
||||
}
|
||||
|
||||
void tm_app_callback_1s ( u16 dSuitId, u16 dData )
|
||||
{
|
||||
printf("10 ms call back\n");
|
||||
}
|
||||
|
||||
void tm_app_callback_50s ( u16 dSuitId, u16 dData )
|
||||
{
|
||||
printf("10 ms call back\n");
|
||||
}
|
||||
|
||||
void tm_app_callback_5000s ( u16 dSuitId, u16 dData )
|
||||
{
|
||||
printf("10 ms call back\n");
|
||||
}
|
||||
|
||||
|
||||
void tm_app_init ( )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int app_state;
|
||||
WxcTimer tTimer10ms;
|
||||
WxcTimer tTimer1s;
|
||||
WxcTimer tTimer50s;
|
||||
WxcTimer tTimer5000s;
|
||||
|
||||
typedef enum TMTEST_STATE
|
||||
{
|
||||
APP_REGSITER,
|
||||
APP_START,
|
||||
APP_TIMEROUT,
|
||||
APP_STOP,
|
||||
}
|
||||
TM_STATE;
|
||||
|
||||
|
||||
void tm_app_test ( )
|
||||
{
|
||||
|
||||
|
||||
switch ( app_state )
|
||||
{
|
||||
case APP_REGSITER:
|
||||
tTimer10ms.dExpires = 1;
|
||||
tTimer10ms.dSuitNumber = 1;
|
||||
tTimer10ms.pFunc = &tm_app_callback_10ms;
|
||||
tTimer10ms.dData = 0;
|
||||
TimerAdd ( &tTimer10ms );
|
||||
|
||||
tTimer1s.dExpires = 100;
|
||||
tTimer1s.dSuitNumber = 10;
|
||||
tTimer1s.pFunc = &tm_app_callback_1s;
|
||||
tTimer1s.dData = 0;
|
||||
TimerAdd ( &tTimer1s );
|
||||
|
||||
tTimer50s.dExpires = 5000;
|
||||
tTimer50s.dSuitNumber = 100;
|
||||
tTimer50s.pFunc = &tm_app_callback_50s;
|
||||
tTimer50s.dData = 0;
|
||||
TimerAdd ( &tTimer50s );
|
||||
|
||||
tTimer5000s.dExpires = 5000000;
|
||||
tTimer5000s.dSuitNumber = 10;
|
||||
tTimer5000s.pFunc = &tm_app_callback_5000s;
|
||||
tTimer5000s.dData = 0;
|
||||
TimerAdd ( &tTimer5000s );
|
||||
app_state++;
|
||||
break;
|
||||
|
||||
case APP_START:
|
||||
app_state++;
|
||||
break;
|
||||
|
||||
case APP_TIMEROUT:
|
||||
|
||||
TimerAdd ( &tTimer50s );
|
||||
app_state++;
|
||||
break;
|
||||
case APP_STOP:
|
||||
|
||||
TimerAdd ( &tTimer50s );
|
||||
app_state++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main ( int argc, char *argv[] )
|
||||
{
|
||||
|
||||
system_init ( );
|
||||
|
||||
set_timer ( );
|
||||
|
||||
while ( 1 )
|
||||
{
|
||||
usleep ( 1 );
|
||||
tm_app_test ( );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user