source: rtems/testsuites/sptests/spintrcritical06/init.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 3.3 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
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/* common parameters */
19#define SEMAPHORE_ATTRIBUTES     RTEMS_PRIORITY
20
21#if defined(PRIORITY_NO_TIMEOUT_FORWARD)
22  #define TEST_NAME          "06"
23  #define TEST_STRING        "Priority/Restart Search Task (Forward)"
24
25  #define INIT_PRIORITY      2
26  #define BLOCKER_PRIORITY   1
27  #define SEMAPHORE_OBTAIN_TIMEOUT 2
28
29#elif defined(PRIORITY_NO_TIMEOUT_REVERSE)
30  #define TEST_NAME          "07"
31  #define TEST_STRING        "Priority/Restart Search Task (Backward)"
32  #define INIT_PRIORITY      126
33  #define BLOCKER_PRIORITY   127
34  #define SEMAPHORE_OBTAIN_TIMEOUT 0
35
36#else
37
38  #error "Test Mode not defined"
39#endif
40
41rtems_id Secondary_task_id;
42rtems_id Semaphore;
43
44rtems_timer_service_routine test_release_from_isr(
45  rtems_id  timer,
46  void     *arg
47)
48{
49  (void) rtems_task_restart( Secondary_task_id, 1 );
50}
51
52rtems_task Secondary_task(
53  rtems_task_argument arg
54)
55{
56  if ( arg )
57    (void) rtems_semaphore_flush( Semaphore );
58
59  (void) rtems_semaphore_obtain(
60    Semaphore,
61    RTEMS_DEFAULT_OPTIONS,
62    RTEMS_NO_TIMEOUT
63  );
64
65  rtems_test_assert(0);
66}
67
68rtems_task Init(
69  rtems_task_argument ignored
70)
71{
72  rtems_status_code     status;
73  int                   resets;
74
75  puts( "\n\n*** TEST INTERRUPT CRITICAL SECTION " TEST_NAME " ***" );
76
77  puts( "Init - Trying to generate semaphore release from ISR while blocking" );
78  puts( "Init - There is no way for the test to know if it hits the case" );
79  puts( "Init - Variation is: " TEST_STRING );
80  status = rtems_semaphore_create(
81    rtems_build_name( 'S', 'M', '1', ' ' ),
82    0,
83    SEMAPHORE_ATTRIBUTES,
84    RTEMS_NO_PRIORITY,
85    &Semaphore
86  );
87  directive_failed( status, "rtems_semaphore_create of SM1" );
88
89  status = rtems_task_create(
90    rtems_build_name( 'B', 'L', 'C', 'K' ),
91    BLOCKER_PRIORITY,
92    RTEMS_MINIMUM_STACK_SIZE,
93    RTEMS_NO_PREEMPT,
94    RTEMS_DEFAULT_ATTRIBUTES,
95    &Secondary_task_id
96  );
97  directive_failed( status, "rtems_task_create" );
98
99  status = rtems_task_start( Secondary_task_id, Secondary_task, 0 );
100  directive_failed( status, "rtems_task_start" );
101
102  interrupt_critical_section_test_support_initialize( test_release_from_isr );
103
104  for (resets=0 ; resets< 2 ;) {
105    if ( interrupt_critical_section_test_support_delay() )
106      resets++;
107
108    status = rtems_semaphore_obtain(
109      Semaphore,
110      RTEMS_DEFAULT_OPTIONS,
111      SEMAPHORE_OBTAIN_TIMEOUT
112    );
113  }
114
115  puts( "*** END OF TEST INTERRUPT CRITICAL SECTION " TEST_NAME " ***" );
116  rtems_test_exit(0);
117}
118
119/* configuration information */
120
121#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
122#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
123
124#define CONFIGURE_MAXIMUM_TASKS       2
125#define CONFIGURE_MAXIMUM_TIMERS      1
126#define CONFIGURE_MAXIMUM_SEMAPHORES  1
127#define CONFIGURE_INIT_TASK_PRIORITY  INIT_PRIORITY
128#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_PREEMPT
129#define CONFIGURE_MICROSECONDS_PER_TICK  2000
130#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
131
132#define CONFIGURE_INIT
133#include <rtems/confdefs.h>
134
135/* global variables */
Note: See TracBrowser for help on using the repository browser.