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

4.104.11
Last change on this file since b84f1fdc was b84f1fdc, checked in by Joel Sherrill <joel.sherrill@…>, on May 10, 2009 at 2:39:46 PM

2009-05-10 Joel Sherrill <joel.sherrill@…>

  • sp04/system.h, sp04/task1.c, sp04/tswitch.c, sp07/init.c, sp12/init.c, sp13/putbuff.c, sp13/system.h, sp13/task1.c, sp15/init.c, sp16/system.h, sp19/fptask.c, sp25/system.h, sp26/task1.c, sp27/init.c, sp28/init.c, sp29/init.c, sp31/task1.c, sp33/init.c, sp34/changepri.c, sp35/priinv.c, sp37/init.c, sp38/init.c, sp39/init.c, sp41/init.c, sp42/init.c, sp43/init.c, sp44/init.c, sp45/init.c, sp46/init.c, sp47/init.c, sp48/init.c, spfatal03/testcase.h, spfatal05/testcase.h, spfatal06/testcase.h, spfatal_support/system.h, spobjgetnext/init.c, spsize/getint.c, spsize/size.c: Fix warnings.
  • 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 45 ***" );
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( 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_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.