iLLD_TC27xC
1.0
IfxCpu_Trap.c
Go to the documentation of this file.
1
/**
2
* \file IfxCpu_Trap.c
3
* \brief This file contains the APIs for Trap related functions.
4
*
5
*
6
* \version iLLD_0_1_0_10
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
*
25
*/
26
27
/*******************************************************************************
28
** Includes **
29
*******************************************************************************/
30
#include "
IfxCpu_Trap.h
"
31
#include "
Cpu/Std/IfxCpu.h
"
32
#include "
Cpu/Std/IfxCpu_Intrinsics.h
"
33
#include "IfxCpu_reg.h"
34
#include "Ifx_Cfg.h"
35
#ifdef IFX_CFG_EXTEND_TRAP_HOOKS
36
#include "Ifx_Cfg_Trap.h"
37
#endif
38
39
/******************************************************************************/
40
/* Macros */
41
/******************************************************************************/
42
/** \brief Configuration for CpuX enable.
43
*
44
*/
45
#ifndef IFX_CFG_CPU_TRAP_TSR_HOOK
46
# define IFX_CFG_CPU_TRAP_TSR_HOOK(trapWatch)
/**< By default macro is empty*/
47
#endif
48
#ifndef IFX_CFG_CPU_TRAP_SYSCALL_CPU0_HOOK
49
# define IFX_CFG_CPU_TRAP_SYSCALL_CPU0_HOOK(trapWatch)
/**< By default macro is empty*/
50
#endif
51
#ifndef IFX_CFG_CPU_TRAP_SYSCALL_CPU1_HOOK
52
# define IFX_CFG_CPU_TRAP_SYSCALL_CPU1_HOOK(trapWatch)
/**< By default macro is empty*/
53
#endif
54
#ifndef IFX_CFG_CPU_TRAP_SYSCALL_CPU2_HOOK
55
# define IFX_CFG_CPU_TRAP_SYSCALL_CPU2_HOOK(trapWatch)
/**< By default macro is empty*/
56
#endif
57
58
/*******************************************************************************
59
** variables **
60
*******************************************************************************/
61
IfxCpu_Trap
trapWatch
;
62
63
/*******************************************************************************
64
** Function definitions **
65
*******************************************************************************/
66
67
68
69
IFX_INLINE
IfxCpu_Trap
IfxCpu_Trap_extractTrapInfo
(
uint8
trapClass,
uint32
tin)
70
{
71
IfxCpu_Trap
trapInfo;
72
trapInfo.
tClass
= trapClass;
73
trapInfo.
tId
= tin;
74
trapInfo.
tCpu
=
IfxCpu_getCoreId
();
75
return
trapInfo;
76
}
77
78
79
void
IfxCpu_Trap_memoryManagementError
(
uint32
tin)
80
{
81
trapWatch =
IfxCpu_Trap_extractTrapInfo
(
IfxCpu_Trap_Class_memoryManagement
, tin);
82
IFX_CFG_CPU_TRAP_TSR_HOOK
(trapWatch);
83
__debug
();
84
__asm(
"rfe"
);
85
}
86
87
88
void
IfxCpu_Trap_internalProtectionError
(
uint32
tin)
89
{
90
trapWatch =
IfxCpu_Trap_extractTrapInfo
(
IfxCpu_Trap_Class_internalProtection
, tin);
91
IFX_CFG_CPU_TRAP_TSR_HOOK
(trapWatch);
92
__debug
();
93
__asm(
"rfe"
);
94
}
95
96
97
void
IfxCpu_Trap_instructionError
(
uint32
tin)
98
{
99
trapWatch =
IfxCpu_Trap_extractTrapInfo
(
IfxCpu_Trap_Class_instructionErrors
, tin);
100
IFX_CFG_CPU_TRAP_TSR_HOOK
(trapWatch);
101
__debug
();
102
__asm(
"rfe"
);
103
}
104
105
106
void
IfxCpu_Trap_contextManagementError
(
uint32
tin)
107
{
108
trapWatch =
IfxCpu_Trap_extractTrapInfo
(
IfxCpu_Trap_Class_contextManagement
, tin);
109
IFX_CFG_CPU_TRAP_TSR_HOOK
(trapWatch);
110
__debug
();
111
__asm(
"rfe"
);
112
}
113
114
115
void
IfxCpu_Trap_busError
(
uint32
tin)
116
{
117
trapWatch =
IfxCpu_Trap_extractTrapInfo
(
IfxCpu_Trap_Class_bus
, tin);
118
IFX_CFG_CPU_TRAP_TSR_HOOK
(trapWatch);
119
__debug
();
120
__asm(
"rfe"
);
121
}
122
123
124
void
IfxCpu_Trap_assertion
(
uint32
tin)
125
{
126
trapWatch =
IfxCpu_Trap_extractTrapInfo
(
IfxCpu_Trap_Class_assertion
, tin);
127
IFX_CFG_CPU_TRAP_TSR_HOOK
(trapWatch);
128
__debug
();
129
__asm(
"rfe"
);
130
}
131
132
133
void
IfxCpu_Trap_systemCall_Cpu0
(
uint32
tin)
134
{
135
trapWatch =
IfxCpu_Trap_extractTrapInfo
(
IfxCpu_Trap_Class_systemCall
, tin);
136
IFX_CFG_CPU_TRAP_SYSCALL_CPU0_HOOK
(trapWatch);
137
__asm(
"rfe"
);
138
}
139
140
141
void
IfxCpu_Trap_systemCall_Cpu1
(
uint32
tin)
142
{
143
trapWatch =
IfxCpu_Trap_extractTrapInfo
(
IfxCpu_Trap_Class_systemCall
, tin);
144
IFX_CFG_CPU_TRAP_SYSCALL_CPU1_HOOK
(trapWatch);
145
__asm(
"rfe"
);
146
}
147
148
149
void
IfxCpu_Trap_systemCall_Cpu2
(
uint32
tin)
150
{
151
trapWatch =
IfxCpu_Trap_extractTrapInfo
(
IfxCpu_Trap_Class_systemCall
, tin);
152
IFX_CFG_CPU_TRAP_SYSCALL_CPU2_HOOK
(trapWatch);
153
__asm(
"rfe"
);
154
}
155
156
157
void
IfxCpu_Trap_nonMaskableInterrupt
(
uint32
tin)
158
{
159
trapWatch =
IfxCpu_Trap_extractTrapInfo
(
IfxCpu_Trap_Class_nonMaskableInterrupt
, tin);
160
IFX_CFG_CPU_TRAP_TSR_HOOK
(trapWatch);
161
__debug
();
162
__asm(
"rfe"
);
163
}
164
165
166
#if defined(__GNUC__)
167
#pragma section
168
#pragma section ".traptab_cpu0" awx
169
#endif
170
#if defined(__DCC__)
171
#pragma section
172
#pragma section CODE ".traptab_cpu0" X
173
#endif
174
#if defined(__TASKING__)
175
#pragma protect on
176
#pragma section code "traptab_cpu0"
177
#endif
178
179
void
IfxCpu_Trap_vectorTable0
(
void
)
180
{
181
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_memoryManagementError
);
182
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_internalProtectionError
);
183
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_instructionError
);
184
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_contextManagementError
);
185
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_busError
);
186
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_assertion
);
187
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_systemCall_Cpu0
);
188
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_nonMaskableInterrupt
);
189
}
190
191
192
#if IFXCPU_COUNT >= 2
193
#if defined(__GNUC__)
194
#pragma section
195
#pragma section ".traptab_cpu1" awx
196
#endif
197
#if defined(__DCC__)
198
#pragma section
199
#pragma section CODE ".traptab_cpu1" X
200
#endif
201
#if defined(__TASKING__)
202
#pragma section code "traptab_cpu1"
203
#endif
204
205
void
IfxCpu_Trap_vectorTable1(
void
)
206
{
207
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_memoryManagementError
);
208
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_internalProtectionError
);
209
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_instructionError
);
210
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_contextManagementError
);
211
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_busError
);
212
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_assertion
);
213
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_systemCall_Cpu1
);
214
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_nonMaskableInterrupt
);
215
}
216
#endif
217
218
219
#if IFXCPU_COUNT >= 3
220
#if defined(__GNUC__)
221
#pragma section
222
#pragma section ".traptab_cpu2" awx
223
#endif
224
#if defined(__DCC__)
225
#pragma section
226
#pragma section CODE ".traptab_cpu2" X
227
#endif
228
#if defined(__TASKING__)
229
#pragma section code "traptab_cpu2"
230
#endif
231
232
void
IfxCpu_Trap_vectorTable2(
void
)
233
{
234
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_memoryManagementError
);
235
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_internalProtectionError
);
236
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_instructionError
);
237
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_contextManagementError
);
238
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_busError
);
239
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_assertion
);
240
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_systemCall_Cpu2
);
241
IfxCpu_Tsr_CallTSR(
IfxCpu_Trap_nonMaskableInterrupt
);
242
}
243
#endif
244
245
246
#if defined(__GNUC__)
247
#pragma section
248
#endif
249
#if defined(__DCC__)
250
#pragma section
251
#endif
252
#if defined(__DCC__)
253
#pragma interrupt IfxInterruptEx
254
#endif
255
#if defined(__TASKING__)
256
#pragma endprotect
257
#endif
home
mclld
Libraries
release
iLLD_0_1_0_10
src
ifx
TC27xC
Cpu
Trap
IfxCpu_Trap.c
Generated by
1.8.4