CCU8PWMLIBApp
|
00001 /******************************************************************************* 00002 Copyright (c) 2011, Infineon Technologies AG ** 00003 All rights reserved. ** 00004 ** 00005 Redistribution and use in source and binary forms, with or without ** 00006 modification,are permitted provided that the following conditions are met: ** 00007 ** 00008 *Redistributions of source code must retain the above copyright notice, ** 00009 this list of conditions and the following disclaimer. ** 00010 *Redistributions in binary form must reproduce the above copyright notice, ** 00011 this list of conditions and the following disclaimer in the documentation ** 00012 and/or other materials provided with the distribution. ** 00013 *Neither the name of the copyright holders nor the names of its contributors ** 00014 may be used to endorse or promote products derived from this software without** 00015 specific prior written permission. ** 00016 ** 00017 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** 00018 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** 00019 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** 00020 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE ** 00021 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** 00022 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** 00023 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** 00024 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** 00025 CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** 00026 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ** 00027 POSSIBILITY OF SUCH DAMAGE. ** 00028 ** 00029 To improve the quality of the software, users are encouraged to share ** 00030 modifications, enhancements or bug fixes with Infineon Technologies AG ** 00031 dave@infineon.com). ** 00032 ** 00033 ******************************************************************************** 00034 ** ** 00035 ** ** 00036 ** PLATFORM : Infineon XMC4000 Series ** 00037 ** ** 00038 ** COMPILER : Compiler Independent ** 00039 ** ** 00040 ** AUTHOR : App Developer ** 00041 ** ** 00042 ** MAY BE CHANGED BY USER [yes/no]: Yes ** 00043 ** ** 00044 ** MODIFICATION DATE : Nov 01, 2012 ** 00045 ** ** 00046 *******************************************************************************/ 00047 /******************************************************************************* 00048 ** Author(s) Identity ** 00049 ******************************************************************************** 00050 ** ** 00051 ** Initials Name ** 00052 ** ---------------------------------------------------------------------------** 00053 ** KS App Developer ** 00054 ** ** 00055 *******************************************************************************/ 00056 00067 /******************************************************************************* 00068 ** Include Files ** 00069 *******************************************************************************/ 00070 #include <DAVE3.h> 00071 #include "../../inc/LIBS/CCU8PWMLIB.h" 00079 #ifdef USE_PWM_LIB 00080 /******************************************************************************* 00081 ** Private Function declarations ** 00082 *******************************************************************************/ 00083 /******************************************************************************* 00084 ** Private Function declarations ** 00085 *******************************************************************************/ 00092 void CCU8PWMLIB_lConfigureSecondSlice 00093 ( 00094 const CCU8PWMLIB_HandleType* HandlePtr 00095 ); 00096 00103 status_t CCU8PWMLIB_lSetPwmFreqTimerConcat 00104 ( 00105 const CCU8PWMLIB_HandleType* HandlePtr, 00106 uint32_t PwmTime 00107 ); 00108 00115 /******************************************************************************* 00116 ** Function definitions ** 00117 *******************************************************************************/ 00118 /*<<<DD_CCU8PWMLIB_API_1>>>*/ 00122 status_t CCU8PWMLIB_Init(const CCU8PWMLIB_HandleType* HandlePtr) 00123 { 00124 status_t Status = (uint32_t)DAVEApp_SUCCESS; 00125 uint32_t DeadTimeConfVal[4] = {0x00UL, 0xDUL, 0x5UL, 0x9UL}; 00126 00127 /*Clear the Timer value*/ 00128 HandlePtr->CC8yRegsPtr->TCCLR = (uint32_t)CCU8PWMLIB_SLICE_CLEAR; 00129 HandlePtr->CC8yRegsPtr->TC = 0x00U; 00130 00131 /*<<<DD_CCU8PWMLIB_API_1_3>>>*/ 00132 /* Configure external stop feature */ 00133 if (HandlePtr->kExtStopTrig == (uint8_t)SET) 00134 { 00135 HandlePtr->CC8yRegsPtr->INS &= ~((CCU8_CC8_INS_EV1EM_Msk)| 00136 (CCU8_CC8_INS_LPF1M_Msk)); 00137 HandlePtr->CC8yRegsPtr->CMC &= ~CCU8_CC8_CMC_ENDS_Msk; 00138 00139 HandlePtr->CC8yRegsPtr->INS |= 00140 ((((uint32_t)HandlePtr->kStopEdge << \ 00141 CCU8_CC8_INS_EV1EM_Pos)& CCU8_CC8_INS_EV1EM_Msk) | 00142 ((CCU8PWMLIB_LPF << CCU8_CC8_INS_LPF1M_Pos)& (uint32_t)CCU8_CC8_INS_LPF1M_Msk)); 00143 HandlePtr->CC8yRegsPtr->CMC |= 00144 ((CCU8PWMLIB_EVENT_1 << CCU8_CC8_CMC_ENDS_Pos)& (uint32_t)CCU8_CC8_CMC_ENDS_Msk); 00145 } 00146 00147 /*<<<DD_CCU8PWMLIB_API_1_4>>>*/ 00148 /* Configure trap feature */ 00149 if ((HandlePtr->kTrapEnable == (uint8_t)SET) &&\ 00150 (HandlePtr->kTimerConcatenation != (uint8_t)SET)) 00151 { 00152 HandlePtr->CC8yRegsPtr -> INS &= ~((CCU8_CC8_INS_EV2EM_Msk) |\ 00153 (CCU8_CC8_INS_EV2LM_Msk) | (CCU8_CC8_INS_LPF2M_Msk)); 00154 HandlePtr->CC8yRegsPtr -> INS |= 00155 (((0x00 << CCU8_CC8_INS_EV2EM_Pos)& CCU8_CC8_INS_EV2EM_Msk) | 00156 (((uint32_t)HandlePtr->kTrapLevel << CCU8_CC8_INS_EV2LM_Pos)& CCU8_CC8_INS_EV2LM_Msk) | 00157 ((0x00 << CCU8_CC8_INS_LPF2M_Pos)& CCU8_CC8_INS_LPF2M_Msk)); 00158 HandlePtr->CC8yRegsPtr->CMC |= (0x01 << CCU8_CC8_CMC_TS_Pos); 00159 }/* End of if (HandlePtr->kTrapEnable == (uint8_t)SET)*/ 00160 00161 /* Configure timer counting mode, compare mode, external start, stop controls */ 00162 HandlePtr->CC8yRegsPtr->TC &= ~((CCU8_CC8_TC_TCM_Msk) | 00163 (CCU8_CC8_TC_TSSM_Msk) | (CCU8_CC8_TC_CMOD_Msk) | 00164 (CCU8_CC8_TC_STRM_Msk) | (CCU8_CC8_TC_ENDM_Msk)); 00165 HandlePtr->CC8yRegsPtr->TC =(((uint32_t) 00166 HandlePtr->CountingMode << CCU8_CC8_TC_TCM_Pos)& CCU8_CC8_TC_TCM_Msk)| 00167 ((HandlePtr->kTimerMode << CCU8_CC8_TC_TSSM_Pos)& CCU8_CC8_TC_TSSM_Msk)| 00168 ((CCU8PWMLIB_COMPARE_MODE << CCU8_CC8_TC_CMOD_Pos)& CCU8_CC8_TC_CMOD_Msk)| 00169 (((uint32_t) 00170 HandlePtr->ExtStartConfig << CCU8_CC8_TC_STRM_Pos)& CCU8_CC8_TC_STRM_Msk)| 00171 (((uint32_t) 00172 HandlePtr->ExtStopConfig << CCU8_CC8_TC_ENDM_Pos)& CCU8_CC8_TC_ENDM_Msk); 00173 00174 /*Set the dither mode setting*/ 00175 HandlePtr->CC8yRegsPtr->TC |= 00176 (HandlePtr->kDitherSetting << CCU8_CC8_TC_DITHE_Pos) & CCU8_CC8_TC_DITHE_Msk; 00177 00178 HandlePtr->CC8yRegsPtr->DITS = 00179 (HandlePtr->kDitherCompare << CCU8_CC8_DITS_DCVS_Pos) & CCU8_CC8_DITS_DCVS_Msk; 00180 00181 /*Configure Trap mode*/ 00182 /*<<<DD_CCU8PWMLIB_API_1_6>>>*/ 00183 if(HandlePtr->kTimerConcatenation != (uint8_t)SET) 00184 { 00185 WR_REG(HandlePtr->CC8yRegsPtr->TC, CCU8_CC8_TC_TRPSE_Msk, 00186 CCU8_CC8_TC_TRPSE_Pos, HandlePtr->kTrapSync); 00187 WR_REG(HandlePtr->CC8yRegsPtr->TC, CCU8_CC8_TC_TRPSW_Msk, 00188 CCU8_CC8_TC_TRPSW_Pos, HandlePtr->kTrapExitControl); 00189 } 00190 /*Set the prescalar divider and passive level of the o/p signal.*/ 00191 WR_REG(HandlePtr->CC8yRegsPtr->PSC,CCU8_CC8_PSC_PSIV_Msk, 00192 CCU8_CC8_PSC_PSIV_Pos, HandlePtr->kCCUPrescalar); 00193 HandlePtr->CC8yRegsPtr->PSL = 00194 ((HandlePtr->kPassiveLevel0 << CCU8_CC8_PSL_PSL11_Pos) | 00195 (HandlePtr->kPassiveLevel1 << CCU8_CC8_PSL_PSL12_Pos)); 00196 00197 /*Set the symmetric or asymmetric PWM setting*/ 00198 WR_REG(HandlePtr->CC8yRegsPtr->CHC, CCU8_CC8_CHC_ASE_Msk,\ 00199 CCU8_CC8_CHC_ASE_Pos,(uint32_t)HandlePtr->CompareMode); 00200 00201 /*Configure output connections as per passive state.*/ 00202 HandlePtr->CC8yRegsPtr->CHC &= ~((CCU8_CC8_CHC_OCS2_Msk)|(CCU8_CC8_CHC_OCS2_Msk)); 00203 HandlePtr->CC8yRegsPtr->CHC |= 00204 (((uint32_t)HandlePtr->kPassiveState0 << CCU8_CC8_CHC_OCS1_Pos) | 00205 (((~(uint32_t)HandlePtr->kPassiveState1 )<< CCU8_CC8_CHC_OCS2_Pos) & CCU8_CC8_CHC_OCS2_Msk)); 00206 00207 /* Configure the dead time mode and rising and falling dead time*/ 00208 HandlePtr->CC8yRegsPtr->DTC &= ~((CCU8_CC8_DTC_DTCC_Msk) | 00209 (CCU8_CC8_DTC_DTE1_Msk)| (CCU8_CC8_DTC_DTE2_Msk) | 00210 (CCU8_CC8_DTC_DCEN1_Msk)|(CCU8_CC8_DTC_DCEN2_Msk)); 00211 HandlePtr->CC8yRegsPtr->DTC = (uint32_t) 00212 (((HandlePtr->kDeadTimePrescalar << CCU8_CC8_DTC_DTCC_Pos) & CCU8_CC8_DTC_DTCC_Msk)| 00213 DeadTimeConfVal[HandlePtr->DeadTimeConf]); 00214 00215 HandlePtr->CC8yRegsPtr->DC1R &= ~((CCU8_CC8_DC1R_DT1R_Msk) | 00216 (CCU8_CC8_DC1R_DT1F_Msk)); 00217 HandlePtr->CC8yRegsPtr->DC1R = (uint32_t) 00218 (( HandlePtr->kRisingDeadTime << CCU8_CC8_DC1R_DT1R_Pos) 00219 & CCU8_CC8_DC1R_DT1R_Msk)| 00220 (( HandlePtr->kFallingDeadTime << CCU8_CC8_DC1R_DT1F_Pos) 00221 & CCU8_CC8_DC1R_DT1F_Msk); 00222 00223 /*<<<DD_CCU8PWMLIB_API_1_7>>>*/ 00224 /*Set period register's value*/ 00225 HandlePtr->CC8yRegsPtr->PRS = (uint32_t)(HandlePtr->kPeriodVal & 0xffff); 00226 00227 /*Set compare register's value*/ 00228 HandlePtr->CC8yRegsPtr->CR1S = (uint32_t) 00229 (HandlePtr->kCompareValue1 & 0xffffU); 00230 /* Configure channel 2 register CR2 register in case of asymmetric mode*/ 00231 if (HandlePtr->CompareMode == CCU8PWMLIB_ASYMMETRIC) 00232 { 00233 HandlePtr->CC8yRegsPtr->CR2S = (uint32_t) 00234 (HandlePtr->kCompareValue2 & 0xffffU); 00235 } 00236 00237 /*Request SW shadow transfer for period, compare, dither and prescalar level*/ 00238 HandlePtr->CC8yKernRegsPtr->GCSS |= ((0x01UL << 00239 (4U * (uint32_t)HandlePtr->FirstSlice)) | 00240 (0x01UL << 00241 ((4U * (uint32_t)HandlePtr->FirstSlice) + 1U)) | 00242 (0x01UL << 00243 ((4U * (uint32_t)HandlePtr->FirstSlice) + 2U))); 00244 00245 /*Clear all CCU8 interrupts*/ 00246 HandlePtr->CC8yRegsPtr->SWR |= CCU8PWMLIB_ALL_CCU8_INTR_CLEAR; 00247 00248 /*Configure the second slice if timer concatenation is set */ 00249 if (HandlePtr->kTimerConcatenation == (uint8_t)SET) 00250 { 00251 CCU8PWMLIB_lConfigureSecondSlice(HandlePtr); 00252 HandlePtr->CC8yRegs1Ptr->INTE |= HandlePtr->InterruptControl; 00253 00254 } /*End of if (HandlePtr->kTimerConcatenation == SET)*/ 00255 else 00256 { 00257 HandlePtr->CC8yRegsPtr->INTE |= HandlePtr->InterruptControl; 00258 } 00259 return Status; 00260 } 00261 00262 /*<<<DD_CCU8PWMLIB_nonAPI_1>>>*/ 00266 void CCU8PWMLIB_lConfigureSecondSlice 00267 ( 00268 const CCU8PWMLIB_HandleType* HandlePtr 00269 ) 00270 { 00271 uint32_t DeadTimeConfVal[4] = {0x00UL, 0xDUL, 0x5UL, 0x9UL}; 00272 00273 /*Clear the timer */ 00274 HandlePtr->CC8yRegs1Ptr->TCCLR = CCU8PWMLIB_SLICE_CLEAR; 00275 HandlePtr->CC8yRegs1Ptr->TC = 0x00U; 00276 00277 /*Set period and compare values for second slice*/ 00278 HandlePtr->CC8yRegs1Ptr->PRS = (uint32_t) 00279 ((HandlePtr->kPeriodVal & 0xFFFF0000U) >> 16U); 00280 HandlePtr->CC8yRegs1Ptr->CR1S = (uint32_t) 00281 ((HandlePtr->kCompareValue1 & 0xFFFF0000U) >> 16U); 00282 /*<<<DD_PWMSP002_API_non1_7>>>*/ 00283 /* Updae channel 2 compare register CR2 if asymmetric mode is selected */ 00284 if (HandlePtr->CompareMode == CCU8PWMLIB_ASYMMETRIC) 00285 { 00286 HandlePtr->CC8yRegs1Ptr->CR2S = (uint32_t) 00287 ((HandlePtr->kCompareValue2 & 0xFFFF0000U) >> 16U); 00288 } 00289 00290 /*<<<DD_CCU8PWMLIB_nonAPI_1_1>>>*/ 00291 /* Set timer concatenation bit */ 00292 HandlePtr->CC8yRegs1Ptr->CMC |= (0x01U << CCU8_CC8_CMC_TCE_Pos); 00293 00294 00295 /*<<<DD_CCU8PWMLIB_nonAPI_1_3>>>*/ 00296 /* Configure external stop feature */ 00297 if (HandlePtr->kExtStopTrig == (uint8_t)SET) 00298 { 00299 HandlePtr->CC8yRegs1Ptr->INS &= ~((CCU8_CC8_INS_EV1EM_Msk)| 00300 (CCU8_CC8_INS_LPF1M_Msk)); 00301 HandlePtr->CC8yRegs1Ptr->CMC &= ~(CCU8_CC8_CMC_ENDS_Msk); 00302 HandlePtr->CC8yRegs1Ptr->INS |= 00303 ((((uint32_t)HandlePtr->kStopEdge << CCU8_CC8_INS_EV1EM_Pos) & CCU8_CC8_INS_EV1EM_Msk)| 00304 ((CCU8PWMLIB_LPF << CCU8_CC8_INS_LPF1M_Pos)& CCU8_CC8_INS_LPF1M_Msk)); 00305 HandlePtr->CC8yRegs1Ptr->CMC |= 00306 ((CCU8PWMLIB_EVENT_1 << CCU8_CC8_CMC_ENDS_Pos)& CCU8_CC8_CMC_ENDS_Msk); 00307 }/*End of if (HandlePtr->kExtStopTrig == SET)*/ 00308 00309 /*<<<DD_CCU8PWMLIB_nonAPI_1_4>>>*/ 00310 /* Configure trap feature */ 00311 if (HandlePtr->kTrapEnable == (uint8_t)SET) 00312 { 00313 HandlePtr->CC8yRegs1Ptr -> INS &= ~((CCU8_CC8_INS_EV2EM_Msk)| 00314 (CCU8_CC8_INS_EV2LM_Msk) | (CCU8_CC8_INS_LPF2M_Msk) ); 00315 HandlePtr->CC8yRegs1Ptr -> INS |= 00316 (((0x00 << CCU8_CC8_INS_EV2EM_Pos)& CCU8_CC8_INS_EV2EM_Msk) | 00317 ((((uint32_t)HandlePtr->kTrapLevel << CCU8_CC8_INS_EV2LM_Pos)& CCU8_CC8_INS_EV2LM_Msk) | 00318 ((0x00 << CCU8_CC8_INS_LPF2M_Pos)& CCU8_CC8_INS_LPF2M_Msk))); 00319 HandlePtr->CC8yRegs1Ptr->CMC |= (0x01U << CCU8_CC8_CMC_TS_Pos); 00320 }/*End of if (HandlePtr->kTrapEnable == SET)*/ 00321 /*Configure timer mode, external start, stop feature */ 00322 HandlePtr->CC8yRegs1Ptr->TC &= ~((CCU8_CC8_TC_TCM_Msk) | \ 00323 (CCU8_CC8_TC_TSSM_Msk) | (CCU8_CC8_TC_CMOD_Msk) | \ 00324 (CCU8_CC8_TC_STRM_Msk) | (CCU8_CC8_TC_ENDM_Msk)|( CCU8_CC8_TC_DITHE_Msk)); 00325 HandlePtr->CC8yRegs1Ptr->TC =(((uint32_t) 00326 HandlePtr->CountingMode << CCU8_CC8_TC_TCM_Pos)& CCU8_CC8_TC_TCM_Msk)| 00327 ((HandlePtr->kTimerMode << CCU8_CC8_TC_TSSM_Pos)& CCU8_CC8_TC_TSSM_Msk)| 00328 ((CCU8PWMLIB_COMPARE_MODE << CCU8_CC8_TC_CMOD_Pos)& CCU8_CC8_TC_CMOD_Msk)| 00329 (((uint32_t) 00330 HandlePtr->ExtStartConfig << CCU8_CC8_TC_STRM_Pos)& CCU8_CC8_TC_STRM_Msk)| 00331 (((uint32_t) 00332 HandlePtr->ExtStopConfig << CCU8_CC8_TC_ENDM_Pos)& CCU8_CC8_TC_ENDM_Msk); 00333 00334 /*<<<DD_CCU8PWMLIB_nonAPI_1_5>>>*/ 00335 /* Configure dither setting */ 00336 HandlePtr->CC8yRegs1Ptr->TC |= (HandlePtr->kDitherSetting << CCU8_CC8_TC_DITHE_Pos) \ 00337 & CCU8_CC8_TC_DITHE_Msk; 00338 HandlePtr->CC8yRegs1Ptr->DITS &= ~(CCU8_CC8_DITS_DCVS_Msk); 00339 HandlePtr->CC8yRegs1Ptr->DITS = (HandlePtr->kDitherCompare << CCU8_CC8_DITS_DCVS_Pos)\ 00340 & CCU8_CC8_DITS_DCVS_Msk; 00341 00342 /*<<<DD_CCU8PWMLIB_API_non1_6>>>*/ 00343 WR_REG(HandlePtr->CC8yRegs1Ptr->TC, CCU8_CC8_TC_TRPSE_Msk, 00344 CCU8_CC8_TC_TRPSE_Pos, HandlePtr->kTrapSync); 00345 WR_REG(HandlePtr->CC8yRegs1Ptr->TC, CCU8_CC8_TC_TRPSW_Msk, 00346 CCU8_CC8_TC_TRPSW_Pos, HandlePtr->kTrapExitControl); 00347 00348 /*Set the prescalar divider and passive level of the o/p signal.*/ 00349 WR_REG(HandlePtr->CC8yRegs1Ptr->PSC, CCU8_CC8_PSC_PSIV_Msk, 00350 CCU8_CC8_PSC_PSIV_Pos, HandlePtr->kCCUPrescalar); 00351 00352 /*Set passive level of the output signal*/ 00353 HandlePtr->CC8yRegs1Ptr->PSL = 00354 ((HandlePtr->kPassiveLevel0 << CCU8_CC8_PSL_PSL11_Pos) | 00355 (HandlePtr->kPassiveLevel1 << CCU8_CC8_PSL_PSL12_Pos)); 00356 00357 /*Set the symmetric or asymmetric PWM setting*/ 00358 WR_REG(HandlePtr->CC8yRegs1Ptr->CHC, CCU8_CC8_CHC_ASE_Msk,\ 00359 CCU8_CC8_CHC_ASE_Pos,(uint32_t)HandlePtr->CompareMode); 00360 00361 /*Configure output connections as per passive state.*/ 00362 HandlePtr->CC8yRegs1Ptr->CHC &= ~((CCU8_CC8_CHC_OCS1_Msk)| 00363 CCU8_CC8_CHC_OCS2_Msk); 00364 HandlePtr->CC8yRegs1Ptr->CHC |= 00365 (((uint32_t)HandlePtr->kPassiveState0 << CCU8_CC8_CHC_OCS1_Pos) | 00366 ((~(uint32_t)HandlePtr->kPassiveState1) << CCU8_CC8_CHC_OCS2_Pos)); 00367 /*Configure dead time settings*/ 00368 HandlePtr->CC8yRegs1Ptr->DTC &= ~((CCU8_CC8_DTC_DTCC_Msk) | 00369 (CCU8_CC8_DTC_DTE1_Msk)| (CCU8_CC8_DTC_DTE2_Msk) | 00370 (CCU8_CC8_DTC_DCEN1_Msk)|(CCU8_CC8_DTC_DCEN2_Msk)); 00371 HandlePtr->CC8yRegs1Ptr->DTC |= (uint32_t) 00372 (((HandlePtr->kDeadTimePrescalar << CCU8_CC8_DTC_DTCC_Pos)& CCU8_CC8_DTC_DTCC_Msk) | 00373 DeadTimeConfVal[HandlePtr->DeadTimeConf]); 00374 00375 HandlePtr->CC8yRegs1Ptr->DC1R &= ~((CCU8_CC8_DC1R_DT1R_Msk)| 00376 (CCU8_CC8_DC1R_DT1F_Msk)); 00377 HandlePtr->CC8yRegs1Ptr->DC1R |= (uint32_t) 00378 (( HandlePtr->kRisingDeadTime << CCU8_CC8_DC1R_DT1R_Pos)& CCU8_CC8_DC1R_DT1R_Msk) | 00379 (( HandlePtr->kFallingDeadTime << CCU8_CC8_DC1R_DT1F_Pos)& CCU8_CC8_DC1R_DT1F_Msk); 00380 00381 /*Request SW shadow transfer for period, compare, dither and prescalar level*/ 00382 HandlePtr->CC8yKernRegsPtr->GCSS |= ((0x01UL << 00383 (4U * (uint32_t)HandlePtr->FirstSlice)) | 00384 (0x01UL << 00385 ((4U * (uint32_t)HandlePtr->FirstSlice) + 1U)) | 00386 (0x01UL << 00387 ((4U * (uint32_t)HandlePtr->FirstSlice) + 2U))); 00388 HandlePtr->CC8yKernRegsPtr->GCSS |= ((0x01U << 00389 (4U * (uint32_t)HandlePtr->SecondSlice)) | 00390 (0x01UL << 00391 ((4U * (uint32_t)HandlePtr->SecondSlice) + 1U)) | 00392 (0x01UL << 00393 ((4U * (uint32_t)HandlePtr->SecondSlice) + 2U))); 00394 } 00395 00396 /*<<<DD_CCU8PWMLIB_API_2>>>*/ 00400 status_t CCU8PWMLIB_Deinit(const CCU8PWMLIB_HandleType* HandlePtr) 00401 { 00402 status_t Status = (uint32_t)DAVEApp_SUCCESS; 00403 00404 /*<<<DD_CCU8PWMLIB_API_2_1>>>*/ 00405 /*<<<DD_CCU8PWMLIB_API_2_3>>>*/ 00406 /*Clear the RUN bit of the slice.*/ 00407 HandlePtr->CC8yRegsPtr->TCCLR = CCU8PWMLIB_SLICE_CLEAR; 00408 /*Clear all interrupts and disable the interrupts.*/ 00409 HandlePtr->CC8yRegsPtr->SWR = CCU8PWMLIB_ALL_CCU8_INTR_CLEAR; 00410 HandlePtr->CC8yRegsPtr->INTE = 0x00UL; 00411 00412 /*Clear all the registers.*/ 00413 HandlePtr->CC8yRegsPtr->INS = 0x00UL; 00414 HandlePtr->CC8yRegsPtr->CMC = 0x00UL; 00415 HandlePtr->CC8yRegsPtr->TC = 0x00UL; 00416 HandlePtr->CC8yRegsPtr->PSC = 0x00UL; 00417 HandlePtr->CC8yRegsPtr->PSL = 0x00UL; 00418 HandlePtr->CC8yRegsPtr->DITS = 0x00UL; 00419 HandlePtr->CC8yRegsPtr->DTC = 0x00UL; 00420 HandlePtr->CC8yRegsPtr->DC1R = 0x00UL; 00421 HandlePtr->CC8yRegsPtr->CHC = 0x00UL; 00422 HandlePtr->CC8yRegsPtr->CR1S = 0x00UL; 00423 HandlePtr->CC8yRegsPtr->CR2S = 0x00UL; 00424 HandlePtr->CC8yRegsPtr->PRS = 0x00UL; 00425 00426 HandlePtr->CC8yKernRegsPtr->GCSS |= 00427 (0x01U << (CCU8_GCSS_S0SE_Pos + 4U* (uint32_t)HandlePtr->FirstSlice)); 00428 00429 /*Set IDLE mode.*/ 00430 HandlePtr->CC8yKernRegsPtr->GIDLS = ((0x01UL<< (CCU8_GIDLS_SS0I_Pos + 00431 (uint32_t)HandlePtr->FirstSlice)) | 00432 (0x01UL << CCU8_GIDLS_CPRB_Pos) | 00433 (0x01UL << CCU8_GIDLS_PSIC_Pos)); 00434 00435 /*<<<DD_CCU8PWMLIB_API_2_2>>>*/ 00436 if (HandlePtr->kTimerConcatenation == (uint8_t)SET) 00437 { 00438 /*Clear the RUN bit of the slice.*/ 00439 HandlePtr->CC8yRegs1Ptr->TCCLR = CCU8PWMLIB_SLICE_CLEAR; 00440 /*Clear all interrupts and disable the interrupts.*/ 00441 HandlePtr->CC8yRegs1Ptr->SWR = CCU8PWMLIB_ALL_CCU8_INTR_CLEAR; 00442 HandlePtr->CC8yRegs1Ptr->INTE = 0x00UL; 00443 00444 /*Clear all the registers.*/ 00445 HandlePtr->CC8yRegs1Ptr->INS = 0x00UL; 00446 HandlePtr->CC8yRegs1Ptr->CMC = 0x00UL; 00447 HandlePtr->CC8yRegs1Ptr->TC = 0x00UL; 00448 HandlePtr->CC8yRegs1Ptr->PSC = 0x00UL; 00449 HandlePtr->CC8yRegs1Ptr->PSL = 0x00UL; 00450 HandlePtr->CC8yRegs1Ptr->DITS = 0x00UL; 00451 HandlePtr->CC8yRegs1Ptr->DTC = 0x00UL; 00452 HandlePtr->CC8yRegs1Ptr->DC1R = 0x00UL; 00453 HandlePtr->CC8yRegs1Ptr->CHC = 0x00UL; 00454 HandlePtr->CC8yRegs1Ptr->CR1S = 0x00UL; 00455 HandlePtr->CC8yRegs1Ptr->CR2S = 0x00UL; 00456 HandlePtr->CC8yRegs1Ptr->PRS = 0x00UL; 00457 00458 HandlePtr->CC8yKernRegsPtr->GCSS |= 00459 (0x01 << (CCU8_GCSS_S0SE_Pos + 4U* (uint32_t)HandlePtr->SecondSlice)); 00460 /*Set IDLE mode.*/ 00461 HandlePtr->CC8yKernRegsPtr->GIDLS = ((0x01UL<< (CCU8_GIDLS_SS0I_Pos + 00462 (uint32_t)HandlePtr->SecondSlice)) | 00463 (0x01UL << CCU8_GIDLS_CPRB_Pos) | 00464 (0x01UL << CCU8_GIDLS_PSIC_Pos)); 00465 } 00466 return Status; 00467 } 00468 00469 /*<<<DD_CCU8PWMLIB_API_3>>>*/ 00473 status_t CCU8PWMLIB_Start(const CCU8PWMLIB_HandleType* HandlePtr) 00474 { 00475 status_t Status = (uint32_t)DAVEApp_SUCCESS; 00476 /*<<<DD_CCU8PWMLIB_API_3_1>>>*/ 00477 00478 /*<<<DD_CCU8PWMLIB_API_3_2>>>*/ 00479 HandlePtr->CC8yRegsPtr->SWR = CCU8PWMLIB_ALL_CCU8_INTR_CLEAR; 00485 if (HandlePtr->Start == (uint8_t)SET) 00486 { 00487 HandlePtr->CC8yKernRegsPtr->GIDLC |= HandlePtr->StartMask; 00488 } 00489 00490 WR_REG(HandlePtr->CC8yRegsPtr->TC, CCU8_CC8_TC_TRAPE0_Msk, 00491 CCU8_CC8_TC_TRAPE0_Pos, HandlePtr->kTrapEnable); 00492 WR_REG(HandlePtr->CC8yRegsPtr->TC, CCU8_CC8_TC_TRAPE1_Msk, 00493 CCU8_CC8_TC_TRAPE1_Pos, HandlePtr->kTrapEnable); 00494 if (HandlePtr->kTimerConcatenation == (uint8_t)SET) 00495 { 00496 WR_REG(HandlePtr->CC8yRegs1Ptr->TC, CCU8_CC8_TC_TRAPE0_Msk, 00497 CCU8_CC8_TC_TRAPE0_Pos, HandlePtr->kTrapEnable); 00498 WR_REG(HandlePtr->CC8yRegs1Ptr->TC, CCU8_CC8_TC_TRAPE1_Msk, 00499 CCU8_CC8_TC_TRAPE1_Pos, HandlePtr->kTrapEnable); 00500 } 00501 00502 /* Set RUN bit if external start is not configured */ 00503 if (HandlePtr->kExtStartTrig == (uint8_t)RESET) 00504 { 00505 if (HandlePtr->kTimerConcatenation == (uint8_t)SET) 00506 { 00507 SET_BIT(HandlePtr->CC8yRegs1Ptr->TCSET, CCU8_CC8_TCSET_TRBS_Pos); 00508 /* Configure trap settings */ 00509 } 00510 SET_BIT(HandlePtr->CC8yRegsPtr->TCSET, CCU8_CC8_TCSET_TRBS_Pos); 00511 /* Configure trap settings */ 00512 } 00513 else 00514 { 00515 /*<<<DD_CCU8PWMLIB_API_1_2>>>*/ 00516 /* Configure external start feature */ 00517 if (HandlePtr->kExtStartTrig == (uint8_t)SET) 00518 { 00519 HandlePtr->CC8yRegsPtr ->INS &= ~((CCU8_CC8_INS_EV0EM_Msk)| 00520 (CCU8_CC8_INS_LPF0M_Msk)); 00521 HandlePtr->CC8yRegsPtr->CMC &= ~CCU8_CC8_CMC_STRTS_Msk; 00522 HandlePtr->CC8yRegsPtr ->INS |= 00523 ((((uint32_t)HandlePtr->kStartEdge << 00524 CCU8_CC8_INS_EV0EM_Pos)& CCU8_CC8_INS_EV0EM_Msk) | 00525 ((CCU8PWMLIB_LPF << CCU8_CC8_INS_LPF0M_Pos)& CCU8_CC8_INS_LPF0M_Msk)); 00526 HandlePtr->CC8yRegsPtr->CMC |=((CCU8PWMLIB_EVENT_0 << 00527 CCU8_CC8_CMC_STRTS_Pos)& CCU8_CC8_CMC_STRTS_Msk); 00528 } 00529 /*<<<DD_CCU8PWMLIB_nonAPI_1_2>>>*/ 00530 /* Configure external start feature*/ 00531 if ((HandlePtr->kExtStartTrig == (uint8_t)SET)&&\ 00532 (HandlePtr->kTimerConcatenation == (uint8_t)SET) 00533 ) 00534 { 00535 HandlePtr->CC8yRegs1Ptr->INS &= ~((CCU8_CC8_INS_EV0EM_Msk) | 00536 (CCU8_CC8_INS_LPF0M_Msk)); 00537 HandlePtr->CC8yRegs1Ptr->CMC &= ~(CCU8_CC8_CMC_STRTS_Msk); 00538 HandlePtr->CC8yRegs1Ptr->INS |= 00539 ((((uint32_t)HandlePtr->kStartEdge << CCU8_CC8_INS_EV0EM_Pos)& CCU8_CC8_INS_EV0EM_Msk) | 00540 ((CCU8PWMLIB_LPF << CCU8_CC8_INS_LPF0M_Pos)& CCU8_CC8_INS_LPF0M_Msk)); 00541 HandlePtr->CC8yRegs1Ptr->CMC |= 00542 ((CCU8PWMLIB_EVENT_0 << CCU8_CC8_CMC_STRTS_Pos)& CCU8_CC8_CMC_STRTS_Msk); 00543 }/*End of if (HandlePtr->kExtStartTrig == SET)*/ 00544 00545 } 00546 return Status; 00547 } 00548 00549 /* This function enables the externat start feature. 00550 */ 00551 status_t CCU8PWMLIB_EnableExtStart(const CCU8PWMLIB_HandleType* HandlePtr) 00552 { 00553 status_t Status = (uint32_t)DAVEApp_SUCCESS; 00554 00555 /*clear external start functionality */ 00556 HandlePtr->CC8yRegsPtr->INS &= ~((CCU8_CC8_INS_EV0EM_Msk) | 00557 (CCU8_CC8_INS_LPF0M_Msk)); 00558 HandlePtr->CC8yRegsPtr->INS |= ((uint32_t)HandlePtr->kStartEdge << 00559 CCU8_CC8_INS_EV0EM_Pos) & CCU8_CC8_INS_EV0EM_Msk; 00560 if (HandlePtr->kTimerConcatenation == (uint8_t)SET) 00561 { 00562 HandlePtr->CC8yRegs1Ptr->INS &= ~((CCU8_CC8_INS_EV0EM_Msk) | 00563 (CCU8_CC8_INS_LPF0M_Msk)); 00564 HandlePtr->CC8yRegs1Ptr->INS |= ((uint32_t)HandlePtr->kStartEdge << 00565 CCU8_CC8_INS_EV0EM_Pos) & CCU8_CC8_INS_EV0EM_Msk; 00566 } 00567 return Status; 00568 } 00569 00570 /* This function disables the externat start feature. 00571 * This is useful for multiphase PWM app to disable this functionality to avoid spurious 00572 * start of the slices due to other instances of the app. 00573 */ 00574 status_t CCU8PWMLIB_DisableExtStart(const CCU8PWMLIB_HandleType* HandlePtr) 00575 { 00576 status_t Status = (uint32_t)DAVEApp_SUCCESS; 00577 00578 /*clear external start functionality */ 00579 HandlePtr->CC8yRegsPtr->INS &= ~((CCU8_CC8_INS_EV0EM_Msk) | 00580 (CCU8_CC8_INS_LPF0M_Msk)); 00581 if (HandlePtr->kTimerConcatenation == (uint8_t)SET) 00582 { 00583 HandlePtr->CC8yRegs1Ptr->INS &= ~((CCU8_CC8_INS_EV0EM_Msk) | 00584 (CCU8_CC8_INS_LPF0M_Msk)); 00585 } 00586 return Status; 00587 } 00588 00589 /*<<<DD_CCU8PWMLIB_API_4>>>*/ 00593 status_t CCU8PWMLIB_Stop(const CCU8PWMLIB_HandleType* HandlePtr) 00594 { 00595 status_t Status = (uint32_t)DAVEApp_SUCCESS; 00596 00597 /*<<<DD_CCU8PWMLIB_API_4_1>>>*/ 00598 /*Clear RUN bit of the slice in use*/ 00599 HandlePtr->CC8yRegsPtr->TCCLR = CCU8PWMLIB_SLICE_CLEAR; 00600 00601 /*<<<DD_CCU8PWMLIB_API_4_2>>>*/ 00602 if (HandlePtr->kTimerConcatenation == (uint8_t)SET) 00603 { 00604 /*Clear RUN bit of the slice in use*/ 00605 HandlePtr->CC8yRegs1Ptr->TCCLR = CCU8PWMLIB_SLICE_CLEAR; 00606 00607 }/*End of "if (HandlePtr->kTimerConcatenation == (uint8_t)SET)"*/ 00611 if(HandlePtr->Start == (uint8_t)SET) 00612 { 00613 HandlePtr->CC8yKernRegsPtr->GIDLS |= HandlePtr->StartMask; 00614 } 00615 return Status; 00616 } 00617 00618 /*<<<DD_CCU8PWMLIB_API_5>>>*/ 00625 status_t CCU8PWMLIB_SetCompare 00626 ( 00627 const CCU8PWMLIB_HandleType* HandlePtr, 00628 uint32_t Compare1, 00629 uint32_t Compare2 00630 ) 00631 { 00632 status_t Status = (uint32_t)DAVEApp_SUCCESS; 00633 /*<<<DD_CCU8PWMLIB_API_5_3>>>*/ 00634 /* Call the function as per configured mode */ 00635 Status = HandlePtr->SetCompareFuncPtr((void*)HandlePtr, Compare1, Compare2); 00636 return Status; 00637 } 00638 00639 status_t CCU8PWMLIB_SetCompareAsymmetric 00640 ( 00641 const void* HdlPtr, 00642 uint32_t Compare1, 00643 uint32_t Compare2 00644 ) 00645 { 00646 status_t Status = (uint32_t)DAVEApp_SUCCESS; 00647 const CCU8PWMLIB_HandleType* HandlePtr = (CCU8PWMLIB_HandleType*) HdlPtr; 00648 00649 HandlePtr->CC8yRegsPtr->CR1S = (uint32_t)(Compare1 & 0xffffU); 00650 HandlePtr->CC8yRegsPtr->CR2S = (uint32_t)(Compare2 & 0xffffU); 00651 00652 /*Request for shadow transfer*/ 00653 Status = CCU8PWMLIB_SWRequestShadowTransfer(HandlePtr); 00654 return Status; 00655 } 00656 00657 status_t CCU8PWMLIB_SetCompareSymmetric 00658 ( 00659 const void* HdlPtr, 00660 uint32_t Compare1, 00661 uint32_t Compare2 00662 ) 00663 { 00664 status_t Status = (uint32_t)CCU8PWMLIB_OPER_NOT_ALLOWED_ERROR; 00665 const CCU8PWMLIB_HandleType* HandlePtr = (CCU8PWMLIB_HandleType*) HdlPtr; 00666 Compare2 = 0; 00667 HandlePtr->CC8yRegsPtr->CR1S = (uint32_t)(Compare1 & 0xffffU); 00668 HandlePtr->CC8yRegsPtr->CR2S = (uint32_t)(0); 00669 /*Request for shadow transfer*/ 00670 Status = CCU8PWMLIB_SWRequestShadowTransfer(HandlePtr); 00671 return Status; 00672 } 00673 00674 status_t CCU8PWMLIB_SetCompareEdgeAlignSymmetricTimerConcat 00675 ( 00676 const void* HdlPtr, 00677 uint32_t Compare1, 00678 uint32_t Compare2 00679 ) 00680 { 00681 uint32_t FirstSliceCompareVal = 0U; 00682 uint32_t SecondSliceCompareVal = 0U; 00683 status_t Status = (uint32_t)CCU8PWMLIB_OPER_NOT_ALLOWED_ERROR; 00684 const CCU8PWMLIB_HandleType* HandlePtr = (CCU8PWMLIB_HandleType*) HdlPtr; 00685 Compare2 = 0; 00686 FirstSliceCompareVal = (uint32_t)Compare1 % \ 00687 (uint16_t)HandlePtr->CC8yRegsPtr->PRS; 00688 SecondSliceCompareVal = (uint32_t)Compare1 / 00689 (uint16_t)HandlePtr->CC8yRegsPtr->PRS; 00690 HandlePtr->CC8yRegsPtr->CR1S = (uint32_t)(FirstSliceCompareVal & 0xffffU); 00691 HandlePtr->CC8yRegs1Ptr->CR1S = (uint32_t)(SecondSliceCompareVal & 0xffffU); 00692 HandlePtr->CC8yRegs1Ptr->CR2S = (uint32_t)(0); 00693 HandlePtr->CC8yRegsPtr->CR2S = (uint32_t)(0); 00694 /*Request for shadow transfer*/ 00695 Status = CCU8PWMLIB_SWRequestShadowTransfer(HandlePtr); 00696 return Status; 00697 } 00698 00699 00705 status_t CCU8PWMLIB_SetDutyCycle 00706 ( 00707 const CCU8PWMLIB_HandleType* HandlePtr, 00708 float DutyCycle, 00709 uint32_t Shift, 00710 uint8_t Sign 00711 ) 00712 { 00713 status_t Status = (uint32_t)DAVEApp_SUCCESS; 00714 /*<<<DD_CCU8PWMLIB_API_15_2>>>*/ 00715 /* duty cycle has to be in between 0 and 100 */ 00716 /* Call the function as per configured mode */ 00717 Status = HandlePtr->SetDutyFuncPtr((void*)HandlePtr, DutyCycle, Shift, Sign); 00718 00719 return Status; 00720 } 00726 status_t CCU8PWMLIB_SetDutyEdgeAlignAsymmetric 00727 ( 00728 const void* HdlPtr, 00729 float DutyCycle, 00730 uint32_t Shift, 00731 uint8_t Sign 00732 ) 00733 { 00734 uint32_t Comp = 0U; 00735 status_t Status = (uint32_t)CCU8PWMLIB_OPER_NOT_ALLOWED_ERROR; 00736 const CCU8PWMLIB_HandleType* HandlePtr = (CCU8PWMLIB_HandleType*) HdlPtr; 00737 /*<<<DD_CCU8PWMLIB_API_15_3>>>*/ 00738 /*<<<DD_CCU8PWMLIB_API_15_4>>>*/ 00739 Comp = (uint32_t) 00740 (((HandlePtr->CC8yRegsPtr->PRS + 1U) * (100U - DutyCycle))/100U); 00741 00742 /* If shift value is greater than compare register value or if sign is 0, report error */ 00743 if(((Sign == (uint8_t)RESET)&& Shift >0U) || (Shift > Comp)) 00744 { 00745 Status = (uint32_t)CCU8PWMLIB_INVALID_PARAM_ERROR; 00746 } 00747 else 00748 { 00749 /* <<<DD_CCU8PWMLIB_nonAPI_3_3>>>*/ 00750 HandlePtr->CC8yRegsPtr->CR1S = (uint32_t)((Comp - Shift) & 0xffffU); 00751 HandlePtr->CC8yRegsPtr->CR2S = (uint32_t) 00752 ((HandlePtr->CC8yRegsPtr->PRS - Shift) & 0xffffU); 00753 /*Request for shadow transfer*/ 00754 Status = CCU8PWMLIB_SWRequestShadowTransfer(HandlePtr); 00755 } 00756 return (Status); 00757 } 00758 00765 status_t CCU8PWMLIB_SetDutyEdgeAlignSymmetric 00766 ( 00767 const void* HdlPtr, 00768 float DutyCycle, 00769 uint32_t Shift, 00770 uint8_t Sign 00771 ) 00772 { 00773 uint32_t Comp = 0; 00774 status_t Status = (uint32_t)CCU8PWMLIB_OPER_NOT_ALLOWED_ERROR; 00775 00776 const CCU8PWMLIB_HandleType* HandlePtr = (CCU8PWMLIB_HandleType*) HdlPtr; 00777 /*<<<DD_CCU8PWMLIB_API_15_3>>>*/ 00778 /*<<<DD_CCU8PWMLIB_API_15_4>>>*/ 00779 Comp = (uint32_t) 00780 (((HandlePtr->CC8yRegsPtr->PRS + 1U) * (100U -DutyCycle))/100U); 00781 00782 /* If shift value is greater than compare register value or if sign is 0, report error */ 00783 if(((Sign == (uint8_t)RESET)&& Shift >0U) || (Shift > Comp)) 00784 { 00785 Status = (uint32_t)CCU8PWMLIB_INVALID_PARAM_ERROR; 00786 } 00787 else { 00788 00789 HandlePtr->CC8yRegsPtr->CR1S = (uint32_t)(Comp & 0xffff); 00790 HandlePtr->CC8yRegsPtr->CR2S = (uint32_t)(0); 00791 /*initiate the shadow transfer */ 00792 Status = CCU8PWMLIB_SWRequestShadowTransfer(HandlePtr); 00793 } 00794 return (Status); 00795 } 00796 00803 status_t CCU8PWMLIB_SetDutyEdgeAlignSymmetricTimerConcat 00804 ( 00805 const void* HdlPtr, 00806 float DutyCycle, 00807 uint32_t Shift, 00808 uint8_t Sign 00809 ) 00810 { 00811 status_t Status = (uint32_t)CCU8PWMLIB_OPER_NOT_ALLOWED_ERROR; 00812 uint32_t FirstSliceCompareVal1 = 0U; 00813 uint32_t SecondSliceCompareVal1 = 0U; 00814 uint32_t PeriodReg = 0U; 00815 uint32_t Comp = 0U; 00816 00817 const CCU8PWMLIB_HandleType* HandlePtr = (CCU8PWMLIB_HandleType*) HdlPtr; 00818 00819 Comp = (HandlePtr->CC8yRegs1Ptr->PRS+ 1U); 00820 Comp *=(HandlePtr->CC8yRegsPtr->PRS +1U); 00821 Comp += 1U; 00822 Comp = (uint32_t)((Comp * (100U-DutyCycle))/100U); 00823 PeriodReg = ((HandlePtr->CC8yRegs1Ptr->PRS)<< 16UL); 00824 PeriodReg |= (HandlePtr->CC8yRegsPtr->PRS); 00825 /* If shift value is greater than compare register value or if sign is 0, report error */ 00826 if(((Sign == (uint8_t)RESET)&& Shift >0U) || (Shift > Comp)) 00827 { 00828 Status = (uint32_t)CCU8PWMLIB_INVALID_PARAM_ERROR; 00829 } 00830 00831 else{ 00832 /* <<<DD_CCU8PWMLIB_nonAPI_2_1>>>*/ 00833 /* <<<DD_CCU8PWMLIB_nonAPI_2_2>>>*/ 00834 FirstSliceCompareVal1 = (uint32_t)Comp % \ 00835 (uint16_t)PeriodReg; 00836 SecondSliceCompareVal1 = (uint32_t)Comp / 00837 (uint16_t)PeriodReg; 00838 HandlePtr->CC8yRegsPtr->CR1S = (FirstSliceCompareVal1 & 0xFFFFU); 00839 HandlePtr->CC8yRegs1Ptr->CR1S = (SecondSliceCompareVal1 & 0xFFFFU); 00840 HandlePtr->CC8yRegs1Ptr->CR2S = (uint32_t)(0); 00841 HandlePtr->CC8yRegsPtr->CR2S = (uint32_t)(0); 00842 /* <<<DD_CCU8PWMLIB_nonAPI_2_3>>>*/ 00843 /*Request for shadow transfer*/ 00844 Status = CCU8PWMLIB_SWRequestShadowTransfer(HandlePtr); 00845 } 00846 return Status; 00847 } 00848 00854 status_t CCU8PWMLIB_SetDutyCenterAlignSymmetric 00855 ( 00856 const void* HdlPtr, 00857 float DutyCycle, 00858 uint32_t Shift, 00859 uint8_t Sign 00860 ) 00861 { 00862 status_t Status = (uint32_t)CCU8PWMLIB_OPER_NOT_ALLOWED_ERROR; 00863 uint32_t Comp = 0U; 00864 const CCU8PWMLIB_HandleType* HandlePtr = (CCU8PWMLIB_HandleType*) HdlPtr; 00865 Sign = 0U; 00866 /* Find the compare register value for center-aligned mode. */ 00867 Comp = (uint32_t)(((HandlePtr->CC8yRegsPtr->PRS ) * (100U-DutyCycle))/100U); 00868 if((HandlePtr->kTimerConcatenation == (uint8_t)SET) || (Shift>Comp)) 00869 { 00870 Status = (uint32_t)CCU8PWMLIB_INVALID_PARAM_ERROR; 00871 } 00872 else{ 00873 /* <<<DD_CCU8PWMLIB_nonAPI_3_1>>>*/ 00874 HandlePtr->CC8yRegsPtr->CR1S = (uint32_t)(Comp & 0xffff); 00875 HandlePtr->CC8yRegsPtr->CR2S = (uint32_t)(0); 00876 /* initiate the shadow transfer */ 00877 Status = CCU8PWMLIB_SWRequestShadowTransfer(HandlePtr); 00878 } 00879 return (Status); 00880 00881 } 00882 00888 status_t CCU8PWMLIB_SetDutyCenterAlignAsymmetric 00889 ( 00890 const void* HdlPtr, 00891 float DutyCycle, 00892 uint32_t Shift, 00893 uint8_t Sign 00894 ) 00895 { 00896 status_t Status = (uint32_t)CCU8PWMLIB_OPER_NOT_ALLOWED_ERROR; 00897 uint32_t Comp = 0U; 00898 const CCU8PWMLIB_HandleType* HandlePtr = (CCU8PWMLIB_HandleType*) HdlPtr; 00899 00900 /* Find the compare register value for center-aligned mode. */ 00901 Comp = (uint32_t)(((HandlePtr->CC8yRegsPtr->PRS) * (100U-DutyCycle))/100U); 00902 if((HandlePtr->kTimerConcatenation == (uint8_t)SET) || (Shift>Comp)) 00903 { 00904 Status = (uint32_t)CCU8PWMLIB_INVALID_PARAM_ERROR; 00905 } 00906 00907 else{ 00908 /* <<<DD_CCU8PWMLIB_nonAPI_3_3>>>*/ 00909 if (Sign == (uint8_t)RESET) 00910 { 00911 00912 HandlePtr->CC8yRegsPtr->CR1S = (uint32_t)((Comp + Shift) & 0xffffU); 00913 HandlePtr->CC8yRegsPtr->CR2S = (uint32_t)((Comp - Shift) & 0xffffU); 00914 /* <<<DD_CCU8PWMLIB_nonAPI_3_5>>>*/ 00915 } /*end of if (Sign == 0)*/ 00916 /* <<<DD_CCU8PWMLIB_nonAPI_3_4>>>*/ 00917 else if (Sign == (uint8_t)SET) 00918 { 00919 HandlePtr->CC8yRegsPtr->CR1S = (uint32_t)((Comp - Shift) & 0xffffU); 00920 HandlePtr->CC8yRegsPtr->CR2S = (uint32_t)((Comp + Shift) & 0xffffU); 00921 } 00922 else 00923 {} 00924 /* <<<DD_CCU8PWMLIB_nonAPI_3_6>>>*/ 00925 /* initiate the shadow transfer */ 00926 Status = CCU8PWMLIB_SWRequestShadowTransfer(HandlePtr); 00927 } 00928 return (Status); 00929 } 00930 00932 status_t CCU8PWMLIB_SetPeriodAndCompare 00933 ( 00934 const CCU8PWMLIB_HandleType* HandlePtr, 00935 uint32_t PwmFreq, 00936 uint32_t Compare1, 00937 uint32_t Compare2 00938 ) 00939 { 00940 status_t Status = (uint32_t)DAVEApp_SUCCESS; 00941 00942 /* Update the period register after checking timer concatenation setting */ 00943 HandlePtr->CC8yRegsPtr->PRS = PwmFreq & 0xffffU; 00944 if (HandlePtr->kTimerConcatenation == (uint8_t)SET) 00945 { 00946 HandlePtr->CC8yRegs1Ptr->PRS = ((PwmFreq & 0xffff0000U) >> 16UL); 00947 HandlePtr->CC8yRegsPtr->PRS = (PwmFreq & 0xffffU); 00948 } 00949 /*<<<DD_CCU8PWMLIB_API_6_2>>>*/ 00950 00951 /*<<<DD_CCU8PWMLIB_API_6_3>>*/ 00952 /* Set compare register values and request shadow transfer */ 00953 Status = HandlePtr->SetCompareFuncPtr((void*)HandlePtr, Compare1, Compare2); 00954 return Status; 00955 } 00956 00957 /*<<<DD_CCU8PWMLIB_API_6>>>*/ 00959 status_t CCU8PWMLIB_SetPeriod 00960 ( 00961 const CCU8PWMLIB_HandleType* HandlePtr, 00962 uint32_t PwmFreq 00963 ) 00964 { 00965 status_t Status = (uint32_t)DAVEApp_SUCCESS; 00966 00967 /* Update the period register after checking timer concatenation setting */ 00968 HandlePtr->CC8yRegsPtr->PRS = PwmFreq & 0xffffU; 00969 if (HandlePtr->kTimerConcatenation == (uint8_t)SET) 00970 { 00971 HandlePtr->CC8yRegs1Ptr->PRS = ((PwmFreq & 0xffff0000U) >> 16UL); 00972 HandlePtr->CC8yRegsPtr->PRS = (PwmFreq & 0xffffU); 00973 } 00974 /*<<<DD_CCU8PWMLIB_API_6_2>>>*/ 00975 00976 /*<<<DD_CCU8PWMLIB_API_6_3>>*/ 00977 00978 /*Request for shadow transfer*/ 00979 Status = CCU8PWMLIB_SWRequestShadowTransfer(HandlePtr); 00980 00981 00982 return Status; 00983 } 00984 00985 /* This function changes the PWM frequency */ 00986 status_t CCU8PWMLIB_SetPwmFreqAndDutyCycle 00987 ( 00988 const CCU8PWMLIB_HandleType* HandlePtr, 00989 float PwmFreq, 00990 float DutyCycle, 00991 uint32_t Shift, 00992 uint8_t Sign 00993 ) 00994 { 00995 status_t Status = (uint32_t)CCU8PWMLIB_OPER_NOT_ALLOWED_ERROR; 00996 uint32_t PwmTime = 0UL; 00997 00998 do 00999 { 01000 /* Find the time reuired for given frequency and then the period register value 01001 * depending upon edge-aligned or center-aligned 01002 */ 01003 01004 PwmTime = (uint32_t)((1000000000) / (HandlePtr->kResolution * PwmFreq)); 01005 01006 if(HandlePtr->kTimerConcatenation == (uint8_t)RESET) 01007 { 01008 if(PwmTime > CCU8PWMLIB_MAX_VALUE) 01009 { 01010 Status = (uint32_t)CCU8PWMLIB_INVALID_PARAM_ERROR; 01011 break; 01012 } /* End of "if(PwmTime > CCU8PWMLIB_MAX_VALUE)" */ 01013 if(HandlePtr->CountingMode == CCU8PWMLIB_EDGE_ALIGNED) 01014 { 01015 HandlePtr->CC8yRegsPtr->PRS = PwmTime - 1U; 01016 } /* End of "if(HandlePtr->CountingMode == CCU8PWMLIB_EDGE_ALIGNED)" */ 01017 else if(HandlePtr->CountingMode == CCU8PWMLIB_CENTER_ALIGNED) 01018 { 01019 HandlePtr->CC8yRegsPtr->PRS = (PwmTime - 1U) >> 1U; 01020 }/* End of "else if(HandlePtr->CountingMode == CCU8PWMLIB_CENTER_ALIGNED)" */ 01021 else 01022 {} 01023 } /* End of "if(HandlePtr->kTimerConcatenation == (uint8_t)RESET)" */ 01024 01025 if(HandlePtr->kTimerConcatenation == (uint8_t)SET) 01026 { 01027 Status = CCU8PWMLIB_lSetPwmFreqTimerConcat(HandlePtr, PwmTime); 01028 } 01029 } while (0); 01030 01031 /* Call the function as per configured mode and request shadow transfer*/ 01032 Status = HandlePtr->SetDutyFuncPtr((void*)HandlePtr, DutyCycle, Shift, Sign); 01033 return Status; 01034 } 01035 01036 01037 /*<<<DD_CCU8PWMLIB_API_16>>>*/ 01038 /* This function changes the PWM frequency */ 01039 status_t CCU8PWMLIB_SetPwmFreq 01040 ( 01041 const CCU8PWMLIB_HandleType* HandlePtr, 01042 float PwmFreq 01043 ) 01044 { 01045 status_t Status = (uint32_t)CCU8PWMLIB_OPER_NOT_ALLOWED_ERROR; 01046 uint32_t PwmTime = 0UL; 01047 01048 do 01049 { 01050 /* Find the time reuired for given frequency and then the period register value 01051 * depending upon edge-aligned or center-aligned 01052 */ 01053 01054 PwmTime = (uint32_t)((1000000000) / (HandlePtr->kResolution * PwmFreq)); 01055 01056 if(HandlePtr->kTimerConcatenation == (uint8_t)RESET) 01057 { 01058 if(PwmTime > CCU8PWMLIB_MAX_VALUE) 01059 { 01060 Status = (uint32_t)CCU8PWMLIB_INVALID_PARAM_ERROR; 01061 break; 01062 } /* End of "if(PwmTime > CCU8PWMLIB_MAX_VALUE)" */ 01063 if(HandlePtr->CountingMode == CCU8PWMLIB_EDGE_ALIGNED) 01064 { 01065 HandlePtr->CC8yRegsPtr->PRS = PwmTime - 1U; 01066 } /* End of "if(HandlePtr->CountingMode == CCU8PWMLIB_EDGE_ALIGNED)" */ 01067 else if(HandlePtr->CountingMode == CCU8PWMLIB_CENTER_ALIGNED) 01068 { 01069 HandlePtr->CC8yRegsPtr->PRS = (PwmTime - 1U) >> 1U; 01070 }/* End of "else if(HandlePtr->CountingMode == CCU8PWMLIB_CENTER_ALIGNED)" */ 01071 else 01072 { 01073 } 01074 /*Request for shadow transfer*/ 01075 Status = CCU8PWMLIB_SWRequestShadowTransfer(HandlePtr); 01076 } /* End of "if(HandlePtr->kTimerConcatenation == (uint8_t)RESET)" */ 01077 01078 if(HandlePtr->kTimerConcatenation == (uint8_t)SET) 01079 { 01080 Status = CCU8PWMLIB_lSetPwmFreqTimerConcat(HandlePtr, PwmTime); 01081 /*Request for shadow transfer*/ 01082 Status = CCU8PWMLIB_SWRequestShadowTransfer(HandlePtr); 01083 } 01084 } while (0); 01085 01086 01087 return Status; 01088 } 01089 01093 status_t CCU8PWMLIB_lSetPwmFreqTimerConcat 01094 ( 01095 const CCU8PWMLIB_HandleType* HandlePtr, 01096 uint32_t PwmTime 01097 ) 01098 { 01099 uint32_t PeriodVal = PwmTime; 01100 uint32_t MsbPeriodVal, LsbPeriodVal; 01101 uint8_t Count = 0U; 01102 status_t Status = (uint32_t)CCU8PWMLIB_OPER_NOT_ALLOWED_ERROR; 01103 /* 01104 * In case of timer concatenation, period value of two slices needs to be found out. 01105 * Total Period = ((PR1 + 1) * PR2) + 1 01106 * PR1 is found out by dividing given period time by 2 till the value is less than 01107 * 65535. Quotient is the period register value of the second slice. 01108 */ 01109 if(PwmTime > CCU8PWMLIB_MAX_VALUE) 01110 { 01111 do 01112 { 01113 PeriodVal = PeriodVal >> 1U; 01114 Count++; 01115 }while(PeriodVal >= CCU8PWMLIB_MAX_VALUE); 01116 MsbPeriodVal = ((uint32_t)1 << Count) -1U; 01117 LsbPeriodVal = PeriodVal; 01118 } 01119 else 01120 { 01121 LsbPeriodVal = PwmTime; 01122 MsbPeriodVal = 0U; 01123 } 01124 /*<<<DD_CCU8PWMLIB_API_16_4>>>*/ 01125 HandlePtr->CC8yRegsPtr->PRS = LsbPeriodVal & 0xffffU; 01126 HandlePtr->CC8yRegs1Ptr->PRS = MsbPeriodVal & 0xffffU; 01127 /*<<<DD_CCU8PWMLIB_API_16_5>>>*/ 01128 return (Status); 01129 } 01130 01131 01132 /*<<<DD_CCU8PWMLIB_API_7>>*/ 01136 status_t CCU8PWMLIB_SetTimerVal 01137 ( 01138 const CCU8PWMLIB_HandleType* HandlePtr, 01139 uint32_t TimerVal 01140 ) 01141 { 01142 status_t Status = (uint32_t)DAVEApp_SUCCESS; 01143 HandlePtr->CC8yRegsPtr->TIMER = TimerVal & 0xffffU; 01144 if (HandlePtr->kTimerConcatenation == (uint8_t)SET) 01145 { 01146 HandlePtr->CC8yRegs1Ptr->TIMER= ((TimerVal & 0xffff0000U) >> 16UL); 01147 } 01148 return Status; 01149 } 01150 /*<<<DD_CCU8PWMLIB_API_8>>*/ 01154 status_t CCU8PWMLIB_GetTimerStatus 01155 ( 01156 const CCU8PWMLIB_HandleType* HandlePtr, 01157 uint32_t* TimerStatusPtr 01158 ) 01159 { 01160 status_t Status = (uint32_t)DAVEApp_SUCCESS; 01161 uint32_t SecondTimerStatus = 0U; 01162 01163 /* In case of timer concatenation, both the timer status is read */ 01164 if (HandlePtr->kTimerConcatenation == (uint8_t)SET) 01165 { 01166 SecondTimerStatus = (uint32_t)(RD_REG(HandlePtr->CC8yRegs1Ptr->TCST, 01167 CCU8_CC8_TCST_TRB_Msk, CCU8_CC8_TCST_TRB_Pos)); 01168 *TimerStatusPtr = (uint32_t)((RD_REG(HandlePtr->CC8yRegsPtr->TCST, 01169 CCU8_CC8_TCST_TRB_Msk, CCU8_CC8_TCST_TRB_Pos)) & 01170 SecondTimerStatus 01171 ); 01172 } 01173 else 01174 { 01175 *TimerStatusPtr = (uint32_t) RD_REG(HandlePtr->CC8yRegsPtr->TCST, 01176 CCU8_CC8_TCST_TRB_Msk, CCU8_CC8_TCST_TRB_Pos); 01177 } 01178 return Status; 01179 } 01180 01181 /*<<<DD_CCU8PWMLIB_API_9>>*/ 01185 status_t CCU8PWMLIB_GetTimerRegsVal 01186 ( 01187 const CCU8PWMLIB_HandleType* HandlePtr, 01188 CCU8PWMLIB_TimerRegsType* TimerRegsPtr 01189 ) 01190 { 01191 status_t Status = (uint32_t)DAVEApp_SUCCESS; 01192 uint32_t ScndSlTMRVal = 0UL; 01193 01194 /*<<<DD_CCU8PWMLIB_API_9_3>>>*/ 01195 if (HandlePtr->kTimerConcatenation == (uint8_t)SET) 01196 { 01197 TimerRegsPtr->CompReg1 = (uint32_t)(HandlePtr->CC8yRegs1Ptr->CR1S); 01198 TimerRegsPtr->CompReg1 *=(uint32_t)(HandlePtr->CC8yRegsPtr->PRS); 01199 TimerRegsPtr->CompReg1 += (uint32_t)(HandlePtr->CC8yRegsPtr->CR1S); 01200 TimerRegsPtr->CompReg2 = (uint32_t)(HandlePtr->CC8yRegs1Ptr->CR2S); 01201 TimerRegsPtr->CompReg2 *= (uint32_t)(HandlePtr->CC8yRegsPtr->PRS); 01202 TimerRegsPtr->CompReg2 += (uint32_t)(HandlePtr->CC8yRegsPtr->CR2S); 01203 TimerRegsPtr->PeriodReg = (uint32_t)((HandlePtr->CC8yRegs1Ptr->PRS)<<16UL); 01204 TimerRegsPtr->PeriodReg |= (HandlePtr->CC8yRegsPtr->PRS); 01205 ScndSlTMRVal = (RD_REG(HandlePtr->CC8yRegs1Ptr->TIMER, 01206 CCU8_CC8_TIMER_TVAL_Msk, CCU8_CC8_TIMER_TVAL_Pos) << 16UL); 01207 TimerRegsPtr->TimerReg = (uint32_t)((ScndSlTMRVal << 16UL) | 01208 (RD_REG(HandlePtr->CC8yRegsPtr->TIMER, 01209 CCU8_CC8_TIMER_TVAL_Msk, CCU8_CC8_TIMER_TVAL_Pos))); 01210 } 01211 /*<<<DD_CCU8PWMLIB_API_9_2>>>*/ 01212 else 01213 { 01214 TimerRegsPtr->CompReg1 = HandlePtr->CC8yRegsPtr->CR1S; 01215 TimerRegsPtr->CompReg2 = HandlePtr->CC8yRegsPtr->CR2S; 01216 TimerRegsPtr->PeriodReg = HandlePtr->CC8yRegsPtr->PRS; 01217 TimerRegsPtr->TimerReg = (uint32_t)RD_REG(HandlePtr->CC8yRegsPtr->TIMER, 01218 CCU8_CC8_TIMER_TVAL_Msk, CCU8_CC8_TIMER_TVAL_Pos); 01219 } 01220 01221 return Status; 01222 } 01223 01224 /*<<<DD_CCU8PWMLIB_API_15>>>*/ 01225 /* 01226 * This function reads the period register value. 01227 * This function can be used by user to calculate the compare register value 01228 * as per required duty cycle. 01229 */ 01230 status_t CCU8PWMLIB_GetPeriodReg 01231 ( 01232 const CCU8PWMLIB_HandleType* HandlePtr, 01233 uint32_t* PeriodRegPtr 01234 ) 01235 { 01236 status_t Status = (uint32_t)DAVEApp_SUCCESS; 01237 if (HandlePtr->kTimerConcatenation == (uint8_t)SET) 01238 { 01239 *PeriodRegPtr = ((HandlePtr->CC8yRegs1Ptr->PRS)<< 16UL); 01240 *PeriodRegPtr |= (HandlePtr->CC8yRegsPtr->PRS); 01241 } 01242 else 01243 { 01244 *PeriodRegPtr = HandlePtr->CC8yRegsPtr->PRS; 01245 } 01246 return Status; 01247 } 01248 01249 /*<<<DD_CCU8PWMLIB_API_10>>>*/ 01253 status_t CCU8PWMLIB_SWRequestShadowTransfer 01254 ( 01255 const CCU8PWMLIB_HandleType* HandlePtr 01256 ) 01257 { 01258 status_t Status = (uint32_t)DAVEApp_SUCCESS; 01259 /*Request shadow transfer for the First Slice*/ 01260 if(HandlePtr->ShadowTransfer == (uint32_t)SET) 01261 { 01262 HandlePtr->CC8yKernRegsPtr->GCSS |= HandlePtr->ShadowTransferMask; 01263 } 01264 01265 return Status; 01266 } 01267 01268 /*<<<DD_CCU8PWMLIB_API_13>>>*/ 01272 status_t CCU8PWMLIB_ResetTrapFlag(const CCU8PWMLIB_HandleType* HandlePtr) 01273 { 01274 status_t Status = (uint32_t)DAVEApp_SUCCESS; 01275 /* Clear the Trap interrupt is SW exit control is used */ 01276 if (HandlePtr->kTrapExitControl == (uint8_t)SET) 01277 { 01278 SET_BIT(HandlePtr->CC8yRegsPtr->SWR, CCU8PWMLIB_EVENT2_INTERRUPT); 01279 if (HandlePtr->kTimerConcatenation == (uint8_t)SET) 01280 { 01281 SET_BIT(HandlePtr->CC8yRegs1Ptr->SWR, CCU8PWMLIB_EVENT2_INTERRUPT); 01282 } 01283 } 01284 /* Clear the trap flag */ 01285 SET_BIT(HandlePtr->CC8yRegsPtr->SWR, CCU8PWMLIB_TRAP_FLAG_CLEAR); 01286 if (HandlePtr->kTimerConcatenation == (uint8_t)SET) 01287 { 01288 SET_BIT(HandlePtr->CC8yRegs1Ptr->SWR, CCU8PWMLIB_TRAP_FLAG_CLEAR); 01289 } 01290 return Status; 01291 } 01295 status_t CCU8PWMLIB_EnableEvent 01296 ( 01297 const CCU8PWMLIB_HandleType * HandlePtr, 01298 const CCU8PWMLIB_EventNameType Event 01299 ) 01300 { 01301 status_t Status = (uint32_t)DAVEApp_SUCCESS; 01302 if(HandlePtr->kTimerConcatenation == (uint8_t)SET) 01303 { 01304 SET_BIT(HandlePtr->CC8yRegs1Ptr->INTE, (uint8_t)Event); 01305 } 01306 else 01307 { 01308 SET_BIT(HandlePtr->CC8yRegsPtr->INTE,(uint8_t) Event); 01309 } 01310 return (Status); 01311 } 01312 01316 status_t CCU8PWMLIB_DisableEvent 01317 ( 01318 const CCU8PWMLIB_HandleType * HandlePtr, 01319 const CCU8PWMLIB_EventNameType Event 01320 ) 01321 { 01322 status_t Status = (uint32_t)DAVEApp_SUCCESS; 01323 if(HandlePtr->kTimerConcatenation == (uint8_t)SET) 01324 { 01325 CLR_BIT(HandlePtr->CC8yRegs1Ptr->INTE,(uint8_t) Event); 01326 } 01327 else 01328 { 01329 CLR_BIT(HandlePtr->CC8yRegsPtr->INTE,(uint8_t) Event); 01330 } 01331 return (Status); 01332 } 01333 01337 status_t CCU8PWMLIB_ClearPendingEvent 01338 ( 01339 const CCU8PWMLIB_HandleType * HandlePtr, 01340 const CCU8PWMLIB_EventNameType Event 01341 ) 01342 { 01343 status_t Status = (uint32_t)DAVEApp_SUCCESS; 01344 if(HandlePtr->kTimerConcatenation == (uint8_t)SET) 01345 { 01346 SET_BIT(HandlePtr->CC8yRegs1Ptr->SWR,(uint8_t) Event); 01347 } 01348 else 01349 { 01350 SET_BIT(HandlePtr->CC8yRegsPtr->SWR,(uint8_t) Event); 01351 } 01352 return (Status); 01353 } 01354 01359 status_t CCU8PWMLIB_SetPendingEvent 01360 ( 01361 const CCU8PWMLIB_HandleType * HandlePtr, 01362 const CCU8PWMLIB_EventNameType Event 01363 ) 01364 { 01365 status_t Status = (uint32_t)DAVEApp_SUCCESS; 01366 01367 if(HandlePtr->kTimerConcatenation == (uint8_t)SET) 01368 { 01369 SET_BIT(HandlePtr->CC8yRegs1Ptr->SWS, (uint8_t)Event); 01370 } 01371 else 01372 { 01373 SET_BIT(HandlePtr->CC8yRegsPtr->SWS, (uint8_t)Event); 01374 } 01375 return (Status); 01376 } 01377 01381 status_t CCU8PWMLIB_GetPendingEvent 01382 ( 01383 const CCU8PWMLIB_HandleType * HandlePtr, 01384 const CCU8PWMLIB_EventNameType Event, 01385 uint8_t* EvtStatus 01386 ) 01387 { 01388 status_t Status = (uint32_t)DAVEApp_SUCCESS; 01389 if(HandlePtr->kTimerConcatenation == (uint8_t)SET) 01390 { 01391 *EvtStatus = RD_REG(HandlePtr->CC8yRegs1Ptr->INTS, (0x01U <<(uint8_t) Event),(uint8_t) Event) ? (uint8_t)SET : (uint8_t)RESET; 01392 } 01393 else 01394 { 01395 *EvtStatus = RD_REG(HandlePtr->CC8yRegsPtr->INTS, (0x01U <<(uint8_t) Event), (uint8_t)Event) ? (uint8_t)SET : (uint8_t)RESET; 01396 } 01397 return (Status); 01398 } 01399 #endif 01400 01404 /*CODE_BLOCK_END*/ 01405