source: rtems/testsuites/smptests/smpunsupported01/init.c

Last change on this file was bcef89f2, checked in by Sebastian Huber <sebastian.huber@…>, on 05/19/23 at 06:18:25

Update company name

The embedded brains GmbH & Co. KG is the legal successor of embedded
brains GmbH.

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 * Copyright (c) 2014 On-Line Applications Research Corporation (OAR).
5 * Copyright (C) 2013, 2016 embedded brains GmbH & Co. KG
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifdef HAVE_CONFIG_H
30#include "config.h"
31#endif
32
33#include "tmacros.h"
34
35const char rtems_test_name[] = "SMPUNSUPPORTED 1";
36
37static void test(void)
38{
39  rtems_status_code sc;
40  rtems_mode mode;
41  rtems_id id;
42
43  sc = rtems_task_mode(RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &mode);
44  rtems_test_assert(sc == RTEMS_NOT_IMPLEMENTED);
45
46  sc = rtems_task_create(
47    rtems_build_name('T', 'A', 'S', 'K'),
48    RTEMS_MINIMUM_PRIORITY,
49    RTEMS_MINIMUM_STACK_SIZE,
50    RTEMS_NO_PREEMPT,
51    RTEMS_DEFAULT_ATTRIBUTES,
52    &id
53  );
54  rtems_test_assert(sc == RTEMS_UNSATISFIED);
55
56  mode = RTEMS_INTERRUPT_LEVEL(0);
57  if (mode == 0) {
58    sc = rtems_task_mode(mode, RTEMS_INTERRUPT_MASK, &mode);
59    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
60  }
61
62  mode = RTEMS_INTERRUPT_LEVEL(1);
63  if (mode != 0) {
64    sc = rtems_task_mode(mode, RTEMS_INTERRUPT_MASK, &mode);
65    rtems_test_assert(sc == RTEMS_NOT_IMPLEMENTED);
66
67    sc = rtems_task_create(
68      rtems_build_name('T', 'A', 'S', 'K'),
69      RTEMS_MINIMUM_PRIORITY,
70      RTEMS_MINIMUM_STACK_SIZE,
71      mode,
72      RTEMS_DEFAULT_ATTRIBUTES,
73      &id
74    );
75    rtems_test_assert(sc == RTEMS_UNSATISFIED);
76  } else {
77    puts("RTEMS_INTERRUPT_LEVEL(1) not supported on this platform");
78  }
79}
80
81static void Init(rtems_task_argument arg)
82{
83  TEST_BEGIN();
84
85  test();
86
87  TEST_END();
88  rtems_test_exit(0);
89}
90
91#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
92#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
93
94#define CONFIGURE_MAXIMUM_PROCESSORS 2
95
96#define CONFIGURE_MAXIMUM_TASKS 2
97
98#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
99
100#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
101
102#define CONFIGURE_INIT
103
104#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.