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

Last change on this file since 98c6d50 was 98c6d50, checked in by Chris Johns <chrisj@…>, on Oct 19, 2017 at 5:39:16 AM

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
Line 
1/*
2 *  COPYRIGHT (c) 1989-2012.
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#define TEST_INIT
15
16#define CONFIGURE_INIT
17#include "system.h"
18
19const char rtems_test_name[] = "CLOCK TICK";
20
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 */
27
28rtems_task Init(
29  rtems_task_argument argument
30)
31{
32  rtems_status_code status;
33  rtems_time_of_day time;
34
35  TEST_BEGIN();
36
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
45  status = rtems_clock_set( &time );
46  directive_failed( status, "clock get" );
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
52  status = rtems_task_create(
53    Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
54    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
55  );
56  directive_failed( status, "create 1" ); 
57
58  status = rtems_task_create(
59    Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
60    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
61  );
62  directive_failed( status, "create 2" ); 
63
64  status = rtems_task_create(
65    Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
66    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ]
67  );
68  directive_failed( status, "create 3" ); 
69
70  status = rtems_task_start( Task_id[ 1 ], Test_task, 1 );
71  directive_failed( status, "start 1" ); 
72
73  status = rtems_task_start( Task_id[ 2 ], Test_task, 2 );
74  directive_failed( status, "start 2" ); 
75
76  status = rtems_task_start( Task_id[ 3 ], Test_task, 3 );
77  directive_failed( status, "start 3" ); 
78
79  status = rtems_task_delete( RTEMS_SELF );
80  directive_failed( status, "delete" ); 
81}
Note: See TracBrowser for help on using the repository browser.