source: rtems/c/src/tests/itrontests/itrontask03/preempt.c @ 06380cfe

4.104.114.84.9
Last change on this file since 06380cfe was 06380cfe, checked in by Jennifer Averett <Jennifer.Averett@…>, on Nov 15, 1999 at 9:25:53 PM

+ Added check that a task could be sent to a dormant state

then sta_tsk used to restart the task to its initial state.

+ Added calls to ref_tsk to yellow paths for suspended and

ready but not running tasks.

+ Fixed output file to correctly state test name
+ Added priority of preempt to the header file. Allows ref_tsk verification.

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[e099180]1/*  Preempt_task
2 *
3 *  This routine serves as a test task.  It verifies the task manager.
4 *
5 *  Input parameters:
6 *    argument - task argument
7 *
8 *  Output parameters:  NONE
9 *
10 *  COPYRIGHT (c) 1989-1998.
11 *  On-Line Applications Research Corporation (OAR).
12 *  Copyright assigned to U.S. Government, 1994.
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.OARcorp.com/rtems/license.html.
17 *
18 *  $Id$
19 */
20
21#include <assert.h>
22#include "system.h"
23
[06380cfe]24int Preempt_task_Count;
25
[e099180]26void Preempt_task()
27{
[06380cfe]28  ER       status;
29  T_RTSK   pk_rtsk;
30
31  puts( "PREEMPT - ref_tsk validation"  );
32  status = ref_tsk( &pk_rtsk, PREEMPT_TASK_ID );
33  assert( status          == E_OK );
34  assert( pk_rtsk.tskpri  == PREEMPT_PRIORITY );
35  assert( pk_rtsk.itskpri == PREEMPT_PRIORITY );
36  assert( pk_rtsk.task    == Preempt_task );
37  assert( pk_rtsk.stksz   >= RTEMS_MINIMUM_STACK_SIZE );
38  assert( pk_rtsk.tskstat == (TTS_RUN | TTS_RDY) );
[e099180]39
[06380cfe]40  if ( Preempt_task_Count == 0 ) {
41    Preempt_task_Count ++;
42    puts( "PREEMPT - chg_pri increment priority "); 
43    status = chg_pri( PREEMPT_TASK_ID, (PREEMPT_PRIORITY+1) );
44    directive_failed( status, "chg_pri" );
45    puts( "PREEMPT - ext_tsk - going to DORMANT state" );
46    ext_tsk( );
47    assert( 0 );
48  } else {
49    Preempt_task_Count ++;
50    puts( "PREEMPT - exd_tsk - Exit and Delete task" );
51    exd_tsk(  );
52    assert( 0 );
53  }
[e099180]54}
[06380cfe]55
Note: See TracBrowser for help on using the repository browser.