iLLD_TC27xC
1.0
IfxStdIf_PwmHl.h
Go to the documentation of this file.
1
/**
2
* \file IfxStdIf_PwmHl.h
3
* \brief Standard interface: Multi-channels, dual-complementary PWM interface
4
* \ingroup IfxStdIf
5
*
6
* \version iLLD_0_1_0_10
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
*
25
* \defgroup library_srvsw_stdif_pwmhl Standard interface: Multi-channels, dual-complementary PWM interface
26
* \ingroup library_srvsw_stdif
27
*
28
* The standard interface pwm high/low (PwmHl) abstract the hardware used for pwm feature. It provide, after proper initialization an hardware
29
* independant way to interact with the PWM functionallity like setting duty cycles, dead time,timer functionalities, ...
30
*
31
* The figure below shows the standard Multi-channels, dual-complementary PWM interface.
32
*
33
* \image html "PwmHl-overview.png" "Standard Multi-channels, dual-complementary PWM interface"
34
*
35
* This PWM interface provides multiple dual-complementary PWM channels.
36
* Each dual-complementary PWM channel is made of two PWM channels, a top channel CCx and a bottom channel COUTx.
37
* The interface implements the \ref library_srvsw_stdif_timer.
38
*
39
* This interface defines the following features:
40
* - Configurable duty cycle from 0% to 100%
41
* - Adjustable dead-time between top and bottom channels
42
* - Center aligned, left aligned, right aligned PWM
43
* - Optional minimal pulse cancellation
44
* - Optional emergency stop
45
* - Configurable signal active state for top and bottom PWM
46
* - Configurable output ports
47
* - Inherit the features from library_srvsw_stdif_timer
48
*
49
* Example of signal generation in center aligned mode:
50
*
51
* \image html "PwmHl-centerAligned.png" "Standard Multi-channels, dual-complementary PWM interface - Center aligned mode"
52
*/
53
54
#ifndef IFXSTDIF_PWMHL_H_
55
#define IFXSTDIF_PWMHL_H_ 1
56
57
#include "
IfxStdIf.h
"
58
#include "
IfxStdIf_Timer.h
"
59
60
/** \brief Forward declaration */
61
typedef
struct
IfxStdIf_PwmHl_
IfxStdIf_PwmHl
;
62
63
/** \brief Set the dead time in s
64
* \param driver Pointer to the interface driver object
65
* \param deadtime deadtime in second
66
* \retval TRUE In case of success
67
* \retval FALSE In case of failure
68
*/
69
typedef
boolean
(*
IfxStdIf_PwmHl_SetDeadtime
)(
IfxStdIf_InterfaceDriver
driver
,
float32
deadtime);
70
71
/** \brief Return the dead time in s
72
*
73
* It returns the last dead time values set by IfxStdIf_PwmHl_SetDeadtime() or during initialisation
74
* \param driver Pointer to the interface driver object
75
* \return Returns the deadtime in second
76
*/
77
typedef
float32
(*
IfxStdIf_PwmHl_GetDeadtime
)(
IfxStdIf_InterfaceDriver
driver
);
78
79
/** \brief Set the minimum pulse time in s
80
* \param driver Pointer to the interface driver object
81
* \param minPulse minimal pulse in second
82
* \retval TRUE In case of success
83
* \retval FALSE In case of failure
84
*/
85
typedef
boolean
(*
IfxStdIf_PwmHl_SetMinPulse
)(
IfxStdIf_InterfaceDriver
driver
,
float32
minPulse);
86
87
/** \brief Return the minimum pulse time in s
88
*
89
* It returns the last minimum pulse time values set by IfxStdIf_PwmHl_SetMinPulse() or during initialisation
90
* \param driver Pointer to the interface driver object
91
* \return Returns the minimum pulse time in second
92
*/
93
typedef
float32
(*
IfxStdIf_PwmHl_GetMinPulse
)(
IfxStdIf_InterfaceDriver
driver
);
94
95
/** \brief Return the PWM mode
96
*
97
* It returns the last pwm mode set by IfxStdIf_PwmHl_SetMode() or during initialisation
98
* \param driver Pointer to the interface driver object
99
* \return Returns the pwm mode
100
*/
101
typedef
Ifx_Pwm_Mode
(*
IfxStdIf_PwmHl_GetMode
)(
IfxStdIf_InterfaceDriver
driver
);
102
103
/** \brief Set the pwm mode
104
* \param driver Pointer to the interface driver object
105
* \param mode PWM mode
106
* \retval TRUE In case of success
107
* \retval FALSE In case of failure (feature not supported)
108
*/
109
typedef
boolean
(*
IfxStdIf_PwmHl_SetMode
)(
IfxStdIf_InterfaceDriver
driver
,
Ifx_Pwm_Mode
mode);
110
111
/** \brief Set the pwm ON time
112
* \param driver Pointer to the interface driver object
113
* \param tOn Pointer to an array of ON times in ticks. The array size must be equal to the number of PWM channels
114
* \return none
115
*/
116
typedef
void (*
IfxStdIf_PwmHl_SetOnTime
)(
IfxStdIf_InterfaceDriver
driver
,
Ifx_TimerValue
*tOn);
117
118
/** \brief Set channels which are generating PWM or in "stuck-at" state.
119
*
120
* \param driver Pointer to the interface driver object
121
* \param activeCh Pointer to boolean array containing values for PWM channels.
122
* If FALSE, the channel will be in stuck-at state, else the channel will generate PWM.
123
*
124
* \param stuckSt Pointer to boolean array containing values for active channels.
125
* If FALSE, the stuck-at state is passive level, else the stuck-at state is active level.
126
*
127
* \note The values for the parameters are arranged as follows:
128
* index = 0 --> phase 0 top
129
* index = 1 --> phase 0 bottom
130
* index = 2 --> phase 1 top
131
* index = 3 --> phase 1 bottom
132
* index = 4 --> phase 2 top
133
* index = 5 --> phase 2 bottom
134
*/
135
typedef
void (*
IfxStdIf_PwmHl_SetupChannels
)(
IfxStdIf_InterfaceDriver
driver
,
boolean
*activeCh,
boolean
*stuckSt);
136
137
/** \brief Standard interface object
138
*/
139
struct
IfxStdIf_PwmHl_
140
{
141
IfxStdIf_InterfaceDriver
driver
;
/**< \brief Interface driver object */
142
143
/* PWM related APIs*/
144
IfxStdIf_PwmHl_SetDeadtime
setDeadtime
;
/**< \brief IfxStdIf_PwmHl_SetDeadtime */
145
IfxStdIf_PwmHl_GetDeadtime
getDeadtime
;
/**< \brief IfxStdIf_PwmHl_GetDeadtime */
146
IfxStdIf_PwmHl_SetMinPulse
setMinPulse
;
/**< \brief IfxStdIf_PwmHl_SetMinPulse */
147
IfxStdIf_PwmHl_GetMinPulse
getMinPulse
;
/**< \brief IfxStdIf_PwmHl_GetMinPulse */
148
IfxStdIf_PwmHl_GetMode
getMode
;
/**< \brief IfxStdIf_PwmHl_GetMode */
149
IfxStdIf_PwmHl_SetMode
setMode
;
/**< \brief IfxStdIf_PwmHl_SetMode */
150
IfxStdIf_PwmHl_SetOnTime
setOnTime
;
/**< \brief IfxStdIf_PwmHl_SetOnTime */
151
IfxStdIf_PwmHl_SetupChannels
setupChannels
;
/**< \brief IfxStdIf_PwmHl_SetupChannels */
152
153
IfxStdIf_Timer
timer
;
/**< \brief Timer related standard interface */
154
};
155
156
/** \brief Multi-channels PWM object configuration */
157
typedef
struct
158
{
159
float32
deadtime
;
/**< \brief Dead time between the top and bottom channels in seconds */
160
float32
minPulse
;
/**< \brief Min pulse allowed as active state for the top and bottom PWM in seconds */
161
uint8
channelCount
;
/**< \brief Number of PWM channels, one channel is made of a top and bottom channel */
162
boolean
emergencyEnabled
;
/**< \brief Specifies if the emergency stop should be enabled or not */
163
164
IfxPort_OutputMode
outputMode
;
/**< \brief Output mode of ccx and coutx pins */
165
IfxPort_PadDriver
outputDriver
;
/**< \brief Output pad driver of ccx and coutx pins */
/* FIXME use generic type (No specific tricore AURIX type ) */
166
167
Ifx_ActiveState
ccxActiveState
;
/**< \brief Top PWM active state */
168
Ifx_ActiveState
coutxActiveState
;
/**< \brief Bottom PWM active state */
169
}
IfxStdIf_PwmHl_Config
;
170
171
/** \addtogroup library_srvsw_stdif_pwmhl
172
* \{
173
*/
174
175
/** \copydoc IfxStdIf_PwmHl_SetDeadtime */
176
IFX_INLINE
boolean
IfxStdIf_PwmHl_setDeadtime
(
IfxStdIf_PwmHl
*stdIf,
float32
deadtime)
177
{
178
return
stdIf->
setDeadtime
(stdIf->
driver
, deadtime);
179
}
180
181
182
/** \copydoc IfxStdIf_PwmHl_GetDeadtime */
183
IFX_INLINE
float32
IfxStdIf_PwmHl_getDeadtime
(
IfxStdIf_PwmHl
*stdIf)
184
{
185
return
stdIf->
getDeadtime
(stdIf->
driver
);
186
}
187
188
189
/** \copydoc IfxStdIf_PwmHl_SetMinPulse */
190
IFX_INLINE
boolean
IfxStdIf_PwmHl_setMinPulse
(
IfxStdIf_PwmHl
*stdIf,
float32
minPulse)
191
{
192
return
stdIf->
setMinPulse
(stdIf->
driver
, minPulse);
193
}
194
195
196
/** \copydoc IfxStdIf_PwmHl_GetMinPulse */
197
IFX_INLINE
float32
IfxStdIf_PwmHl_getMinPulse
(
IfxStdIf_PwmHl
*stdIf)
198
{
199
return
stdIf->
getMinPulse
(stdIf->
driver
);
200
}
201
202
203
/** \copydoc IfxStdIf_PwmHl_GetMode */
204
IFX_INLINE
Ifx_Pwm_Mode
IfxStdIf_PwmHl_getMode
(
IfxStdIf_PwmHl
*stdIf)
205
{
206
return
stdIf->
getMode
(stdIf->
driver
);
207
}
208
209
210
/** \copydoc IfxStdIf_PwmHl_SetMode */
211
IFX_INLINE
boolean
IfxStdIf_PwmHl_setMode
(
IfxStdIf_PwmHl
*stdIf,
Ifx_Pwm_Mode
mode)
212
{
213
return
stdIf->
setMode
(stdIf->
driver
, mode);
214
}
215
216
217
/** \copydoc IfxStdIf_PwmHl_SetOnTime */
218
IFX_INLINE
void
IfxStdIf_PwmHl_setOnTime
(
IfxStdIf_PwmHl
*stdIf,
Ifx_TimerValue
*tOn)
219
{
220
stdIf->
setOnTime
(stdIf->
driver
, tOn);
221
}
222
223
224
/** \copydoc IfxStdIf_PwmHl_SetupChannels */
225
IFX_INLINE
void
IfxStdIf_PwmHl_setupChannels
(
IfxStdIf_PwmHl
*driver,
boolean
*activeCh,
boolean
*stuckSt)
226
{}
227
228
/** \brief Return the timer standard interface used by the IfxStdIf_PwmHl standard interface
229
* \param stdIf pointer to the IfxStdIf_PwmHl object
230
* \return Returns the pointer to the IfxStdIf_Timer object
231
*/
232
IFX_INLINE
IfxStdIf_Timer
*
IfxStdIf_PwmHl_getTimer
(
IfxStdIf_PwmHl
*stdIf)
233
{
234
return
&stdIf->
timer
;
235
}
236
237
238
/** \} */
239
240
/** Initialize the configuration structure to default
241
*
242
* \param config Timer configuration. This parameter is initialised by the function
243
*
244
*/
245
IFX_EXTERN
void
IfxStdIf_PwmHl_initConfig
(
IfxStdIf_PwmHl_Config
*config);
246
247
#endif
/* IFXSTDIF_PWMHL_H_ */
home
mclld
Libraries
release
iLLD_0_1_0_10
src
ifx
SrvSw
StdIf
IfxStdIf_PwmHl.h
Generated by
1.8.4