source: rtems/testsuites/sptests/sp01/task1.c @ d5ae827

4.104.115
Last change on this file since d5ae827 was c7b38baf, checked in by Joel Sherrill <joel.sherrill@…>, on 07/01/09 at 19:23:58

2009-07-01 Joel Sherrill <joel.sherrill@…>

  • sp01/sp01.doc, sp01/task1.c, sp16/sp16.doc, sp16/task5.c: Bypass RTEMS_MILLISECONDS_TO_TICKS and RTEMS_MICROSECONDS_TO_TICKS to improve coverage.
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*  Task_1_through_3
2 *
3 *  This routine serves as a test task.  It verifies the basic task
4 *  switching capabilities of the executive.
5 *
6 *  Input parameters:
7 *    argument - task argument
8 *
9 *  Output parameters:  NONE
10 *
11 *  COPYRIGHT (c) 1989-1999.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 *
18 *  $Id$
19 */
20
21#include "system.h"
22
23rtems_task Task_1_through_3(
24  rtems_task_argument argument
25)
26{
27  rtems_id          tid;
28  rtems_time_of_day time;
29  rtems_status_code status;
30  rtems_interval    ticks;
31
32  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
33  directive_failed( status, "rtems_task_ident" );
34
35  /*
36   * Use TOD_MILLISECONDS_TO_TICKS not RTEMS_MILLISECONDS_TO_TICKS to
37   * test C implementation in SuperCore -- not macro version used
38   * everywhere else.
39   */
40  ticks = TOD_MILLISECONDS_TO_TICKS( task_number( tid ) * 5 * 1000 );
41
42  while( FOREVER ) {
43    status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
44    directive_failed( status, "rtems_clock_get" );
45
46    if ( time.second >= 35 ) {
47      puts( "*** END OF TEST 1 ***" );
48      rtems_test_exit( 0 );
49    }
50
51    put_name( Task_name[ task_number( tid ) ], FALSE );
52    print_time( " - rtems_clock_get - ", &time, "\n" );
53
54    status = rtems_task_wake_after( ticks );
55    directive_failed( status, "rtems_task_wake_after" );
56  }
57}
Note: See TracBrowser for help on using the repository browser.