source:
rtems/c/src/tests/itrontests/itrontask03/preempt.c
@
69abfe98
Last change on this file since 69abfe98 was 69abfe98, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:46:11 | |
---|---|
|
|
File size: 1.4 KB |
Line | |
---|---|
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-1999. |
11 | * On-Line Applications Research Corporation (OAR). |
12 | * |
13 | * The license and distribution terms for this file may be |
14 | * found in the file LICENSE in this distribution or at |
15 | * http://www.rtems.com/license/LICENSE. |
16 | * |
17 | * $Id$ |
18 | */ |
19 | |
20 | #include <assert.h> |
21 | #include "system.h" |
22 | |
23 | int Preempt_task_Count; |
24 | |
25 | void Preempt_task() |
26 | { |
27 | ER status; |
28 | T_RTSK pk_rtsk; |
29 | |
30 | puts( "PREEMPT - ref_tsk validation" ); |
31 | status = ref_tsk( &pk_rtsk, PREEMPT_TASK_ID ); |
32 | fatal_directive_status( status, E_OK , "ref_tsk of PREEMPT"); |
33 | assert( pk_rtsk.tskpri == PREEMPT_PRIORITY ); |
34 | assert( pk_rtsk.itskpri == PREEMPT_PRIORITY ); |
35 | assert( pk_rtsk.task == Preempt_task ); |
36 | assert( pk_rtsk.stksz >= RTEMS_MINIMUM_STACK_SIZE ); |
37 | assert( pk_rtsk.tskstat == (TTS_RUN | TTS_RDY) ); |
38 | |
39 | if ( Preempt_task_Count == 0 ) { |
40 | Preempt_task_Count ++; |
41 | puts( "PREEMPT - chg_pri increment priority "); |
42 | status = chg_pri( PREEMPT_TASK_ID, (PREEMPT_PRIORITY+1) ); |
43 | directive_failed( status, "chg_pri" ); |
44 | puts( "PREEMPT - ext_tsk - going to DORMANT state" ); |
45 | ext_tsk( ); |
46 | assert( 0 ); |
47 | } else { |
48 | Preempt_task_Count ++; |
49 | puts( "PREEMPT - exd_tsk - Exit and Delete task" ); |
50 | exd_tsk( ); |
51 | assert( 0 ); |
52 | } |
53 | } |
54 |
Note: See TracBrowser
for help on using the repository browser.