source: rtems/testsuites/sptests/sp75/init.c @ 99de42c

5
Last change on this file since 99de42c was c4b8b147, checked in by Sebastian Huber <sebastian.huber@…>, on 11/03/17 at 07:35:38

tests: Use simple console driver

Update #3170.
Update #3199.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2012.
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.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <tmacros.h>
15#include "test_support.h"
16
17const char rtems_test_name[] = "SP 75";
18
19/* forward declarations to avoid warnings */
20rtems_task Init(rtems_task_argument argument);
21
22rtems_task Init(
23  rtems_task_argument argument
24)
25{
26  rtems_status_code  sc;
27  rtems_id           mutex;
28  Per_CPU_Control   *cpu_self;
29
30  TEST_BEGIN();
31
32  sc = rtems_semaphore_create(
33    rtems_build_name('M', 'U', 'T', 'X'),
34    0,
35    RTEMS_BINARY_SEMAPHORE,
36    0,
37    &mutex
38  );
39  directive_failed(sc, "rtems_semaphore_create");
40
41  /*
42   *  Call semaphore obtain with dispatching disabled.  Reenable
43   *  dispatching before checking the status returned since
44   *  directive_failed() checks for dispatching being enabled.
45   */
46  puts( "rtems_semaphore_obtain - with dispatching disabled" );
47  cpu_self = _Thread_Dispatch_disable();
48    sc = rtems_semaphore_obtain(mutex, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT);
49  _Thread_Dispatch_enable(cpu_self);
50  directive_failed(sc, "rtems_semaphore_obtain");
51
52  TEST_END();
53  rtems_test_exit(0);
54}
55
56/* configuration information */
57
58#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
59#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
60
61#define CONFIGURE_MAXIMUM_TASKS             1
62#define CONFIGURE_MAXIMUM_SEMAPHORES        1
63#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
64
65#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
66
67#define CONFIGURE_INIT
68
69#include <rtems/confdefs.h>
70/* end of file */
Note: See TracBrowser for help on using the repository browser.