source: rtems/testsuites/sptests/sp65/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.6 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
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 <unistd.h>
16
17#if defined(INHERIT_CEILING)
18  #define TEST_NAME                "66"
19  #define TASK_PRIORITY            2
20#else
21  #define TEST_NAME                "65"
22  #define TASK_PRIORITY            1
23#endif
24
25rtems_task Task_1(
26  rtems_task_argument arg
27);
28
29rtems_task Init(
30  rtems_task_argument ignored
31)
32{
33  int                  status;
34  rtems_id             Mutex_id, Task_id;
35
36  puts( "\n\n*** TEST " TEST_NAME " ***" );
37
38  /*
39   *  Create binary semaphore (a.k.a. Mutex) with Priority Ceiling
40   *  attribute.
41   */
42
43  puts( "Creating semaphore" );
44  status = rtems_semaphore_create(
45    rtems_build_name( 's','e','m','1' ),
46    1,
47    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_PRIORITY_CEILING,
48    1,
49    &Mutex_id
50  );
51  directive_failed( status, "rtems_semaphore_create" );
52
53  puts( "Calling rtems_semaphore_obtain" );
54  status = rtems_semaphore_obtain( Mutex_id, RTEMS_DEFAULT_OPTIONS, 0 );
55  directive_failed( status, "rtems_semaphore_obtain" );
56
57  puts( "Calling rtems_task_create" );
58  status = rtems_task_create( rtems_build_name( 'T', 'A', 'S', '1' ),
59    TASK_PRIORITY,
60    RTEMS_MINIMUM_STACK_SIZE,
61    RTEMS_DEFAULT_MODES,
62    RTEMS_DEFAULT_ATTRIBUTES,
63    &Task_id
64  );
65  directive_failed( status, "rtems_task_create" );
66
67  puts( "Calling rtems_task_start" );
68  status = rtems_task_start( Task_id, Task_1, (rtems_task_argument)&Mutex_id );
69  directive_failed( status, "rtems_task_start" );
70
71  sleep(1);
72
73  puts( "Calling semaphore release" );
74  status = rtems_semaphore_release( Mutex_id );
75  directive_failed( status, "rtems_semaphore_release" );
76
77  puts( "*** END OF TEST 65 ***" );
78
79  rtems_test_exit(0);
80}
81
82rtems_task Task_1(
83  rtems_task_argument arg
84)
85{
86  int status_in_task;
87  rtems_id *Mutex_id = (rtems_id *)arg;
88
89  puts( "Init Task_1: Obtaining semaphore" );
90  status_in_task = rtems_semaphore_obtain(
91    *Mutex_id,
92    RTEMS_DEFAULT_OPTIONS,
93    0
94  );
95  directive_failed( status_in_task, "Task_1 rtems_semaphore_obtain" );
96  return;
97}
98
99/* configuration information */
100
101#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
102#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
103
104#define CONFIGURE_MAXIMUM_TASKS         2
105#define CONFIGURE_MAXIMUM_SEMAPHORES    1
106#define CONFIGURE_INIT_TASK_PRIORITY    TASK_PRIORITY
107#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
108
109#define CONFIGURE_INIT
110#include <rtems/confdefs.h>
111
112/* global variables */
Note: See TracBrowser for help on using the repository browser.