source: rtems/c/src/lib/libbsp/arm/shared/include/arm-gic-irq.h @ 94c17af

4.115
Last change on this file since 94c17af was db42c079, checked in by Sebastian Huber <sebastian.huber@…>, on 05/31/13 at 11:59:47

bsps/arm: Add SMP support

  • Property mode set to 100644
File size: 2.2 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#ifndef LIBBSP_ARM_SHARED_ARM_GIC_IRQ_H
16#define LIBBSP_ARM_SHARED_ARM_GIC_IRQ_H
17
18#include <bsp.h>
19#include <bsp/arm-gic.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif /* __cplusplus */
24
25#define ARM_GIC_IRQ_SGI_0 0
26#define ARM_GIC_IRQ_SGI_1 1
27#define ARM_GIC_IRQ_SGI_2 2
28#define ARM_GIC_IRQ_SGI_3 3
29#define ARM_GIC_IRQ_SGI_5 5
30#define ARM_GIC_IRQ_SGI_6 6
31#define ARM_GIC_IRQ_SGI_7 7
32#define ARM_GIC_IRQ_SGI_8 8
33#define ARM_GIC_IRQ_SGI_9 9
34#define ARM_GIC_IRQ_SGI_10 10
35#define ARM_GIC_IRQ_SGI_11 11
36#define ARM_GIC_IRQ_SGI_12 12
37#define ARM_GIC_IRQ_SGI_13 13
38#define ARM_GIC_IRQ_SGI_14 14
39#define ARM_GIC_IRQ_SGI_15 15
40
41#define ARM_GIC_DIST ((volatile gic_dist *) BSP_ARM_GIC_DIST_BASE)
42
43rtems_status_code arm_gic_irq_set_priority(
44  rtems_vector_number vector,
45  uint8_t priority
46);
47
48rtems_status_code arm_gic_irq_get_priority(
49  rtems_vector_number vector,
50  uint8_t *priority
51);
52
53typedef enum {
54  ARM_GIC_IRQ_SOFTWARE_IRQ_TO_ALL_IN_LIST,
55  ARM_GIC_IRQ_SOFTWARE_IRQ_TO_ALL_EXCEPT_SELF,
56  ARM_GIC_IRQ_SOFTWARE_IRQ_TO_SELF
57} arm_gic_irq_software_irq_target_filter;
58
59static inline rtems_status_code arm_gic_irq_generate_software_irq(
60  rtems_vector_number vector,
61  arm_gic_irq_software_irq_target_filter filter,
62  uint8_t targets
63)
64{
65  rtems_status_code sc = RTEMS_SUCCESSFUL;
66
67  if (vector <= ARM_GIC_IRQ_SGI_15) {
68    volatile gic_dist *dist = ARM_GIC_DIST;
69
70    dist->icdsgir = GIC_DIST_ICDSGIR_TARGET_LIST_FILTER(filter)
71      | GIC_DIST_ICDSGIR_CPU_TARGET_LIST(targets)
72      | GIC_DIST_ICDSGIR_SGIINTID(vector);
73  } else {
74    sc = RTEMS_INVALID_ID;
75  }
76
77  return sc;
78}
79
80static inline uint32_t arm_gic_irq_processor_count(void)
81{
82  volatile gic_dist *dist = ARM_GIC_DIST;
83
84  return GIC_DIST_ICDICTR_CPU_NUMBER_GET(dist->icdictr) + 1;
85}
86
87void arm_gic_irq_initialize_secondary_cpu(void);
88
89#ifdef __cplusplus
90}
91#endif /* __cplusplus */
92
93#endif /* LIBBSP_ARM_SHARED_ARM_GIC_IRQ_H */
Note: See TracBrowser for help on using the repository browser.