mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-29 07:50:18 +00:00
* sp02/task1.c, sp02/task2.c, sp02/task3.c, sp03/task2.c, sp05/task1.c, sp05/task2.c, sp05/task3.c, sp06/task1.c, sp06/task2.c, sp09/screen02.c, sp09/screen04.c, sp09/screen06.c, sp09/screen07.c, sp09/screen10.c, sp09/screen12.c, sp09/screen13.c, sp09/screen14.c, sp11/task1.c, sp11/task2.c, sp12/pridrv.c, sp12/pritask.c, sp12/task1.c, sp13/task1.c, sp13/task2.c, sp14/task1.c, sp16/task1.c, sp16/task4.c, sp19/fptask.c, sp19/task1.c, sp22/task1.c, sp24/task1.c, sp26/task1.c, sp29/init.c, sp30/task1.c, sp31/task1.c, sp33/init.c, sp45/init.c, sp46/init.c, sp50/init.c, spintrcritical06/init.c, spwatchdog/task1.c: Eliminate test routines TICKS_PER_SECOND and get_ticks_per_second() in favor of new rtems_clock_get_ticks_per_second().
242 lines
6.4 KiB
C
242 lines
6.4 KiB
C
/* Screen2
|
|
*
|
|
* This routine generates error screen 2 for test 9.
|
|
*
|
|
* Input parameters: NONE
|
|
*
|
|
* Output parameters: NONE
|
|
*
|
|
* COPYRIGHT (c) 1989-2009.
|
|
* On-Line Applications Research Corporation (OAR).
|
|
*
|
|
* The license and distribution terms for this file may be
|
|
* found in the file LICENSE in this distribution or at
|
|
* http://www.rtems.com/license/LICENSE.
|
|
*
|
|
* $Id$
|
|
*/
|
|
|
|
#include "system.h"
|
|
|
|
void Screen2()
|
|
{
|
|
rtems_time_of_day time;
|
|
rtems_interval interval;
|
|
struct timeval tv;
|
|
rtems_status_code status;
|
|
|
|
/* errors before clock is set */
|
|
|
|
status = rtems_clock_get_tod( &time );
|
|
if ( status == RTEMS_SUCCESSFUL ) {
|
|
puts(
|
|
"TA1 - rtems_clock_get_tod - RTEMS_NOT_DEFINED -- "
|
|
"DID BSP SET THE TIME OF DAY?"
|
|
);
|
|
} else {
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_NOT_DEFINED,
|
|
"rtems_clock_get_tod before clock is set #1"
|
|
);
|
|
puts( "TA1 - rtems_clock_get_tod - RTEMS_NOT_DEFINED" );
|
|
}
|
|
|
|
status = rtems_clock_get_seconds_since_epoch( &interval );
|
|
if ( status == RTEMS_SUCCESSFUL ) {
|
|
puts(
|
|
"TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_NOT_DEFINED -- "
|
|
"DID BSP SET THE TIME OF DAY?"
|
|
);
|
|
} else {
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_NOT_DEFINED,
|
|
"rtems_clock_get_seconds_before_epoch"
|
|
);
|
|
puts( "TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_NOT_DEFINED" );
|
|
}
|
|
|
|
status = rtems_clock_get_tod_timeval( &tv );
|
|
if ( status == RTEMS_SUCCESSFUL ) {
|
|
puts(
|
|
"TA1 - rtems_clock_get_tod_timeval - RTEMS_NOT_DEFINED -- "
|
|
"DID BSP SET THE TIME OF DAY?"
|
|
);
|
|
} else {
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_NOT_DEFINED,
|
|
"rtems_clock_get_timeval"
|
|
);
|
|
puts( "TA1 - rtems_clock_get_tod_timeval - RTEMS_NOT_DEFINED" );
|
|
}
|
|
|
|
/* arbitrary bad value for switch */
|
|
status = rtems_clock_get( 0x100, &tv );
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_INVALID_NUMBER,
|
|
"rtems_clock_get bad case"
|
|
);
|
|
puts( "TA1 - rtems_clock_get - RTEMS_INVALID_NUMBER" );
|
|
|
|
status = rtems_task_wake_when( &time );
|
|
if ( status == RTEMS_SUCCESSFUL ) {
|
|
puts(
|
|
"TA1 - rtems_clock_get - RTEMS_NOT_DEFINED -- "
|
|
"DID BSP SET THE TIME OF DAY?"
|
|
);
|
|
} else {
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_NOT_DEFINED,
|
|
"rtems_task_wake_when before clock is set"
|
|
);
|
|
puts( "TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED" );
|
|
}
|
|
|
|
status = rtems_timer_fire_when( 0, &time, Delayed_routine, NULL );
|
|
if ( status == RTEMS_SUCCESSFUL ) {
|
|
puts(
|
|
"TA1 - timer_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?"
|
|
);
|
|
} else {
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_NOT_DEFINED,
|
|
"task_fire_when before clock is set"
|
|
);
|
|
puts( "TA1 - rtems_timer_fire_when - RTEMS_NOT_DEFINED" );
|
|
}
|
|
|
|
build_time( &time, 2, 5, 1987, 8, 30, 45, 0 );
|
|
print_time( "TA1 - rtems_clock_set - ", &time, "" );
|
|
status = rtems_clock_set( &time );
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_INVALID_CLOCK,
|
|
"rtems_clock_set with invalid year"
|
|
);
|
|
puts( " - RTEMS_INVALID_CLOCK" );
|
|
|
|
build_time( &time, 15, 5, 1988, 8, 30, 45, 0 );
|
|
print_time( "TA1 - rtems_clock_set - ", &time, "" );
|
|
status = rtems_clock_set( &time );
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_INVALID_CLOCK,
|
|
"rtems_clock_set with invalid month"
|
|
);
|
|
puts( " - RTEMS_INVALID_CLOCK" );
|
|
|
|
build_time( &time, 2, 32, 1988, 8, 30, 45, 0 );
|
|
print_time( "TA1 - rtems_clock_set - ", &time, "" );
|
|
status = rtems_clock_set( &time );
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_INVALID_CLOCK,
|
|
"rtems_clock_set with invalid day"
|
|
);
|
|
puts( " - RTEMS_INVALID_CLOCK" );
|
|
|
|
build_time( &time, 2, 5, 1988, 25, 30, 45, 0 );
|
|
print_time( "TA1 - rtems_clock_set - ", &time, "" );
|
|
status = rtems_clock_set( &time );
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_INVALID_CLOCK,
|
|
"rtems_clock_set with invalid hour"
|
|
);
|
|
puts( " - RTEMS_INVALID_CLOCK" );
|
|
|
|
build_time( &time, 2, 5, 1988, 8, 61, 45, 0 );
|
|
print_time( "TA1 - rtems_clock_set - ", &time, "" );
|
|
status = rtems_clock_set( &time );
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_INVALID_CLOCK,
|
|
"rtems_clock_set with invalid minute"
|
|
);
|
|
puts( " - RTEMS_INVALID_CLOCK" );
|
|
|
|
build_time( &time, 2, 5, 1988, 8, 30, 61, 0 );
|
|
print_time( "TA1 - rtems_clock_set - ", &time, "" );
|
|
status = rtems_clock_set( &time );
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_INVALID_CLOCK,
|
|
"rtems_clock_set with invalid second"
|
|
);
|
|
puts( " - RTEMS_INVALID_CLOCK" );
|
|
|
|
build_time(
|
|
&time, 2, 5, 1988, 8, 30, 45,
|
|
rtems_clock_get_ticks_per_second() + 1
|
|
);
|
|
print_time( "TA1 - rtems_clock_set - ", &time, "" );
|
|
status = rtems_clock_set( &time );
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_INVALID_CLOCK,
|
|
"rtems_clock_set with invalid ticks per second"
|
|
);
|
|
puts( " - RTEMS_INVALID_CLOCK" );
|
|
|
|
build_time( &time, 2, 5, 1988, 8, 30, 45, 0 );
|
|
print_time( "TA1 - rtems_clock_set - ", &time, "" );
|
|
status = rtems_clock_set( &time );
|
|
directive_failed( status, "rtems_clock_set successful" );
|
|
puts( " - RTEMS_SUCCESSFUL" );
|
|
|
|
/* rtems_task_wake_when */
|
|
|
|
build_time(
|
|
&time,
|
|
2, 5, 1988, 8, 30, 48,
|
|
rtems_clock_get_ticks_per_second() + 1
|
|
);
|
|
time.second += 3;
|
|
puts( "TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds" );
|
|
|
|
status = rtems_task_wake_when( &time );
|
|
directive_failed(
|
|
status,
|
|
"rtems_task_wake_when with invalid ticks per second"
|
|
);
|
|
puts( "TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL" );
|
|
|
|
build_time( &time, 2, 5, 1961, 8, 30, 48, 0 );
|
|
print_time( "TA1 - rtems_task_wake_when - ", &time, "" );
|
|
status = rtems_task_wake_when( &time );
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_INVALID_CLOCK,
|
|
"rtems_task_wake_when with invalid year"
|
|
);
|
|
puts( " - RTEMS_INVALID_CLOCK" );
|
|
|
|
build_time( &time, 2, 5, 1988, 25, 30, 48, 0 );
|
|
print_time( "TA1 - rtems_task_wake_when - ", &time, "" );
|
|
status = rtems_task_wake_when( &time );
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_INVALID_CLOCK,
|
|
"rtems_task_wake_when with invalid hour"
|
|
);
|
|
puts( " - RTEMS_INVALID_CLOCK" );
|
|
|
|
rtems_clock_get_tod( &time );
|
|
print_time( "TA1 - current time - ", &time, "\n" );
|
|
|
|
time.month = 1;
|
|
print_time( "TA1 - rtems_task_wake_when - ", &time, "" );
|
|
status = rtems_task_wake_when( &time );
|
|
fatal_directive_status(
|
|
status,
|
|
RTEMS_INVALID_CLOCK,
|
|
"rtems_task_wake_when before current time"
|
|
);
|
|
puts( " - RTEMS_INVALID_CLOCK" );
|
|
}
|