source: rtems/testsuites/smptests/smpfatal08/init.c @ 0b4ec4d

4.115
Last change on this file since 0b4ec4d was 0b4ec4d, checked in by Sebastian Huber <sebastian.huber@…>, on Jun 30, 2014 at 10:30:12 AM

smptests/smpfatal08: Support RTEMS_PARAVIRT

  • Property mode set to 100644
File size: 2.5 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 <rtems.h>
20#include <rtems/test.h>
21#include <rtems/score/smpimpl.h>
22
23#include <bsp/bootcard.h>
24
25#include <assert.h>
26#include <stdlib.h>
27
28const char rtems_test_name[] = "SMPFATAL 8";
29
30/*
31 * This test is a hack since there is no easy way to test this fatal error path
32 * without BSP support.
33 */
34
35void bsp_start_on_secondary_processor(void)
36{
37  /* Provided to avoid multiple definitions of the CPU SMP support functions */
38}
39
40uint32_t _CPU_SMP_Initialize(void)
41{
42  return 2;
43}
44
45bool _CPU_SMP_Start_processor(uint32_t cpu_index)
46{
47  (void) cpu_index;
48
49  return false;
50}
51
52void _CPU_SMP_Finalize_initialization(uint32_t cpu_count)
53{
54  (void) cpu_count;
55
56  assert(0);
57}
58
59#if defined(RTEMS_PARAVIRT) \
60  || (!defined(__leon__) && !defined(__PPC__) && !defined(__arm__))
61uint32_t _CPU_SMP_Get_current_processor(void)
62{
63  return 0;
64}
65#endif
66
67void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
68{
69  (void) target_processor_index;
70}
71
72static void Init(rtems_task_argument arg)
73{
74  assert(0);
75}
76
77static void fatal_extension(
78  rtems_fatal_source source,
79  bool is_internal,
80  rtems_fatal_code code
81)
82{
83  rtems_test_begink();
84
85  if (
86    source == RTEMS_FATAL_SOURCE_SMP
87      && !is_internal
88      && code == SMP_FATAL_START_OF_MANDATORY_PROCESSOR_FAILED
89  ) {
90    rtems_test_endk();
91  }
92}
93
94#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
95#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
96
97#define CONFIGURE_INITIAL_EXTENSIONS \
98  { .fatal = fatal_extension }, \
99  RTEMS_TEST_INITIAL_EXTENSION
100
101#define CONFIGURE_SMP_APPLICATION
102
103#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 2
104
105#define CONFIGURE_SCHEDULER_SIMPLE_SMP
106
107#include <rtems/scheduler.h>
108
109RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(a);
110
111#define CONFIGURE_SCHEDULER_CONTROLS \
112  RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(a, rtems_build_name('S', 'I', 'M', 'P'))
113
114#define CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS \
115  RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \
116  RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY)
117
118#define CONFIGURE_MAXIMUM_TASKS 1
119
120#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
121
122#define CONFIGURE_INIT
123
124#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.