source: rtems/testsuites/sptests/sp46/init.c @ ff79baf0

4.9
Last change on this file since ff79baf0 was ff79baf0, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 9, 2009 at 6:28:00 PM

2009-09-09 Joel Sherrill <joel.sherrill@…>

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