iLLD_TC27xD
1.0
IfxCpu_Irq.h
Go to the documentation of this file.
1
/**
2
* \file IfxCpu_Irq.h
3
* \brief This file contains the APIs for Interrupt related functions.
4
*
5
*
6
* \version iLLD_1_0_0_11_0
7
* \copyright Copyright (c) 2012 Infineon Technologies AG. All rights reserved.
8
*
9
*
10
* IMPORTANT NOTICE
11
*
12
*
13
* Infineon Technologies AG (Infineon) is supplying this file for use
14
* exclusively with Infineon's microcontroller products. This file can be freely
15
* distributed within development tools that are supporting such microcontroller
16
* products.
17
*
18
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
19
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
20
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
21
* INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
22
* OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
23
*
24
* \defgroup IfxLld_Cpu_Irq Interrupt Functions
25
* \ingroup IfxLld_Cpu
26
*
27
* \defgroup IfxLld_Cpu_Irq_Usage How to define Interrupts?
28
* \ingroup IfxLld_Cpu_Irq
29
*
30
* \defgroup IfxLld_Cpu_Irq_Functions Functions
31
* \ingroup IfxLld_Cpu_Irq
32
*
33
*/
34
#ifndef IFXCPU_IRQ_H_
35
#define IFXCPU_IRQ_H_
36
37
/*******************************************************************************
38
** Includes **
39
*******************************************************************************/
40
#include "Ifx_Cfg.h"
41
#include "
Cpu/Std/Ifx_Types.h
"
42
#include "
Cpu/Std/IfxCpu.h
"
43
#include "
Src/Std/IfxSrc.h
"
44
/*******************************************************************************
45
** Type definitions **
46
*******************************************************************************/
47
48
/*******************************************************************************
49
** Global Exported variables/constants **
50
*******************************************************************************/
51
52
/*******************************************************************************
53
** Global Exported macros/inlines/function ptototypes **
54
*******************************************************************************/
55
56
#if defined(IFX_USE_SW_MANAGED_INT)
57
/** \addtogroup IfxLld_Cpu_Irq_Functions
58
* \{ */
59
/** \brief API for Interrupt handler install for SW Managed interrupts.
60
* This API installs the isr to SW interrupt vector.
61
* This must be used only when IFX_USE_SW_MANAGED_INT is defined in Ifx_Cfg.h
62
*
63
* \param isrFuncPointer pointer to ISR function.
64
* \param serviceReqPrioNumber ISR priority.
65
*/
66
67
IFX_EXTERN
void
IfxCpu_Irq_installInterruptHandler(
void
*isrFuncPointer,
uint32
serviceReqPrioNumber);
68
69
IFX_INLINE
void
interruptHandlerInstall(
uint32
srpn,
uint32
addr)
70
{
71
IfxCpu_Irq_installInterruptHandler((
void
*)addr, srpn);
72
}
73
74
75
/** \} */
76
#endif
/*defined(IFX_USE_SW_MANAGED_INT) */
77
78
/** \addtogroup IfxLld_Cpu_Irq_Functions
79
* \{ */
80
/** \brief API to get type of service of the caller CPU.
81
* \param coreId core id of the core
82
* \return type of service for the corresponding CPU.
83
*/
84
IFX_INLINE
IfxSrc_Tos
IfxCpu_Irq_getTos
(
IfxCpu_ResourceCpu
coreId)
85
{
86
return
(
IfxSrc_Tos
)coreId;
87
}
88
89
90
/** \} */
91
92
/*Documentation */
93
/** \addtogroup IfxLld_Cpu_Irq_Usage
94
* \{
95
*
96
* This page describes how to use interrupts with application framework.\n
97
*
98
* \section IfxLld_Cpu_Irq_Terminology Interrupts Terminology:
99
* \subsection IfxLld_Cpu_Irq_HWManaged Hardware Managed Interrupt Mechanism.
100
* Hardware managed interrupts have static interrupt vector which are defined for each priority separately.
101
* These vectors have jump instruction to the interrupt handler.
102
*
103
* Advantages:\n
104
* This mechanism has less interrupt latency time.
105
*
106
* \subsection IfxLld_Cpu_Irq_SWManaged Software Managed Interrupt Mechanism.
107
* Software managed interrupts have single interrupt vector statically defined at vector position 255.
108
* This address is assigned to BIV during startup.\n
109
* For Tricore, this vector position is important, because whenever an interrupt occurs, with whichever priority,
110
* the execution control jumps to this vector position. The code at this vector position will:\n
111
* 1) fetch the priority of the targetted interrupt.\n
112
* 2) fetch the interrupt handler defined for this priority (this is done by Interrupt handler installation. Refer
113
* \ref IfxLld_Cpu_Irq_Step4\n
114
* 3) Then call the handler as notmal function call.
115
*
116
* Advantages:\n
117
* This kind of mechanism is useful when project wants to change the handler for an interrupt during runtime.
118
*
119
* Disadvantages:\n
120
* This mechanism has more interrupt latency time.
121
*
122
* of the interrupt and in tand jumps to the function
123
*
124
* \section IfxLld_Cpu_Irq_Steps Steps to use Interrupt Mechanism.
125
* Dependency: Ifx_Compilers, Ifx_Cpu, Ifx_Src, IfxCpu_Irq\n
126
* Following are the steps to use interrupt mechanism.
127
*
128
* \section IfxLld_Cpu_Irq_Step1 Step1: Define Interrupt priorities.
129
* Define priorities of all interrupts with names corresponding to their functionality. It is recommended to define
130
* such priority definitions in single header file, because it is easy to detect if ISR priorities are conflicting.
131
* In Tricore architecture, two Isrs can't have same priority at same point of time.
132
* \note These defines shall be defined without brackets surrounding priority number. (eg. #define PRIO (10) is not allowed)
133
*
134
* In a user defined file eg. Ifx_IntPrioDef.h, placed in folder: 0_AppSw/Tricore/DemoApp:
135
* \code
136
* //file: Ifx_IntPrioDef.h.
137
* #define IFX_INTPRIO_FUNCT1 1
138
* #define IFX_INTPRIO_FUNCT2 2
139
* #define IFX_INTPRIO_FUNCT3 5
140
* #define IFX_INTPRIO_STM0 8
141
* #define IFX_INTPRIO_ADC_FUNC1 10
142
* //etc.
143
* \endcode
144
*
145
* \note !! IMPORTANT !!\n As explained above, the definition with closing bracket around priority number as,
146
* #define IFX_INTPRIO_FUNCT1 (1) will cause compilation error. Because linker sections which are constructed
147
* using such information will also get these brackets included. Which look like ".intvec_tc0_(1)" instead of the
148
* expected ".intvec_tc0_1"\n
149
* Linker sections' definitions are predefined statically in .lsl file,
150
* for all 255 interrupts, with the format ".intvec_tc<vector number>_<interrupt priority>".
151
*
152
* \section IfxLld_Cpu_Irq_Step2 Step2: Define Type of interrupt mechanism.
153
* \subsection IfxLld_Cpu_Irq_HWManaged_Usage To use Hardware Managed Interrupt Mechanism.
154
* Refer \ref IfxLld_Cpu_Irq_HWManaged
155
* If project is designed for hardware managed interrupts, this feature is enabled at the file Ifx_Cfg.h, at path:
156
* 0_Src/0_AppSw/Config/Common/, as shown below. IFX_USE_SW_MANAGED_INT definition must be undefined (i.e. the
157
* statement "#define IFX_USE_SW_MANAGED_INT" shall be commented as below).
158
*
159
* \code
160
* //file: Ifx_Cfg.h
161
*
162
* //#define IFX_USE_SW_MANAGED_INT
163
*
164
* \endcode
165
*
166
* \subsection IfxLld_Cpu_Irq_SWManaged_Usage To use Software Managed Interrupt Mechanism.
167
* Refer \ref IfxLld_Cpu_Irq_SWManaged
168
* If project is designed for software managed interrupts, this feature is enabled at the file Ifx_Cfg.h, at path:
169
* 0_Src/0_AppSw/Config/Common/, as shown below.
170
* IFX_USE_SW_MANAGED_INT definition must be defined.
171
*
172
* \code
173
* //file: Ifx_Cfg.h
174
*
175
* #define IFX_USE_SW_MANAGED_INT
176
*
177
* \endcode
178
*
179
* Software managed interrupts must also install the "Interrupt Handlers" Refer \ref IfxLld_Cpu_Irq_Step4
180
*
181
* \section IfxLld_Cpu_Irq_Step3 Step3: How to define an Interrupt Service routine?
182
* Interrupt service routines or interrupt handlers are defined in driver specific files or application specific
183
* files.
184
*
185
* \code
186
* //file usercode1.c
187
* #include "Compilers.h" // to get the compiler abstracted macros for interrupt definition
188
* #include "Ifx_IntPrioDef.h" // to get the priority numbers
189
*
190
* //define an ISR with name Isr_Stm0 with priority defined by IFX_INTPRIO_STM0
191
* IFX_INTERRUPT (Isr_Stm0, 0, IFX_INTPRIO_STM0)
192
* {
193
* //Isr code here
194
* }
195
* \endcode
196
*
197
* \code
198
* //file usercode2.c
199
* #include "Compilers.h" // to get the compiler abstracted macros for interrupt definition
200
* #include "Ifx_IntPrioDef.h" // to get the priority numbers
201
*
202
* //define an ISR with name Isr_Adc_fun1 with priority defined by IFX_INTPRIO_ADC_FUNC1
203
* IFX_INTERRUPT (Isr_Adc_fun1, 0, IFX_INTPRIO_ADC_FUNC1)
204
* {
205
* //Isr code here
206
* }
207
* \endcode
208
*
209
* \section IfxLld_Cpu_Irq_Step4 Step4: How to install Interrupt Service routine/handler?
210
* This step is not required for HW managed interrupts.\n
211
* Interrupt service routines or interrupt handlers are installed in driver specific files or application specific
212
* files
213
*
214
* \code
215
* //file usermain.c
216
* #include "IfxCpu_Irq.h"
217
* #include "Ifx_IntPrioDef.h" // to get the priority numbers
218
*
219
* void userfunction_init(void)
220
* {
221
* //code for user function init
222
* // :
223
* // :
224
* IfxCpu_Irq_installInterruptHandler (Isr_Stm0, IFX_INTPRIO_STM0);
225
* IfxCpu_Irq_installInterruptHandler (Isr_Adc_fun1, IFX_INTPRIO_ADC_FUNC1);
226
*
227
* // :
228
* }
229
*
230
* \endcode
231
*
232
* \section IfxLld_Cpu_Irq_Step5 Step5: Managing the Service Request Node.
233
* For the interrupt to get activated, interrupt triggers are needed. These triggers are activated by peripheral modules
234
* and corresponding service request node must be\n
235
* 1) Configured with correct priority number\n
236
* 2) The request node must be enabled\n
237
* Refer to \ref IfxLld_Src_Usage
238
*/
239
240
/** \} */
241
#endif
/* IFXCPU_IRQ_H_ */
home
mclld
Libraries
release
iLLD_1_0_0_11_0
src
ifx
TC27xD
Cpu
Irq
IfxCpu_Irq.h
Generated by
1.8.4