source: rtems/testsuites/sptests/sp72/init.c @ 7d3f9c6

4.115
Last change on this file since 7d3f9c6 was 7d3f9c6, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/22/11 at 07:37:03

Add HAVE_CONFIG_H.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2010.
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#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <tmacros.h>
17#include "test_support.h"
18
19rtems_id Semaphore_id;
20
21rtems_task Test_task(
22  rtems_task_argument argument
23)
24{
25  rtems_status_code status;
26
27  puts( "Task - rtems_semaphore_obtain - wait w/timeout " );
28  status = rtems_semaphore_obtain(
29    Semaphore_id,
30    RTEMS_DEFAULT_OPTIONS,
31    rtems_clock_get_ticks_per_second() * 10
32  );
33}
34
35rtems_task Init(
36  rtems_task_argument argument
37)
38{
39  rtems_status_code status;
40  rtems_id          task_id;
41
42  puts( "\n\n*** TEST SP72 ***" );
43
44  status = rtems_semaphore_create(
45    rtems_build_name( 'S', 'M', '1', ' ' ),
46    0,
47    RTEMS_PRIORITY,
48    0,
49    &Semaphore_id
50  );
51  directive_failed( status, "rtems_semaphore_create - priority blocking" );
52
53  status = rtems_task_create(
54    rtems_build_name( 'T', 'E', 'S', 'T' ),
55    1,
56    RTEMS_MINIMUM_STACK_SIZE,
57    RTEMS_DEFAULT_MODES,
58    RTEMS_DEFAULT_ATTRIBUTES,
59    &task_id
60  );
61  directive_failed( status, "rtems_task_create" );
62 
63  status = rtems_task_start( task_id, Test_task, 0 );
64  directive_failed( status, "rtems_task_start" );
65
66  puts( "Init - sleep 1 second" );
67  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
68  directive_failed( status, "rtems_task_wake_after" );
69
70  puts( "Init - rtems_task_delete - to extract priority w/timeout" );
71  status = rtems_task_delete( task_id );
72  directive_failed( status, "rtems_task_delete" );
73
74  puts( "*** END OF TEST SP72 ***" );
75
76  rtems_test_exit(0);
77}
78
79/* configuration information */
80
81#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
82#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
83
84#define CONFIGURE_MAXIMUM_TASKS             2
85#define CONFIGURE_MAXIMUM_SEMAPHORES        1
86#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
87
88#define CONFIGURE_INIT
89
90#include <rtems/confdefs.h>
91/* end of file */
Note: See TracBrowser for help on using the repository browser.