source: rtems/testsuites/smptests/smpfatal08/init.c @ c4b8b147

5
Last change on this file since c4b8b147 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: 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__) && !defined(__arm__))
75uint32_t _CPU_SMP_Get_current_processor(void)
76{
77  return 0;
78}
79#endif
80
81void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
82{
83  (void) target_processor_index;
84}
85
86static void Init(rtems_task_argument arg)
87{
88  assert(0);
89}
90
91static void fatal_extension(
92  rtems_fatal_source source,
93  bool always_set_to_false,
94  rtems_fatal_code code
95)
96{
97  TEST_BEGIN();
98
99  if (
100    source == RTEMS_FATAL_SOURCE_SMP
101      && !always_set_to_false
102      && code == SMP_FATAL_START_OF_MANDATORY_PROCESSOR_FAILED
103  ) {
104    TEST_END();
105  }
106}
107
108#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
109#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
110
111#define CONFIGURE_INITIAL_EXTENSIONS \
112  { .fatal = fatal_extension }, \
113  RTEMS_TEST_INITIAL_EXTENSION
114
115#define CONFIGURE_MAXIMUM_PROCESSORS 2
116
117#define CONFIGURE_SCHEDULER_SIMPLE_SMP
118
119#include <rtems/scheduler.h>
120
121RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(a);
122
123#define CONFIGURE_SCHEDULER_CONTROLS \
124  RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(a, rtems_build_name('S', 'I', 'M', 'P'))
125
126#define CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS \
127  RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \
128  RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY)
129
130#define CONFIGURE_MAXIMUM_TASKS 1
131
132#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
133
134#define CONFIGURE_INIT
135
136#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.