/* Init
|
/* Init
|
*
|
*
|
* This routine is the initialization task for this test program.
|
* This routine is the initialization task for this test program.
|
* It is called from init_exec and has the responsibility for creating
|
* It is called from init_exec and has the responsibility for creating
|
* and starting the tasks that make up the test. If the time of day
|
* and starting the tasks that make up the test. If the time of day
|
* clock is required for the test, it should also be set to a known
|
* clock is required for the test, it should also be set to a known
|
* value by this function.
|
* value by this function.
|
*
|
*
|
* Input parameters: NONE
|
* Input parameters: NONE
|
*
|
*
|
* Output parameters: NONE
|
* Output parameters: NONE
|
*
|
*
|
* COPYRIGHT (c) 1989-1999.
|
* COPYRIGHT (c) 1989-1999.
|
* On-Line Applications Research Corporation (OAR).
|
* On-Line Applications Research Corporation (OAR).
|
*
|
*
|
* The license and distribution terms for this file may be
|
* The license and distribution terms for this file may be
|
* found in the file LICENSE in this distribution or at
|
* found in the file LICENSE in this distribution or at
|
* http://www.OARcorp.com/rtems/license.html.
|
* http://www.OARcorp.com/rtems/license.html.
|
*
|
*
|
* $Id: init.c,v 1.2 2001-09-27 12:02:39 chris Exp $
|
* $Id: init.c,v 1.2 2001-09-27 12:02:39 chris Exp $
|
*/
|
*/
|
|
|
#define TEST_INIT
|
#define TEST_INIT
|
#include "system.h"
|
#include "system.h"
|
#include <timesys.h>
|
#include <timesys.h>
|
#include <stdio.h>
|
#include <stdio.h>
|
|
|
void ITRON_Init( void )
|
void ITRON_Init( void )
|
{
|
{
|
T_CSEM pk_csem;
|
T_CSEM pk_csem;
|
T_RSEM pk_rsem;
|
T_RSEM pk_rsem;
|
int index;
|
int index;
|
|
|
pk_csem.isemcnt = 2;
|
pk_csem.isemcnt = 2;
|
pk_csem.maxsem = 3;
|
pk_csem.maxsem = 3;
|
pk_csem.sematr = TA_TFIFO;
|
pk_csem.sematr = TA_TFIFO;
|
|
|
printf( "\n\n*** TMITRON01 -- ITRON TIMING TEST ***\n" );
|
printf( "\n\n*** TMITRON01 -- ITRON TIMING TEST ***\n" );
|
|
|
/*
|
/*
|
* time one invocation of cre_sem
|
* time one invocation of cre_sem
|
*/
|
*/
|
|
|
Timer_initialize();
|
Timer_initialize();
|
(void) cre_sem( 1, &pk_csem );
|
(void) cre_sem( 1, &pk_csem );
|
end_time = Read_timer();
|
end_time = Read_timer();
|
put_time(
|
put_time(
|
"cre_sem",
|
"cre_sem",
|
end_time,
|
end_time,
|
1,
|
1,
|
0, /* no loop overhead to take out */
|
0, /* no loop overhead to take out */
|
0 /* no calling overhead */
|
0 /* no calling overhead */
|
);
|
);
|
|
|
/*
|
/*
|
* time one invocation of del_sem
|
* time one invocation of del_sem
|
*/
|
*/
|
|
|
Timer_initialize();
|
Timer_initialize();
|
(void) del_sem( 1 );
|
(void) del_sem( 1 );
|
end_time = Read_timer();
|
end_time = Read_timer();
|
put_time(
|
put_time(
|
"del_sem",
|
"del_sem",
|
end_time,
|
end_time,
|
1,
|
1,
|
0, /* no loop overhead to take out */
|
0, /* no loop overhead to take out */
|
0 /* no calling overhead */
|
0 /* no calling overhead */
|
);
|
);
|
|
|
pk_csem.isemcnt = 100;
|
pk_csem.isemcnt = 100;
|
pk_csem.maxsem = 100;
|
pk_csem.maxsem = 100;
|
pk_csem.sematr = TA_TFIFO;
|
pk_csem.sematr = TA_TFIFO;
|
(void) cre_sem( 1, &pk_csem );
|
(void) cre_sem( 1, &pk_csem );
|
|
|
/*
|
/*
|
* time preq_sem (available)
|
* time preq_sem (available)
|
*/
|
*/
|
|
|
Timer_initialize();
|
Timer_initialize();
|
for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
|
for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
|
(void) preq_sem( 1 );
|
(void) preq_sem( 1 );
|
end_time = Read_timer();
|
end_time = Read_timer();
|
put_time(
|
put_time(
|
"preq_sem (available)",
|
"preq_sem (available)",
|
end_time,
|
end_time,
|
OPERATION_COUNT,
|
OPERATION_COUNT,
|
0, /* don't take the loop overhead out */
|
0, /* don't take the loop overhead out */
|
0 /* no calling overhead */
|
0 /* no calling overhead */
|
);
|
);
|
|
|
/*
|
/*
|
* time preq_sem (not available)
|
* time preq_sem (not available)
|
*/
|
*/
|
|
|
Timer_initialize();
|
Timer_initialize();
|
for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
|
for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
|
(void) preq_sem( 1 );
|
(void) preq_sem( 1 );
|
end_time = Read_timer();
|
end_time = Read_timer();
|
put_time(
|
put_time(
|
"preq_sem (not available)",
|
"preq_sem (not available)",
|
end_time,
|
end_time,
|
OPERATION_COUNT,
|
OPERATION_COUNT,
|
0, /* don't take the loop overhead out */
|
0, /* don't take the loop overhead out */
|
0 /* no calling overhead */
|
0 /* no calling overhead */
|
);
|
);
|
|
|
/*
|
/*
|
* time sig_sem (no waiting tasks)
|
* time sig_sem (no waiting tasks)
|
*/
|
*/
|
|
|
Timer_initialize();
|
Timer_initialize();
|
for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
|
for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
|
(void) sig_sem( 1 );
|
(void) sig_sem( 1 );
|
end_time = Read_timer();
|
end_time = Read_timer();
|
put_time(
|
put_time(
|
"sig_sem (no waiting tasks)",
|
"sig_sem (no waiting tasks)",
|
end_time,
|
end_time,
|
OPERATION_COUNT,
|
OPERATION_COUNT,
|
0, /* don't take the loop overhead out */
|
0, /* don't take the loop overhead out */
|
0 /* no calling overhead */
|
0 /* no calling overhead */
|
);
|
);
|
|
|
/*
|
/*
|
* time ref_sem
|
* time ref_sem
|
*/
|
*/
|
|
|
Timer_initialize();
|
Timer_initialize();
|
for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
|
for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
|
(void) ref_sem( 1, &pk_rsem );
|
(void) ref_sem( 1, &pk_rsem );
|
end_time = Read_timer();
|
end_time = Read_timer();
|
put_time(
|
put_time(
|
"ref_sem",
|
"ref_sem",
|
end_time,
|
end_time,
|
OPERATION_COUNT,
|
OPERATION_COUNT,
|
0, /* don't take the loop overhead out */
|
0, /* don't take the loop overhead out */
|
0 /* no calling overhead */
|
0 /* no calling overhead */
|
);
|
);
|
|
|
printf( "\n\nXXX ADD BLOCKING AND PREEMPTING TIME TESTS\n\n" );
|
printf( "\n\nXXX ADD BLOCKING AND PREEMPTING TIME TESTS\n\n" );
|
|
|
|
|
printf( "*** END OF TMITRON01 -- ITRON TIMING TEST ***\n" );
|
printf( "*** END OF TMITRON01 -- ITRON TIMING TEST ***\n" );
|
exit( 0 );
|
exit( 0 );
|
}
|
}
|
|
|