iLLD_TC29x
1.0
IfxSrc.h
Go to the documentation of this file.
1
/**
2
* \file IfxSrc.h
3
* \brief SRC basic functionality
4
* \ingroup IfxLld_Src
5
*
6
* \version iLLD_1_0_0_11_0
7
* \copyright Copyright (c) 2013 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_Src SRC
25
* \addtogroup IfxLld_Src
26
* \{
27
* \defgroup IfxLld_Src_Usage How to use Service Request Mechanism?
28
* \addtogroup IfxLld_Src_Usage
29
* \{
30
*
31
* For Aurix controller peripherals that can generate service requests is connected to one
32
* or more Service Request Nodes (SRNs) in the central Interrupt Router(IR) module. Refer to Controller User Manual for more details\n
33
*
34
* IfxSrc driver provides the APIs to configure and control service requests. Refer \ref IfxLld_Src_Usage for
35
* details of these APIs.
36
*
37
*
38
* \section Ifx_Src_UsageInit Initialize the Service Request Node
39
*
40
* Service request node is initialized to configure the following,\n
41
* 1) Route the interrupt trigger to service provider, which are:\n
42
* __a. One of the available CPUs or\n
43
* __b. DMA controller\n
44
*
45
* 2) Priority of CPU Interrupt or DMA Trigger.
46
*
47
* For Interrupt or DMA to be correctly triggered, following steps are to be done in the user code:
48
*
49
* \subsection Ifx_Src_UsageInitStep1 Step1: Configure the Node
50
*
51
* User must configure the service request node in the application / driver files.
52
*
53
* \subsection Ifx_Src_UsageInitStep2 Step2: Enable the Trigger
54
*
55
* Enable the service request node to connect the trigger event from the hardware to service provider.
56
*
57
* Example:
58
* Following example show the configuration for STM0 Service request 0 trigger configured to trigger
59
* CPU1 with the priority specified by IFX_INTPRIO_STM0 (from the example at IfxCpu_Irq)
60
*
61
* \code
62
* //file: myApplication.c
63
*
64
* #include "Ifx_IntPrioDef.h" // to get the priority numbers
65
*
66
* void myDriverInitFunction(void)
67
* {
68
* // driver init code
69
*
70
* // Step1: Call the function to route the trigger from for SRC_STM0_SR0 to CPU1
71
* // and priority specified at Ifx_IntPrioDef.h globally
72
* IfxSrc_init(&MODULE_SRC.STM.STM[0].SR[0], IfxSrc_Tos_cpu1, IFX_INTPRIO_STM0);
73
*
74
* // Step2: Enable the service request node
75
* IfxSrc_enable(&MODULE_SRC.STM.STM[0].SR[0]);
76
* }
77
* \endcode
78
*
79
* \}
80
* \}
81
*
82
* \defgroup IfxLld_Src_Std_Service_Request Service Request Functions
83
* \ingroup IfxLld_Src_Std
84
* \defgroup IfxLld_Src_Std_Module Module Functions
85
* \ingroup IfxLld_Src_Std
86
*/
87
88
#ifndef IFXSRC_H
89
#define IFXSRC_H 1
90
91
/******************************************************************************/
92
/*----------------------------------Includes----------------------------------*/
93
/******************************************************************************/
94
95
#include "
_Impl/IfxSrc_cfg.h
"
96
#include "
Cpu/Std/IfxCpu_Intrinsics.h
"
97
#include "IfxSrc_reg.h"
98
/** \addtogroup IfxLld_Src_Std_Service_Request
99
* \{ */
100
101
/******************************************************************************/
102
/*-------------------------Inline Function Prototypes-------------------------*/
103
/******************************************************************************/
104
105
/** \brief Resets the overrun flag of the Service Request.
106
* \param src pointer to the Service Request Control register which the overrun flag should be cleared.
107
* \return None
108
*
109
* Usage example: see \ref IfxSrc_init
110
*
111
*/
112
IFX_INLINE
void
IfxSrc_clearOverrun
(
volatile
Ifx_SRC_SRCR *src);
113
114
/** \brief Resets a specific interrupt service by software.
115
* \param src pointer to the Service Request Control register which the request should be cleared.
116
* \return None
117
*
118
* Usage example: see \ref IfxSrc_init
119
*
120
*/
121
IFX_INLINE
void
IfxSrc_clearRequest
(
volatile
Ifx_SRC_SRCR *src);
122
123
/** \brief Gets the current overrun status.
124
* \param src pointer to the Service Request Control register for which the overrun status should be returned.
125
* \return current service request control overrun status.
126
*
127
* Usage example: see \ref IfxSrc_init
128
*
129
*/
130
IFX_INLINE
boolean
IfxSrc_isOverrun
(
volatile
Ifx_SRC_SRCR *src);
131
132
/** \brief Gets the current request status.
133
* \param src pointer to the Service Request Control register for which the request status should be returned.
134
* \return current service request control request status.
135
*
136
* Usage example: see \ref IfxSrc_init
137
*
138
*/
139
IFX_INLINE
boolean
IfxSrc_isRequested
(
volatile
Ifx_SRC_SRCR *src);
140
141
/** \brief Requests a specific interrupt service by software
142
* \param src pointer to the Service Request Control register which the interrupt has to be requested.
143
* \return None
144
*
145
* Usage example: see \ref IfxSrc_init
146
*
147
*/
148
IFX_INLINE
void
IfxSrc_setRequest
(
volatile
Ifx_SRC_SRCR *src);
149
150
/** \} */
151
152
/** \addtogroup IfxLld_Src_Std_Module
153
* \{ */
154
155
/******************************************************************************/
156
/*-------------------------Inline Function Prototypes-------------------------*/
157
/******************************************************************************/
158
159
/** \brief DeInitializes the service request control register.
160
* \param src pointer to the Service Request Control register which should be deinitialised.
161
* \return None
162
*
163
* Usage example: see \ref IfxSrc_init
164
*
165
*/
166
IFX_INLINE
void
IfxSrc_deinit
(
volatile
Ifx_SRC_SRCR *src);
167
168
/** \brief Disables a specific interrupt service request.
169
* \param src pointer to the Service Request Control register for which the interrupt has to be disabled.
170
* \return None
171
*
172
* Usage example: see \ref IfxSrc_init
173
*
174
*/
175
IFX_INLINE
void
IfxSrc_disable
(
volatile
Ifx_SRC_SRCR *src);
176
177
/** \brief Enables a specific interrupt service request.
178
* \param src pointer to the Service Request Control register for which the interrupt has to be enabled.
179
* \return None
180
*
181
* Usage example: see \ref IfxSrc_init
182
*
183
*/
184
IFX_INLINE
void
IfxSrc_enable
(
volatile
Ifx_SRC_SRCR *src);
185
186
/** \brief Initializes the service request control register.
187
* \param src pointer to the Service Request Control register which should be initialised.
188
* \param typOfService type of interrupt service provider.
189
* \param priority Interrupt priority.
190
* \return None
191
*
192
* Get the peripheral service control register which request need to be serviced and assign this service to any of service providers.
193
* \code
194
* //define the interrupt priority
195
* #define IFXASCLIN0_TX_INTPRIO 2
196
* //get the service request
197
* volatile Ifx_SRC_SRCR *src = IfxAsclin_getSrcPointerRx( &MODULE_ASCLIN0 );
198
* //initlaise the service request
199
* IfxSrc_init( src, IfxSrc_Tos_cpu0, IFXASCLIN0_TX_INTPRIO );
200
* // enable the service
201
* IfxSrc_enable( src );
202
* //check for service request flags and clear if they occur
203
* if ( IfxSrc_isRequested( src ) == TRUE )
204
* {
205
* IfxSrc_clearRequest( src );
206
* }
207
* if ( IfxSrc_isOverrun( src ) == TRUE )
208
* {
209
* IfxSrc_clearOverrun( src );
210
* }
211
* // Atlast deinitialise the service control
212
* IfxSrc_deinit( src );
213
* \endcode
214
*
215
*/
216
IFX_INLINE
void
IfxSrc_init
(
volatile
Ifx_SRC_SRCR *src,
IfxSrc_Tos
typOfService,
Ifx_Priority
priority);
217
218
/** \} */
219
220
/******************************************************************************/
221
/*---------------------Inline Function Implementations------------------------*/
222
/******************************************************************************/
223
224
IFX_INLINE
void
IfxSrc_clearOverrun
(
volatile
Ifx_SRC_SRCR *src)
225
{
226
src->B.IOVCLR = 1;
227
}
228
229
230
IFX_INLINE
void
IfxSrc_clearRequest
(
volatile
Ifx_SRC_SRCR *src)
231
{
232
src->B.CLRR = 1;
233
}
234
235
236
IFX_INLINE
void
IfxSrc_deinit
(
volatile
Ifx_SRC_SRCR *src)
237
{
238
src->U = 0;
239
}
240
241
242
IFX_INLINE
void
IfxSrc_disable
(
volatile
Ifx_SRC_SRCR *src)
243
{
244
src->B.SRE = 0;
245
}
246
247
248
IFX_INLINE
void
IfxSrc_enable
(
volatile
Ifx_SRC_SRCR *src)
249
{
250
src->B.SRE = 1;
251
}
252
253
254
IFX_INLINE
void
IfxSrc_init
(
volatile
Ifx_SRC_SRCR *src,
IfxSrc_Tos
typOfService,
Ifx_Priority
priority)
255
{
256
src->B.SRPN = priority;
257
src->B.TOS = typOfService;
258
IfxSrc_clearRequest
(src);
259
}
260
261
262
IFX_INLINE
boolean
IfxSrc_isOverrun
(
volatile
Ifx_SRC_SRCR *src)
263
{
264
return
src->B.IOV ?
TRUE
:
FALSE
;
265
}
266
267
268
IFX_INLINE
boolean
IfxSrc_isRequested
(
volatile
Ifx_SRC_SRCR *src)
269
{
270
return
src->B.SRR ?
TRUE
:
FALSE
;
271
}
272
273
274
IFX_INLINE
void
IfxSrc_setRequest
(
volatile
Ifx_SRC_SRCR *src)
275
{
276
src->B.SETR = 1;
277
}
278
279
280
#endif
/* IFXSRC_H */
home
mclld
Libraries
release
iLLD_1_0_0_11_0
src
ifx
TC29x
Src
Std
IfxSrc.h
Generated by
1.8.4