source: rtems/testsuites/sptests/spcbssched01/task1.c @ d2e6a127

4.115
Last change on this file since d2e6a127 was bd1b8de, checked in by Joel Sherrill <joel.sherrill@…>, on 09/15/11 at 15:56:01

2011-09-15 Petr Benes <benesp16@…>

PR 1907/testing

  • Makefile.am, configure.ac: Add tests for the CBS (Constant Bandwidth Server) scheduler.
  • spcbssched01/.cvsignore, spcbssched01/Makefile.am, spcbssched01/init.c, spcbssched01/spcbssched01.doc, spcbssched01/spcbssched01.scn, spcbssched01/system.h, spcbssched01/task1.c, spcbssched02/.cvsignore, spcbssched02/Makefile.am, spcbssched02/init.c, spcbssched02/spcbssched02.doc, spcbssched02/spcbssched02.scn, spcbssched02/system.h, spcbssched02/task_periodic.c, spcbssched03/.cvsignore, spcbssched03/Makefile.am, spcbssched03/cbsparams.h, spcbssched03/init.c, spcbssched03/spcbssched03.doc, spcbssched03/spcbssched03.scn, spcbssched03/system.h, spcbssched03/tasks_aperiodic.c, spcbssched03/tasks_periodic.c: New files.
  • 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_tod( &time );
44    directive_failed( status, "rtems_clock_get_tod" );
45
46    if ( time.second >= 35 ) {
47      puts( "*** END OF CBS SCHEDULER TEST 1 ***" );
48      rtems_test_exit( 0 );
49    }
50
51    put_name( Task_name[ task_number( tid ) ], FALSE );
52    print_time( " - rtems_clock_get_tod - ", &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.