source: rtems/testsuites/sptests/spintrcritical08/init.c @ 3c8eda7

4.115
Last change on this file since 3c8eda7 was 3c8eda7, checked in by Joel Sherrill <joel.sherrill@…>, on 05/12/12 at 16:01:26

sptests - Eliminate missing prototype warnings

  • Property mode set to 100644
File size: 2.7 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.com/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 1
15#include <tmacros.h>
16#include <intrcritical.h>
17
18/* forward declarations to avoid warnings */
19rtems_task Init(rtems_task_argument argument);
20rtems_timer_service_routine test_release_from_isr(rtems_id  timer, void *arg);
21rtems_rate_monotonic_period_states getState(void);
22
23rtems_id Main_task;
24rtems_id Period;
25volatile bool case_hit;
26
27rtems_rate_monotonic_period_states getState(void)
28{
29  Objects_Locations       location;
30  Rate_monotonic_Control *period;
31
32  period = (Rate_monotonic_Control *)_Objects_Get(
33    &_Rate_monotonic_Information, Period, &location );
34  if ( location != OBJECTS_LOCAL ) {
35    puts( "Bad object lookup" );
36    rtems_test_exit(0);
37  }
38  _Thread_Unnest_dispatch();
39
40  return period->state;
41}
42
43rtems_timer_service_routine test_release_from_isr(
44  rtems_id  timer,
45  void     *arg
46)
47{
48  if ( getState() == RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING )
49    case_hit = true;
50}
51
52rtems_task Init(
53  rtems_task_argument ignored
54)
55{
56  rtems_status_code     sc;
57  int                   resets;
58
59  puts( "\n\n*** TEST INTERRUPT CRITICAL SECTION 08 ***" );
60
61  puts( "Init - Trying to generate period ending while blocking" );
62
63  puts( "Init - rtems_rate_monotonic_create - OK" );
64  sc = rtems_rate_monotonic_create(
65    rtems_build_name( 'P', 'E', 'R', '1' ),
66    &Period
67  );
68  directive_failed( sc, "rtems_rate_monotonic_create" );
69
70  Main_task = rtems_task_self();
71
72  interrupt_critical_section_test_support_initialize( test_release_from_isr );
73
74  case_hit = false;
75
76  for (resets=0 ; case_hit == false && resets< 2 ;) {
77    if ( interrupt_critical_section_test_support_delay() )
78      resets++;
79
80    sc = rtems_rate_monotonic_period( Period, 1 );
81    if ( sc == RTEMS_TIMEOUT )
82      continue;
83    directive_failed( sc, "rtems_monotonic_period");
84  }
85
86  if ( case_hit ) {
87    puts( "Init - It appears the case has been hit" );
88    puts( "*** END OF TEST INTERRUPT CRITICAL SECTION 08 ***" );
89  } else
90    puts( "Init - Case not hit - ran too long" );
91  rtems_test_exit(0);
92}
93
94/* configuration information */
95
96#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
97#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
98
99#define CONFIGURE_MAXIMUM_TASKS       2
100#define CONFIGURE_MAXIMUM_TIMERS      1
101#define CONFIGURE_MAXIMUM_PERIODS     1
102#define CONFIGURE_MICROSECONDS_PER_TICK  1000
103#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
104
105#define CONFIGURE_INIT
106#include <rtems/confdefs.h>
107
108/* global variables */
Note: See TracBrowser for help on using the repository browser.