source: rtems/testsuites/sptests/spintrcritical15/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: 2.8 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#include <tmacros.h>
15#include <intrcritical.h>
16
17#define TEST_NAME          "15"
18#define INIT_PRIORITY      2
19#define BLOCKER_PRIORITY   1
20
21rtems_id Main_task;
22rtems_id Secondary_task_id;
23rtems_id Semaphore;
24
25rtems_task Secondary_task(
26  rtems_task_argument ignored
27)
28{
29  rtems_status_code     sc;
30
31  while (1) {
32
33    sc = rtems_semaphore_obtain( Semaphore, RTEMS_DEFAULT_OPTIONS, 1 );
34    fatal_directive_status( sc, RTEMS_TIMEOUT, "rtems_semaphore_obtain" );
35  }
36}
37
38rtems_task Init(
39  rtems_task_argument ignored
40)
41{
42  rtems_status_code     sc;
43  int                   resets;
44
45  puts(
46    "\n\n*** TEST INTERRUPT CRITICAL SECTION " TEST_NAME " ***\n"
47    "Init - Trying to generate timeout of a thread while another is blocking\n"
48    "Init -   on the same thread queue\n"
49    "Init - There is no way for the test to know if it hits the case"
50  );
51
52  puts( "Init - rtems_semaphore_create - OK" );
53  sc = rtems_semaphore_create(
54    rtems_build_name( 'S', 'M', '1', ' ' ),
55    0,
56    RTEMS_DEFAULT_ATTRIBUTES,
57    RTEMS_NO_PRIORITY,
58    &Semaphore
59  );
60  directive_failed( sc, "rtems_semaphore_create of SM1" );
61
62  puts( "Init - rtems_task_create - OK" );
63  sc = rtems_task_create(
64    rtems_build_name( 'B', 'L', 'C', 'K' ),
65    BLOCKER_PRIORITY,
66    RTEMS_MINIMUM_STACK_SIZE,
67    RTEMS_NO_PREEMPT,
68    RTEMS_DEFAULT_ATTRIBUTES,
69    &Secondary_task_id
70  );
71  directive_failed( sc, "rtems_task_create" );
72
73  sc = rtems_task_start( Secondary_task_id, Secondary_task, 0 );
74  directive_failed( sc, "rtems_task_start" );
75
76  Main_task = rtems_task_self();
77
78  interrupt_critical_section_test_support_initialize( NULL );
79
80  for (resets=0 ; resets<10 ;) {
81    if ( interrupt_critical_section_test_support_delay() )
82      resets++;
83
84    sc = rtems_task_restart( Secondary_task_id, 1 );
85    directive_failed( sc, "rtems_task_restart" );
86
87    sc = rtems_semaphore_obtain( Semaphore, RTEMS_DEFAULT_OPTIONS, 1 );
88    fatal_directive_status( sc, RTEMS_TIMEOUT, "rtems_semaphore_obtain" );
89  }
90
91  puts( "*** END OF TEST INTERRUPT CRITICAL SECTION " TEST_NAME " ***" );
92  rtems_test_exit(0);
93}
94
95/* configuration information */
96
97#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
98#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
99
100#define CONFIGURE_MAXIMUM_TASKS          2
101#define CONFIGURE_MAXIMUM_SEMAPHORES     1
102#define CONFIGURE_MICROSECONDS_PER_TICK  1000
103#define CONFIGURE_INIT_TASK_PRIORITY  INIT_PRIORITY
104#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_PREEMPT
105#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
106
107#define CONFIGURE_INIT
108#include <rtems/confdefs.h>
109
110/* global variables */
Note: See TracBrowser for help on using the repository browser.