source: rtems/testsuites/sptests/sp65/init.c @ ab2422c

4.104.115
Last change on this file since ab2422c was 58dbfd7, checked in by Joel Sherrill <joel.sherrill@…>, on 08/17/09 at 17:42:21

2009-08-17 Santosh G Vattam <vattam.santosh@…>

  • sp65/init.c: Remove stray print.
  • sp65/sp65.doc: Add information on second case.
  • Property mode set to 100644
File size: 2.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 *  $Id$
10 */
11
12#include <tmacros.h>
13
14rtems_task Task_1(
15  rtems_task_argument arg
16);
17
18rtems_task Init(
19  rtems_task_argument ignored
20)
21{
22  int                  status, ceiling, old_ceiling;
23  rtems_id             Mutex_id, Task_id;
24 
25  puts( "\n\n*** TEST 65 ***" );
26
27  /*
28   *  Create binary semaphore (a.k.a. Mutex) with Priority Ceiling
29   *  attribute.
30   */
31   
32  puts( "Creating semaphore" );
33  status = rtems_semaphore_create(
34    rtems_build_name( 's','e','m','1' ),
35    1,
36    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_PRIORITY_CEILING,
37    1,
38    &Mutex_id
39  );
40  directive_failed( status, "rtems_semaphore_create" );
41
42  puts( "Calling rtems_semaphore_obtain" );
43  status = rtems_semaphore_obtain( Mutex_id, RTEMS_DEFAULT_OPTIONS, 0 );
44  directive_failed( status, "rtems_semaphore_obtain" );
45 
46  puts( "Calling rtems_task_create" );
47  status = rtems_task_create( rtems_build_name( 'T', 'A', 'S', '1' ),
48  1,
49  RTEMS_MINIMUM_STACK_SIZE,
50  RTEMS_DEFAULT_MODES,
51  RTEMS_DEFAULT_ATTRIBUTES,
52  &Task_id
53  );
54  directive_failed( status, "rtems_task_create" );
55 
56  puts( "Calling rtems_task_start" );
57  status = rtems_task_start( Task_id, Task_1, (rtems_task_argument)&Mutex_id );
58  directive_failed( status, "rtems_task_start" );
59 
60  sleep(1);
61 
62  puts( "Calling semaphore release" );
63  status = rtems_semaphore_release( Mutex_id );
64  directive_failed( status, "rtems_semaphore_release" );
65 
66
67  puts( "*** END OF TEST 65 ***" );
68
69  rtems_test_exit(0);
70}
71
72rtems_task Task_1(
73  rtems_task_argument arg
74)
75{
76  int status_in_task;
77  rtems_id *Mutex_id = (rtems_id *)arg;
78
79  puts( "Init Task_1: Obtaining semaphore" );
80  status_in_task = rtems_semaphore_obtain( *Mutex_id, RTEMS_DEFAULT_OPTIONS, 0 );
81  directive_failed( status_in_task, "Task_1 rtems_semaphore_obtain" );
82  return;
83}
84
85/* configuration information */
86
87#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
88#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
89
90#define CONFIGURE_MAXIMUM_TASKS         2
91#define CONFIGURE_MAXIMUM_SEMAPHORES    1
92#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
93
94#define CONFIGURE_INIT
95#include <rtems/confdefs.h>
96
97/* global variables */
Note: See TracBrowser for help on using the repository browser.