source: rtems/c/src/lib/libbsp/arm/shared/arm-a9mpcore-smp.c @ 4627fcd

4.115
Last change on this file since 4627fcd was 4627fcd, checked in by Sebastian Huber <sebastian.huber@…>, on 02/17/14 at 13:25:29

score: Rename bsp_smp_initialize()

Rename bsp_smp_initialize() into _CPU_SMP_Initialize() since every CPU
port must supply this function.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <info@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.com/license/LICENSE.
13 */
14
15#include <assert.h>
16
17#include <rtems/bspsmp.h>
18
19#include <libcpu/arm-cp15.h>
20
21#include <bsp/irq.h>
22
23static void ipi_handler(void *arg)
24{
25  rtems_smp_process_interrupt();
26}
27
28uint32_t _CPU_SMP_Initialize(uint32_t configured_cpu_count)
29{
30  rtems_status_code sc;
31  uint32_t max_cpu_count = arm_gic_irq_processor_count();
32  uint32_t used_cpu_count = configured_cpu_count < max_cpu_count ?
33    configured_cpu_count : max_cpu_count;
34
35  sc = rtems_interrupt_handler_install(
36    ARM_GIC_IRQ_SGI_0,
37    "IPI",
38    RTEMS_INTERRUPT_UNIQUE,
39    ipi_handler,
40    NULL
41  );
42  assert(sc == RTEMS_SUCCESSFUL);
43
44  return used_cpu_count;
45}
46
47void bsp_smp_broadcast_interrupt(void)
48{
49  /*
50   * FIXME: This broadcasts the interrupt also to processors not used by RTEMS.
51   */
52  rtems_status_code sc = arm_gic_irq_generate_software_irq(
53    ARM_GIC_IRQ_SGI_0,
54    ARM_GIC_IRQ_SOFTWARE_IRQ_TO_ALL_EXCEPT_SELF,
55    0xff
56  );
57}
58
59void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
60{
61  rtems_status_code sc = arm_gic_irq_generate_software_irq(
62    ARM_GIC_IRQ_SGI_0,
63    ARM_GIC_IRQ_SOFTWARE_IRQ_TO_ALL_IN_LIST,
64    (uint8_t) (1U << target_processor_index)
65  );
66}
Note: See TracBrowser for help on using the repository browser.