iLLD_TC27xC  1.0
IfxGtm_Atom_PwmHl.h
Go to the documentation of this file.
1 /**
2  * \file IfxGtm_Atom_PwmHl.h
3  * \brief _ATOM PWMHL details
4  * \ingroup IfxLld_Gtm
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  * \defgroup IfxLld_Gtm_Atom_PwmHl_Usage How to use the GTM ATOM PWM Driver
25  * \ingroup IfxLld_Gtm_Atom_PwmHl
26  *
27  * This driver implements the PWM functionalities as defined by \ref library_srvsw_stdif_pwmhl.
28  * The user is free to use either the driver specific APIs below or to used the \ref library_srvsw_stdif_pwmhl "standard interface APIs".
29  *
30  * \section Specific Specific implementation
31  * Implementation is similar to \ref IfxLld_Gtm_Tom_PwmHl
32  *
33  * \todo add documentation
34  *
35  * For a detailed configuration of the microcontroller, see \ref IfxGtm_Atom_PwmHl_init().
36  *
37  * \section Example Usage example
38  * Initialisation is done by, e.g:
39  * \code
40  * IfxGtm_Atom_PwmHl_Config driverConfig;
41  * IfxGtm_Atom_PwmHl driverData;
42  * IfxStdIf_PwmHl pwmhl;
43  * IfxGtm_Atom_PwmHl_initConfig(&driverConfig, &MODULE_GTM);
44  * IfxGtm_Atom_PwmHl_init(&driverData, &driverConfig);
45  * IfxGtm_Atom_PwmHl_stdIfPwmHlInit(pwmhl, &driverData);
46  * \endcode
47  *
48  * During run-time, \ref library_srvsw_stdif_pwmhl "the interface functions" shall be used, e.g.:
49  * \code
50  * IfxStdIf_Timer* timer = IfxStdIf_PwmHl_getTimer(pwmhl);
51  * Ifx_TimerValue onTime[3]; // assume configured for three HL channels
52  *
53  * onTime[0] = 10;
54  * onTime[1] = 20;
55  * onTime[2] = 30;
56  *
57  * IfxStdIf_Timer_disableUpdate(timer);
58  * IfxStdIf_Timer_setPeriod(timer, period);
59  * IfxStdIf_PwmHl_setOnTime(pwmhl, onTime);
60  * IfxStdIf_Timer_applyUpdate(timer);
61  * \endcode
62  *
63  *
64  *
65  * \defgroup IfxLld_Gtm_Atom_PwmHl ATOM PWM Interface Driver
66  * \ingroup IfxLld_Gtm_Atom
67  * \defgroup IfxLld_Gtm_Atom_PwmHl_Data_Structures Data Structures
68  * \ingroup IfxLld_Gtm_Atom_PwmHl
69  * \defgroup IfxLld_Gtm_Atom_PwmHl_PwmHl_Functions PwmHl Functions
70  * \ingroup IfxLld_Gtm_Atom_PwmHl
71  * \defgroup IfxLld_Gtm_Atom_PwmHl_PwmHl_StdIf_Functions PwmHl StdIf Functions
72  * \ingroup IfxLld_Gtm_Atom_PwmHl
73  */
74 
75 #ifndef IFXGTM_ATOM_PWMHL_H
76 #define IFXGTM_ATOM_PWMHL_H 1
77 
78 /******************************************************************************/
79 /*----------------------------------Includes----------------------------------*/
80 /******************************************************************************/
81 
82 #include "StdIf/IfxStdIf_PwmHl.h"
84 
85 /******************************************************************************/
86 /*-----------------------------------Macros-----------------------------------*/
87 /******************************************************************************/
88 
89 /** \brief Maximal number of channels handled by the driver. One channel has a top and bottom pwm output
90  */
91 #define IFXGTM_ATOM_PWMHL_CH_MAX_CHANNELS (8)
92 
93 /******************************************************************************/
94 /*------------------------------Type Definitions------------------------------*/
95 /******************************************************************************/
96 
98 
100 
101 /******************************************************************************/
102 /*-----------------------------Data Structures--------------------------------*/
103 /******************************************************************************/
104 
105 /** \addtogroup IfxLld_Gtm_Atom_PwmHl_Data_Structures
106  * \{ */
107 /** \brief Multi-channels PWM object definition (channels only)
108  */
109 typedef struct
110 {
111  Ifx_TimerValue deadtime; /**< \brief Dead time between the top and bottom channel in ticks */
112  Ifx_TimerValue minPulse; /**< \brief minimum pulse that is output, shorter pulse time will be output as 0% duty cycle */
113  Ifx_TimerValue maxPulse; /**< \brief internal parameter */
114  Ifx_Pwm_Mode mode; /**< \brief actual PWM mode */
115  sint8 setMode; /**< \brief A non zero flag indicates that the PWM mode is being modified */
116  Ifx_ActiveState ccxActiveState; /**< \brief Top PWM active state */
117  Ifx_ActiveState coutxActiveState; /**< \brief Bottom PWM active state */
118  boolean inverted; /**< \brief Flag indicating the center aligned inverted mode (TRUE) */
119  uint8 channelCount; /**< \brief Number of PWM channels, one channel is made of a top and bottom channel */
121 
122 /** \} */
123 
124 /** \addtogroup IfxLld_Gtm_Atom_PwmHl_Data_Structures
125  * \{ */
126 /** \brief GTM ATOM: PWM HL configuration
127  */
128 typedef struct
129 {
130  IfxStdIf_PwmHl_Config base; /**< \brief PWM HL standard interface configuration */
131  IfxGtm_Atom_Timer *timer; /**< \brief Pointer to the linked timer object */
132  IfxGtm_Atom atom; /**< \brief ATOM unit used */
133  const IfxGtm_Atom_ToutMapP *ccx; /**< \brief Pointer to an array of size pwmHl.channels.channelCount containing the channels used. Channels must be adjacent channels */
134  const IfxGtm_Atom_ToutMapP *coutx; /**< \brief Pointer to an array of size pwmHl.channels.channelCount containing the channels used. Channels must be adjacent channels */
136 
137 /** \brief Structure for PWM configuration
138  */
139 typedef struct
140 {
141  boolean inverted; /**< \brief Inverted configuration for the selected mode */
142  IfxGtm_Atom_PwmHl_Update update; /**< \brief update call back function for the selected mode */
144 
145 /** \brief GTM ATOM PWM driver
146  */
148 {
149  IfxGtm_Atom_PwmHl_Base base; /**< \brief Multi-channels PWM object definition (channels only) */
150  IfxGtm_Atom_Timer *timer; /**< \brief Pointer to the linked timer object */
151  IfxGtm_Atom_PwmHl_Update update; /**< \brief Update function for actual selected mode */
152  Ifx_GTM_ATOM *atom; /**< \brief ATOM unit used */
153  Ifx_GTM_ATOM_AGC *agc; /**< \brief AGC unit used */
154  IfxGtm_Atom_Ch ccx[IFXGTM_ATOM_PWMHL_CH_MAX_CHANNELS]; /**< \brief ATOM channels used for the CCCX outputs */
155  IfxGtm_Atom_Ch coutx[IFXGTM_ATOM_PWMHL_CH_MAX_CHANNELS]; /**< \brief ATOM channels used for the OUTX outputs */
156  IfxGtm_Atom_Ch *ccxTemp; /**< \brief cached value */
157  IfxGtm_Atom_Ch *coutxTemp; /**< \brief cached value */
158 };
159 
160 /** \} */
161 
162 /** \addtogroup IfxLld_Gtm_Atom_PwmHl_PwmHl_Functions
163  * \{ */
164 
165 /******************************************************************************/
166 /*-------------------------Global Function Prototypes-------------------------*/
167 /******************************************************************************/
168 
169 /** \brief Initializes the timer object
170  * note To ensure that the channels counter are reset by the timer and do not overflow, leading to random signal on the output, the timer must be started before the call to this function.
171  * \param driver GTM ATOM PWM driver
172  * \param config GTM ATOM: PWM HL configuration
173  * \return TRUE on success else FALSE
174  */
176 
177 /** \brief Initialize the configuration structure to default
178  * \param config Channel configuration. This parameter is Initialised by the function
179  * \return None
180  */
182 
183 /** \} */
184 
185 /** \addtogroup IfxLld_Gtm_Atom_PwmHl_PwmHl_StdIf_Functions
186  * \{ */
187 
188 /******************************************************************************/
189 /*-------------------------Global Function Prototypes-------------------------*/
190 /******************************************************************************/
191 
192 /** \brief Returns the dead time
193  * \param driver GTM ATOM PWM driver
194  * \return Dead Time
195  */
197 
198 /** \brief Returns the minimum pulse
199  * \param driver GTM ATOM PWM driver
200  * \return Min Pulse
201  */
203 
204 /** \brief Returns Pwm mode
205  * \param driver GTM ATOM PWM driver
206  * \return Pwm mode
207  */
209 
210 /** \brief Sets the dead time
211  * \param driver GTM ATOM PWM driver
212  * \param deadtime Dead time value
213  * \return TRUE on success else FALSE
214  */
216 
217 /** \brief Sets the minimum pulse
218  * \param driver GTM ATOM PWM driver
219  * \param minPulse Minimum pulse
220  * \return TRUE on success else FALSE
221  */
223 
224 /** \brief Sets the PWM mode, the mode is only applied after setOnTime() + applyUpdate()
225  * \param driver GTM ATOM PWM driver
226  * \param mode Pwm mode
227  * \return TRUE on success else FALSE
228  */
230 
231 /** \brief Sets the ON time
232  * \param driver GTM ATOM PWM driver
233  * \param tOn ON time
234  * \return None
235  */
237 
238 /** \brief Set up channels
239  * \param driver GTM ATOM PWM driver
240  * \param activeCh Active channel
241  * \param stuckSt Stuck state
242  * \return None
243  */
244 IFX_EXTERN void IfxGtm_Atom_PwmHl_setupChannels(IfxGtm_Atom_PwmHl *driver, boolean *activeCh, boolean *stuckSt);
245 
246 /** \brief Initialises the statndard interface Pwm
247  * \param stdif Standard interface object
248  * \param driver GTM ATOM PWM driver
249  * \return TRUE on success else FALSE
250  */
252 
253 /** \} */
254 
255 #endif /* IFXGTM_ATOM_PWMHL_H */