source: rtems/testsuites/sptests/sp46/init.c @ 51bdbca1

4.104.115
Last change on this file since 51bdbca1 was 51bdbca1, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on 11/30/09 at 12:51:50

fixed some typos

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2009.
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.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#include <tmacros.h>
13#include <rtems/cpuuse.h>
14
15rtems_task Periodic_Task(
16  rtems_task_argument argument
17);
18rtems_task Init(
19  rtems_task_argument argument
20);
21
22volatile int partial_loop = 0;
23
24rtems_task Periodic_Task(
25  rtems_task_argument argument
26)
27{
28  rtems_status_code  status;
29  rtems_name         period_name = rtems_build_name('P','E','R','a');
30  rtems_id           period_id;
31  rtems_interval     start;
32  rtems_interval     end;
33
34  puts( "Periodic - Create Period" );
35  /* create period */
36  status = rtems_rate_monotonic_create( period_name, &period_id );
37  directive_failed(status, "rate_monotonic_create");
38
39  partial_loop = 0;
40  while (1) {
41    /* start period with initial value */
42    status = rtems_rate_monotonic_period( period_id, 25 );
43    directive_failed(status, "rate_monotonic_period");
44    partial_loop = 0;
45
46    start = rtems_clock_get_ticks_since_boot();
47    end   = start + 5;
48    while ( end <= rtems_clock_get_ticks_since_boot() )
49      ;
50
51    partial_loop = 1;
52
53    rtems_task_wake_after( 5 );
54  }
55
56  puts( "Periodic - Deleting self" );
57  rtems_task_delete( RTEMS_SELF );
58}
59
60rtems_task Init(
61  rtems_task_argument argument
62)
63{
64  rtems_status_code  status;
65  rtems_id           task_id;
66
67  puts( "\n\n*** TEST 46 ***" );
68
69  /*
70   * Initialize Tasks
71   */
72
73
74  puts( "INIT - rtems_task_create - creating task 1" );
75  status = rtems_task_create(
76    rtems_build_name( 'T', 'A', '1', ' ' ),
77    1,
78    RTEMS_MINIMUM_STACK_SIZE,
79    RTEMS_DEFAULT_MODES,
80    RTEMS_DEFAULT_ATTRIBUTES,
81    &task_id
82  );
83  directive_failed( status, "rtems_task_create of TA1" );
84
85  puts( "INIT - rtems_task_start - TA1 " );
86  status = rtems_task_start( task_id, Periodic_Task, 0 );
87  directive_failed( status, "rtems_task_start of TA1" );
88
89  while ( !partial_loop ) {
90    status = rtems_task_wake_after( 2 );
91    directive_failed( status, "rtems_task_wake_after" );
92  }
93
94  rtems_cpu_usage_reset();
95
96  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
97  directive_failed( status, "rtems_task_wake_after" );
98
99  /*
100   *  Exit test
101   */
102  puts( "*** END OF TEST 46 *** " );
103  rtems_test_exit( 0 );
104}
105
106#define CONFIGURE_INIT
107/* configuration information */
108
109#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
110#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
111
112/* Two Tasks: Init and Timer Server */
113#define CONFIGURE_MAXIMUM_TASKS           2
114#define CONFIGURE_MAXIMUM_PERIODS         1
115#define CONFIGURE_INIT_TASK_STACK_SIZE    (RTEMS_MINIMUM_STACK_SIZE * 2)
116#define CONFIGURE_INIT_TASK_PRIORITY      10
117#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
118
119#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
120
121#define CONFIGURE_EXTRA_TASK_STACKS       (1 * RTEMS_MINIMUM_STACK_SIZE)
122
123#include <rtems/confdefs.h>
124
Note: See TracBrowser for help on using the repository browser.