source: rtems/testsuites/smptests/smpfatal08/init.c @ 2086948a

Last change on this file since 2086948a was 2086948a, checked in by Sebastian Huber <sebastian.huber@…>, on May 11, 2018 at 4:54:59 AM

riscv: Add dummy SMP support

Update #3433.

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifdef HAVE_CONFIG_H
16  #include "config.h"
17#endif
18
19#include "tmacros.h"
20
21#include <rtems.h>
22#include <rtems/score/smpimpl.h>
23
24#include <bsp.h>
25#include <bsp/bootcard.h>
26
27#include <assert.h>
28#include <stdlib.h>
29
30const char rtems_test_name[] = "SMPFATAL 8";
31
32/*
33 * This test is a hack since there is no easy way to test this fatal error path
34 * without BSP support.
35 */
36
37void bsp_start_on_secondary_processor(void)
38{
39  /* Provided to avoid multiple definitions of the CPU SMP support functions */
40}
41
42#if QORIQ_THREAD_COUNT > 1
43void qoriq_start_thread(void)
44{
45  /* Provided to avoid multiple definitions of the CPU SMP support functions */
46}
47#endif
48
49uint32_t _CPU_SMP_Initialize(void)
50{
51  return 2;
52}
53
54bool _CPU_SMP_Start_processor(uint32_t cpu_index)
55{
56  (void) cpu_index;
57
58  return false;
59}
60
61void _CPU_SMP_Finalize_initialization(uint32_t cpu_count)
62{
63  (void) cpu_count;
64
65  assert(0);
66}
67
68void _CPU_SMP_Prepare_start_multitasking(void)
69{
70  assert(0);
71}
72
73#if defined(RTEMS_PARAVIRT) \
74  || (!defined(__leon__) && !defined(__PPC__) \
75    && !defined(__arm__) && !defined(__riscv))
76uint32_t _CPU_SMP_Get_current_processor(void)
77{
78  return 0;
79}
80#endif
81
82void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
83{
84  (void) target_processor_index;
85}
86
87static void Init(rtems_task_argument arg)
88{
89  assert(0);
90}
91
92static void fatal_extension(
93  rtems_fatal_source source,
94  bool always_set_to_false,
95  rtems_fatal_code code
96)
97{
98  TEST_BEGIN();
99
100  if (
101    source == RTEMS_FATAL_SOURCE_SMP
102      && !always_set_to_false
103      && code == SMP_FATAL_START_OF_MANDATORY_PROCESSOR_FAILED
104  ) {
105    TEST_END();
106  }
107}
108
109#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
110#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
111
112#define CONFIGURE_INITIAL_EXTENSIONS \
113  { .fatal = fatal_extension }, \
114  RTEMS_TEST_INITIAL_EXTENSION
115
116#define CONFIGURE_MAXIMUM_PROCESSORS 2
117
118#define CONFIGURE_SCHEDULER_SIMPLE_SMP
119
120#include <rtems/scheduler.h>
121
122RTEMS_SCHEDULER_SIMPLE_SMP(a);
123
124#define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
125  RTEMS_SCHEDULER_TABLE_SIMPLE_SMP(a, rtems_build_name('S', 'I', 'M', 'P'))
126
127#define CONFIGURE_SCHEDULER_ASSIGNMENTS \
128  RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \
129  RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY)
130
131#define CONFIGURE_MAXIMUM_TASKS 1
132
133#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
134
135#define CONFIGURE_INIT
136
137#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.