source: rtems/testsuites/samples/ticker/init.c @ 98c6d50

5
Last change on this file since 98c6d50 was 98c6d50, checked in by Chris Johns <chrisj@…>, on 10/19/17 at 05:39:16

testsuite: Use printk for all test output where possible.

  • Remove the printf support leaving the direct printk support configured with TESTS_USE_PRINTK and all other output goes via a buffered vsniprintf call to printk.
  • Control the test's single init for functions and global data with TEST_INIT and not CONFIGURE_INIT. They are now separate.

Updates #3170.

  • Property mode set to 100644
File size: 2.1 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
[98c6d50]14#define TEST_INIT
15
[df49c60]16#define CONFIGURE_INIT
[ac7d5ef0]17#include "system.h"
[df49c60]18
[9391f6d]19const char rtems_test_name[] = "CLOCK TICK";
20
[df49c60]21/*
22 *  Keep the names and IDs in global variables so another task can use them.
23 */
24
25rtems_id   Task_id[ 4 ];         /* array of task ids */
26rtems_name Task_name[ 4 ];       /* array of task names */
[ac7d5ef0]27
28rtems_task Init(
29  rtems_task_argument argument
30)
31{
32  rtems_status_code status;
33  rtems_time_of_day time;
34
[9391f6d]35  TEST_BEGIN();
[ac7d5ef0]36
[df49c60]37  time.year   = 1988;
38  time.month  = 12;
39  time.day    = 31;
40  time.hour   = 9;
41  time.minute = 0;
42  time.second = 0;
43  time.ticks  = 0;
44
[ac7d5ef0]45  status = rtems_clock_set( &time );
[7c1e6942]46  directive_failed( status, "clock get" );
[ac7d5ef0]47
48  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
49  Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
50  Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
51
[3652ad35]52  status = rtems_task_create(
[5fe6b21a]53    Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
[3652ad35]54    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
55  );
[7c1e6942]56  directive_failed( status, "create 1" );
57
[3652ad35]58  status = rtems_task_create(
[5fe6b21a]59    Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
[3652ad35]60    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
61  );
[7c1e6942]62  directive_failed( status, "create 2" );
63
[3652ad35]64  status = rtems_task_create(
[5fe6b21a]65    Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
[3652ad35]66    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ]
67  );
[7c1e6942]68  directive_failed( status, "create 3" );
[ac7d5ef0]69
70  status = rtems_task_start( Task_id[ 1 ], Test_task, 1 );
[7c1e6942]71  directive_failed( status, "start 1" );
72
[ac7d5ef0]73  status = rtems_task_start( Task_id[ 2 ], Test_task, 2 );
[7c1e6942]74  directive_failed( status, "start 2" );
75
[ac7d5ef0]76  status = rtems_task_start( Task_id[ 3 ], Test_task, 3 );
[7c1e6942]77  directive_failed( status, "start 3" );
[ac7d5ef0]78
79  status = rtems_task_delete( RTEMS_SELF );
[7c1e6942]80  directive_failed( status, "delete" );
[ac7d5ef0]81}
Note: See TracBrowser for help on using the repository browser.