aboutsummaryrefslogtreecommitdiff
path: root/secure_fw/spm/cmsis_func/tfm_secure_irq_handlers.inc.template
blob: 522886bcce21c001d8865f0a2099a086d4128358 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
 * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 */

{{utilities.donotedit_warning}}

{% for partition in partitions %}
#ifdef {{partition.attr.conditional}}
#include "{{partition.header_file}}"
#endif /* {{partition.attr.conditional}} */
{% endfor %}
#include "psa_manifest/pid.h"
{% macro _irq_record(partition_name, signal, line, priority) -%}
{ {{ partition_name }}, {{ signal }}, {{ line }}, {{ priority }} },
{%- endmacro %}

/* Definitions of the signals of the IRQs */
const struct tfm_core_irq_signal_data_t tfm_core_irq_signals[] = {
{% for partition in partitions %}
    {% if partition.manifest.irqs %}
        {% if partition.attr.conditional %}
#ifdef {{partition.attr.conditional}}
        {% endif %}
        {% for handler in partition.manifest.irqs %}
            {% set irq_data = namespace() %}
            {% if handler.source %}
                {% set irq_data.line = handler.source %}
            {% else %}
#error "Interrupt source isn't provided for 'irqs' in partition {{partition.manifest.name}}"
            {% endif %}
            {% if handler.tfm_irq_priority %}
                {% set irq_data.priority = handler.tfm_irq_priority %}
            {% else %}
                {% set irq_data.priority = "TFM_DEFAULT_SECURE_IRQ_PRIOTITY" %}
            {% endif %}
    {{ _irq_record(partition.manifest.name, handler.signal, irq_data.line, irq_data.priority) }}
        {% endfor %}
        {% if partition.attr.conditional %}
#endif /* {{partition.attr.conditional}} */
        {% endif %}
   {% endif %}
{% endfor %}
   {0, 0, 0, 0}                         /* add dummy element to avoid non-standard empty array */
};

const size_t tfm_core_irq_signals_count = (sizeof(tfm_core_irq_signals) /
                                           sizeof(*tfm_core_irq_signals)) - 1;  /* adjust for the dummy element */

extern void priv_irq_handler_main(uint32_t partition_id,
                                  uint32_t unpriv_handler,
                                  uint32_t irq_signal,
                                  uint32_t irq_line);

/* Forward declarations of unpriv IRQ handlers*/
{% for partition in partitions %}
    {% if partition.manifest.irqs %}
        {% if partition.attr.conditional %}
#ifdef {{partition.attr.conditional}}
        {% endif %}
        {% for handler in partition.manifest.irqs %}
extern void {{handler.signal}}_isr(void);
        {% endfor %}
        {% if partition.attr.conditional %}
#endif /* {{partition.attr.conditional}} */
        {% endif %}

    {% endif %}
{% endfor %}

/* Definitions of privileged IRQ handlers */
{% for partition in partitions %}
    {% if partition.manifest.irqs %}
        {% if partition.attr.conditional %}
#ifdef {{partition.attr.conditional}}
        {% endif %}
        {% for handler in partition.manifest.irqs %}
            {% if handler.source is number %}
void irq_{{handler.source}}_Handler(void)
            {% elif handler.source %}
void {{handler.source}}_Handler(void)
            {% else %}
#error "Interrupt source isn't provided for 'irqs' in partition {{partition.manifest.name}}"
            {% endif %}
{
            {% if handler.source %}
    priv_irq_handler_main({{partition.manifest.name}},
                          (uint32_t){{handler.signal}}_isr,
                          {{handler.signal}},
                          {{handler.source}});
            {% else %}
#error "Interrupt source isn't provided for 'irqs' in partition {{partition.manifest.name}}"
            {% endif %}
}

        {% endfor %}
        {% if partition.attr.conditional %}
#endif /* {{partition.attr.conditional}} */
        {% endif %}

    {% endif %}
{% endfor %}