source: rtems/testsuites/samples/ticker/init.c @ 51b3cbca

5
Last change on this file since 51b3cbca 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: 2.0 KB
RevLine 
[5f0cd34]1/*
2 *  COPYRIGHT (c) 1989-2012.
[ac7d5ef0]3 *  On-Line Applications Research Corporation (OAR).
4 *
[98e4ebf5]5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
[c499856]7 *  http://www.rtems.org/license/LICENSE.
[ac7d5ef0]8 */
9
[e313551]10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
[df49c60]14#define CONFIGURE_INIT
[ac7d5ef0]15#include "system.h"
[df49c60]16
[9391f6d]17const char rtems_test_name[] = "CLOCK TICK";
18
[df49c60]19/*
20 *  Keep the names and IDs in global variables so another task can use them.
21 */
22
23rtems_id   Task_id[ 4 ];         /* array of task ids */
24rtems_name Task_name[ 4 ];       /* array of task names */
[ac7d5ef0]25
26rtems_task Init(
27  rtems_task_argument argument
28)
29{
30  rtems_status_code status;
31  rtems_time_of_day time;
32
[9391f6d]33  TEST_BEGIN();
[ac7d5ef0]34
[df49c60]35  time.year   = 1988;
36  time.month  = 12;
37  time.day    = 31;
38  time.hour   = 9;
39  time.minute = 0;
40  time.second = 0;
41  time.ticks  = 0;
42
[ac7d5ef0]43  status = rtems_clock_set( &time );
[7c1e6942]44  directive_failed( status, "clock get" );
[ac7d5ef0]45
46  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
47  Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
48  Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
49
[3652ad35]50  status = rtems_task_create(
[5fe6b21a]51    Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
[3652ad35]52    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
53  );
[7c1e6942]54  directive_failed( status, "create 1" );
55
[3652ad35]56  status = rtems_task_create(
[5fe6b21a]57    Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
[3652ad35]58    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
59  );
[7c1e6942]60  directive_failed( status, "create 2" );
61
[3652ad35]62  status = rtems_task_create(
[5fe6b21a]63    Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
[3652ad35]64    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ]
65  );
[7c1e6942]66  directive_failed( status, "create 3" );
[ac7d5ef0]67
68  status = rtems_task_start( Task_id[ 1 ], Test_task, 1 );
[7c1e6942]69  directive_failed( status, "start 1" );
70
[ac7d5ef0]71  status = rtems_task_start( Task_id[ 2 ], Test_task, 2 );
[7c1e6942]72  directive_failed( status, "start 2" );
73
[ac7d5ef0]74  status = rtems_task_start( Task_id[ 3 ], Test_task, 3 );
[7c1e6942]75  directive_failed( status, "start 3" );
[ac7d5ef0]76
[51b3cbca]77  rtems_task_exit();
[ac7d5ef0]78}
Note: See TracBrowser for help on using the repository browser.