aboutsummaryrefslogtreecommitdiff
path: root/secure_fw/spm/cmsis_psa/tfm_secure_irq_handlers_ipc.inc.template
blob: 8bf02a57c695a7aed34bb19d86f69d56c6fbf761 (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
/*
 * Copyright (c) 2019-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 "cmsis_compiler.h"
{% macro _irq_record(partition_name, signal, line, priority) -%}
{ {{ partition_name }}, {{ signal }}, {{ line }}, {{ priority }} },
{%- endmacro %}

/* Definitions of the signals of the IRQs (if any) */
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 */

/* Definitions of privileged IRQ handlers (if any) */
{% 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 %}
    tfm_set_irq_signal({{partition.manifest.name}}, {{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 %}