source: rtems/testsuites/sptests/sp07/task2.c @ 979bda9

4.115
Last change on this file since 979bda9 was 979bda9, checked in by Joel Sherrill <joel.sherrill@…>, on 03/14/15 at 15:48:00

tm07: Split some code into new spnotepad02.

Use of deprecated notepads in sp07 needs further work.

Updates #2305.

  • Property mode set to 100644
File size: 2.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.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include "system.h"
15
16/*
17 * We know this is deprecated and don't want a warning on every BSP built.
18 */
19#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
20
21rtems_task Task_2(
22  rtems_task_argument argument
23)
24{
25  rtems_status_code   status;
26  rtems_task_priority the_priority;
27  rtems_task_priority previous_priority;
28
29  while( FOREVER ) {
30
31    status = rtems_task_get_note( RTEMS_SELF, RTEMS_NOTEPAD_8, &the_priority );
32    directive_failed( status, "rtems_task_get_note" );
33    printf(
34      "TA2 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - "
35          "current priority: %02" PRIdrtems_task_priority "\n",
36      the_priority
37    );
38
39    if ( --the_priority == 0 ) {
40      puts( "TA2 - rtems_task_suspend - suspend TA1" );
41      status = rtems_task_suspend( Task_id[ 1 ] );
42      directive_failed( status, "rtems_task_suspend" );
43
44      puts( "TA2 - rtems_task_set_priority - set priority of TA1 ( blocked )" );
45      status = rtems_task_set_priority( Task_id[ 1 ], 5, &previous_priority );
46      directive_failed( status, "rtems_task_set_priority" );
47
48      status = rtems_task_delete( Task_id[ 1 ] );          /* TA1 is blocked */
49      directive_failed( status, "rtems_task_delete of TA1" );
50      assert_extension_counts( &Task_deleted[ 0 ], 0x0 );
51
52      status = rtems_task_delete( Task_id[ 3 ] );          /* TA3 is ready   */
53      directive_failed( status, "rtems_task_delete of TA3" );
54      assert_extension_counts( &Task_deleted[ 0 ], 0x0 );
55
56      status = rtems_task_delete( RTEMS_SELF );
57      directive_failed( status, "rtems_task_delete of SELD" );
58
59    } else {
60
61      printf(
62        "TA2 - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8: "
63            "%02" PRIdrtems_task_priority "\n",
64        the_priority
65      );
66      status = rtems_task_set_note(Task_id[ 1 ], RTEMS_NOTEPAD_8, the_priority);
67      directive_failed( status, "rtems_task_set_note" );
68
69      printf(
70        "TA2 - rtems_task_set_priority - set TA1's priority: "
71            "%02" PRIdrtems_task_priority "\n",
72        the_priority
73      );
74      status = rtems_task_set_priority(
75                 Task_id[ 1 ],
76                 the_priority,
77                 &previous_priority
78      );
79      directive_failed( status, "rtems_task_set_priority" );
80    }
81  }
82}
Note: See TracBrowser for help on using the repository browser.