1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * |
---|
6 | * @ingroup bsp_interrupt |
---|
7 | * |
---|
8 | * @brief This source file contains the legacy interrupt controller support |
---|
9 | * implementation. |
---|
10 | */ |
---|
11 | |
---|
12 | /* |
---|
13 | * Copyright (C) 2008, 2009 embedded brains GmbH (http://www.embedded-brains.de) |
---|
14 | * |
---|
15 | * Redistribution and use in source and binary forms, with or without |
---|
16 | * modification, are permitted provided that the following conditions |
---|
17 | * are met: |
---|
18 | * 1. Redistributions of source code must retain the above copyright |
---|
19 | * notice, this list of conditions and the following disclaimer. |
---|
20 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
21 | * notice, this list of conditions and the following disclaimer in the |
---|
22 | * documentation and/or other materials provided with the distribution. |
---|
23 | * |
---|
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
34 | * POSSIBILITY OF SUCH DAMAGE. |
---|
35 | */ |
---|
36 | |
---|
37 | #include <string.h> |
---|
38 | |
---|
39 | #define BSP_SHARED_HANDLER_SUPPORT |
---|
40 | |
---|
41 | #include <rtems.h> |
---|
42 | #include <rtems/irq.h> |
---|
43 | |
---|
44 | #include <bsp/irq-generic.h> |
---|
45 | |
---|
46 | /** |
---|
47 | * @deprecated Obsolete. |
---|
48 | */ |
---|
49 | int BSP_get_current_rtems_irq_handler(rtems_irq_connect_data *cd) |
---|
50 | { |
---|
51 | memset(cd, 0, sizeof(*cd)); |
---|
52 | |
---|
53 | return 1; |
---|
54 | } |
---|
55 | |
---|
56 | /** |
---|
57 | * @deprecated Use rtems_interrupt_handler_install() instead. |
---|
58 | */ |
---|
59 | int BSP_install_rtems_irq_handler(const rtems_irq_connect_data *cd) |
---|
60 | { |
---|
61 | rtems_status_code sc = RTEMS_SUCCESSFUL; |
---|
62 | |
---|
63 | sc = rtems_interrupt_handler_install( |
---|
64 | cd->name, |
---|
65 | "LEGACY INSTALLED", |
---|
66 | RTEMS_INTERRUPT_UNIQUE, |
---|
67 | cd->hdl, |
---|
68 | cd->handle |
---|
69 | ); |
---|
70 | if (sc != RTEMS_SUCCESSFUL) { |
---|
71 | return 0; |
---|
72 | } |
---|
73 | |
---|
74 | if (cd->on != NULL) { |
---|
75 | cd->on(cd); |
---|
76 | } |
---|
77 | |
---|
78 | return 1; |
---|
79 | } |
---|
80 | |
---|
81 | /** |
---|
82 | * @deprecated Use rtems_interrupt_handler_install() instead. |
---|
83 | */ |
---|
84 | int BSP_install_rtems_shared_irq_handler(const rtems_irq_connect_data *cd) |
---|
85 | { |
---|
86 | rtems_status_code sc = RTEMS_SUCCESSFUL; |
---|
87 | |
---|
88 | sc = rtems_interrupt_handler_install( |
---|
89 | cd->name, |
---|
90 | "LEGACY INSTALLED", |
---|
91 | RTEMS_INTERRUPT_SHARED, |
---|
92 | cd->hdl, |
---|
93 | cd->handle |
---|
94 | ); |
---|
95 | if (sc != RTEMS_SUCCESSFUL) { |
---|
96 | return 0; |
---|
97 | } |
---|
98 | |
---|
99 | if (cd->on != NULL) { |
---|
100 | (*cd->on)(cd); |
---|
101 | } |
---|
102 | |
---|
103 | return 1; |
---|
104 | } |
---|
105 | |
---|
106 | /** |
---|
107 | * @deprecated Use rtems_interrupt_handler_remove() instead. |
---|
108 | */ |
---|
109 | int BSP_remove_rtems_irq_handler(const rtems_irq_connect_data *cd) |
---|
110 | { |
---|
111 | rtems_status_code sc = RTEMS_SUCCESSFUL; |
---|
112 | |
---|
113 | if (cd->off != NULL) { |
---|
114 | (*cd->off)(cd); |
---|
115 | } |
---|
116 | |
---|
117 | sc = rtems_interrupt_handler_remove(cd->name, cd->hdl, cd->handle); |
---|
118 | if (sc != RTEMS_SUCCESSFUL) { |
---|
119 | return 0; |
---|
120 | } |
---|
121 | |
---|
122 | return 1; |
---|
123 | } |
---|
124 | |
---|
125 | /** |
---|
126 | * @deprecated Use bsp_interrupt_initialize() instead. |
---|
127 | */ |
---|
128 | int BSP_rtems_irq_mngt_set(rtems_irq_global_settings *config) |
---|
129 | { |
---|
130 | return 0; |
---|
131 | } |
---|
132 | |
---|
133 | /** |
---|
134 | * @deprecated Obsolete. |
---|
135 | */ |
---|
136 | int BSP_rtems_irq_mngt_get(rtems_irq_global_settings **config) |
---|
137 | { |
---|
138 | *config = NULL; |
---|
139 | return 0; |
---|
140 | } |
---|