source: rtems/testsuites/sptests/sp12/pridrv.c @ f68401e

4.115
Last change on this file since f68401e was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include "system.h"
15
16void Priority_test_driver(
17  rtems_task_priority priority_base
18)
19{
20  rtems_task_priority previous_priority;
21  uint32_t            index;
22  rtems_status_code   status;
23
24  for ( index = 1 ; index <= 5 ; index++ ) {
25    switch ( index ) {
26       case 1:
27       case 2:
28       case 3:
29         Task_priority[ index ] = priority_base + index;
30         break;
31       default:
32         Task_priority[ index ] = priority_base + 3;
33         break;
34    }
35
36    status = rtems_task_create(
37      Priority_task_name[ index ],
38      Task_priority[ index ],
39      RTEMS_MINIMUM_STACK_SIZE * 2,
40      RTEMS_DEFAULT_MODES,
41      RTEMS_DEFAULT_ATTRIBUTES,
42      &Priority_task_id[ index ]
43    );
44    directive_failed( status, "rtems_task_create loop" );
45
46  }
47
48  if ( priority_base == 0 ) {
49    for ( index = 1 ; index <= 5 ; index++ ) {
50      status = rtems_task_start(
51        Priority_task_id[ index ],
52        Priority_task,
53        index
54      );
55      directive_failed( status, "rtems_task_start loop" );
56    }
57  } else {
58    for ( index = 5 ; index >= 1 ; index-- ) {
59      status = rtems_task_start(
60        Priority_task_id[ index ],
61        Priority_task,
62        index
63      );
64      directive_failed( status, "rtems_task_start loop" );
65
66      status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
67      directive_failed( status, "rtems_task_wake_after loop" );
68
69      if ( priority_base == PRIORITY_INHERIT_BASE_PRIORITY ) {
70        if ( index == 4 ) {
71          status = rtems_task_set_priority(
72            Priority_task_id[ 5 ],
73            priority_base + 4,
74            &previous_priority
75          );
76          printf(
77            "PDRV - change priority of PRI5 from %" PRIdrtems_task_priority
78              " to %" PRIdrtems_task_priority "\n",
79             previous_priority,
80             priority_base + 4
81          );
82          directive_failed( status, "PDRV rtems_task_set_priority" );
83        }
84        status = rtems_task_set_priority(
85          Priority_task_id[ 5 ],
86          RTEMS_CURRENT_PRIORITY,
87          &previous_priority
88        );
89        directive_failed( status, "PDRV rtems_task_set_priority CURRENT" );
90        printf(
91          "PDRV - priority of PRI5 is %" PRIdrtems_task_priority "\n",
92           previous_priority
93        );
94      }
95    }
96  }
97
98  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
99  directive_failed( status, "rtems_task_wake_after after loop" );
100
101  if ( priority_base == 0 ) {
102    for ( index = 1 ; index <= 5 ; index++ ) {
103      status = rtems_semaphore_release( Semaphore_id[ 2 ] );
104      directive_failed( status, "rtems_semaphore_release loop" );
105    }
106  }
107
108  if ( priority_base == PRIORITY_INHERIT_BASE_PRIORITY ) {
109    puts( "PDRV - rtems_task_resume - PRI5" );
110    status = rtems_task_resume( Priority_task_id[ 5 ] );
111    directive_failed( status, "rtems_task_resume" );
112
113    status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
114    directive_failed( status, "rtems_task_wake_after so PRI5 can run" );
115
116    status = rtems_task_delete( Priority_task_id[ 5 ] );
117    directive_failed( status, "rtems_task_delete of PRI5" );
118  } else {
119    for ( index = 1 ; index <= 5 ; index++ ) {
120      status = rtems_task_delete( Priority_task_id[ index ] );
121      directive_failed( status, "rtems_task_delete loop" );
122    }
123  }
124}
Note: See TracBrowser for help on using the repository browser.