source: rtems/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c @ 64a04ac

4.115
Last change on this file since 64a04ac was 64a04ac, checked in by Sebastian Huber <sebastian.huber@…>, on 05/12/14 at 06:53:11

bsps: Use standard file name for BSP support

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/**
2 * @file
3 * @ingroup sparc_leon3
4 * @brief LEON3 SMP BSP Support
5 */
6
7/*
8 *  COPYRIGHT (c) 1989-2011.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.org/license/LICENSE.
14 */
15
16#include <bsp.h>
17#include <leon.h>
18#include <rtems/bspIo.h>
19#include <rtems/score/smpimpl.h>
20#include <stdlib.h>
21
22#if !defined(__leon__)
23uint32_t _CPU_SMP_Get_current_processor( void )
24{
25  return _LEON3_Get_current_processor();
26}
27#endif
28
29static rtems_isr bsp_inter_processor_interrupt(
30  rtems_vector_number vector
31)
32{
33  _SMP_Inter_processor_interrupt_handler();
34}
35
36void leon3_secondary_cpu_initialize(uint32_t cpu_index)
37{
38  leon3_set_cache_control_register(0x80000F);
39  /* Unmask IPI interrupts at Interrupt controller for this CPU */
40  LEON3_IrqCtrl_Regs->mask[cpu_index] |= 1U << LEON3_MP_IRQ;
41
42  _SMP_Start_multitasking_on_secondary_processor();
43}
44
45uint32_t _CPU_SMP_Initialize( void )
46{
47  leon3_set_cache_control_register(0x80000F);
48
49  if ( rtems_configuration_get_maximum_processors() > 1 ) {
50    LEON_Unmask_interrupt(LEON3_MP_IRQ);
51    set_vector(bsp_inter_processor_interrupt, LEON_TRAP_TYPE(LEON3_MP_IRQ), 1);
52  }
53
54  return leon3_get_cpu_count(LEON3_IrqCtrl_Regs);
55}
56
57bool _CPU_SMP_Start_processor( uint32_t cpu_index )
58{
59  #if defined(RTEMS_DEBUG)
60    printk( "Waking CPU %d\n", cpu_index );
61  #endif
62
63  LEON3_IrqCtrl_Regs->mpstat = 1U << cpu_index;
64
65  return true;
66}
67
68void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
69{
70  (void) cpu_count;
71
72  /* Nothing to do */
73}
74
75void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
76{
77  /* send interrupt to destination CPU */
78  LEON3_IrqCtrl_Regs->force[target_processor_index] = 1 << LEON3_MP_IRQ;
79}
Note: See TracBrowser for help on using the repository browser.