source: rtems/testsuites/sptests/sp16/task5.c @ 99de42c

5
Last change on this file since 99de42c was 51b3cbca, checked in by Sebastian Huber <sebastian.huber@…>, on 10/04/18 at 13:23:25

tests: Use rtems_task_exit()

Update #3533.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*  Task5
2 *
3 *  This routine serves as a test task.  It competes with the other tasks
4 *  for region resources.
5 *
6 *  Input parameters:
7 *    argument - task argument
8 *
9 *  Output parameters:  NONE
10 *
11 *  COPYRIGHT (c) 1989-2009.
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.org/license/LICENSE.
17 */
18
19#ifdef HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include "system.h"
24
25rtems_task Task5(
26  rtems_task_argument argument
27)
28{
29  void              *segment_address_1;
30  void              *segment_address_2;
31  rtems_status_code  status;
32
33  puts( "TA5 - rtems_region_get_segment - wait on 1.5K segment from region 1" );
34  status = rtems_region_get_segment(
35    Region_id[ 1 ],
36    1536,
37    RTEMS_DEFAULT_OPTIONS,
38    RTEMS_NO_TIMEOUT,
39    &segment_address_1
40  );
41  directive_failed( status, "rtems_region_get_segment" );
42
43  status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 );
44  directive_failed( status, "rtems_region_return_segment" );
45  puts_nocr( "TA5 - got and returned " );
46  Put_address_from_area_1( segment_address_1 );
47  new_line;
48
49  status = rtems_task_wake_after( RTEMS_MICROSECONDS_TO_TICKS( 1000000 ) );
50  directive_failed( status, "rtems_task_wake_after" );
51
52  puts( "TA5 - rtems_region_get_segment - wait on 3K segment from region 1" );
53  status = rtems_region_get_segment(
54    Region_id[ 1 ],
55    3072,
56    RTEMS_DEFAULT_OPTIONS,
57    RTEMS_NO_TIMEOUT,
58    &segment_address_2
59  );
60  puts_nocr( "TA5 - got segment from region 1 - " );
61  Put_address_from_area_1( segment_address_2 );
62  new_line;
63
64  status = rtems_region_return_segment( Region_id[ 1 ], segment_address_2 );
65  puts_nocr(
66    "TA5 - rtems_region_return_segment - return segment to region 1 - "
67  );
68  Put_address_from_area_1( segment_address_2 );
69  new_line;
70
71  puts( "TA5 - rtems_task_exit" );
72  rtems_task_exit();
73}
Note: See TracBrowser for help on using the repository browser.