PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
mft_wfg.c
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2013 Spansion LLC. All Rights Reserved.
3 *
4 * This software is owned and published by:
5 * Spansion LLC, 915 DeGuigne Dr. Sunnyvale, CA 94088-3453 ("Spansion").
6 *
7 * BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
8 * BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
9 *
10 * This software contains source code for use with Spansion
11 * components. This software is licensed by Spansion to be adapted only
12 * for use in systems utilizing Spansion components. Spansion shall not be
13 * responsible for misuse or illegal use of this software for devices not
14 * supported herein. Spansion is providing this software "AS IS" and will
15 * not be responsible for issues arising from incorrect user implementation
16 * of the software.
17 *
18 * SPANSION MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
19 * REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
20 * ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
21 * WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
22 * WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
23 * WARRANTY OF NONINFRINGEMENT.
24 * SPANSION SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
25 * NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
26 * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
27 * LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
28 * INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
29 * INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
30 * SAVINGS OR PROFITS,
31 * EVEN IF SPANSION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32 * YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
33 * INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
34 * FROM, THE SOFTWARE.
35 *
36 * This software may be replicated in part or whole for the licensed use,
37 * with the restriction that this Disclaimer and Copyright notice must be
38 * included with each copy of this software, whether used in part or whole,
39 * at all times.
40 */
41 /******************************************************************************/
53 /******************************************************************************/
54 /* Include files */
55 /******************************************************************************/
56 #include "mft_wfg.h"
57 
58 
59 #if (defined(PDL_PERIPHERAL_MFT_WFG_ACTIVE))
60 
66 
67 /******************************************************************************/
68 /* Local pre-processor symbols/macros ('#define') */
69 /******************************************************************************/
71 #define WFG_INSTANCE_COUNT (uint32_t)(sizeof(m_astcMftWfgInstanceDataLut) \
72  / sizeof(m_astcMftWfgInstanceDataLut[0]))
73 
74 /******************************************************************************/
75 /* Global variable definitions (declared in header file with 'extern') */
76 /******************************************************************************/
79 {
80 #if (PDL_PERIPHERAL_ENABLE_MFT0_WFG == PDL_ON)
81  {
82  &MFT0_WFG, // pstcInstance
83  NULL // stcInternData (not initialized yet)
84  },
85 #endif
86 #if (PDL_PERIPHERAL_ENABLE_MFT1_WFG == PDL_ON)
87  {
88  &MFT1_WFG, // pstcInstance
89  NULL // stcInternData (not initialized yet)
90  },
91 #endif
92 #if (PDL_PERIPHERAL_ENABLE_MFT2_WFG == PDL_ON)
93  {
94  &MFT2_WFG, // pstcInstance
95  NULL // stcInternData (not initialized yet)
96  },
97 #endif
98 };
99 
100 /******************************************************************************/
101 /* Local type definitions ('typedef') */
102 /******************************************************************************/
103 
104 /******************************************************************************/
105 /* Local function prototypes ('static') */
106 /******************************************************************************/
107 
108 /******************************************************************************/
109 /* Local variable definitions ('static') */
110 /******************************************************************************/
111 
112 /******************************************************************************/
113 /* Function implementation - global ('extern') and local ('static') */
114 /******************************************************************************/
126 {
127  uint32_t u32Instance;
128 
129  for (u32Instance = 0; u32Instance < WFG_INSTANCE_COUNT; u32Instance++)
130  {
131  if (pstcWfg == m_astcMftWfgInstanceDataLut[u32Instance].pstcInstance)
132  {
133  return &m_astcMftWfgInstanceDataLut[u32Instance].stcInternData;
134  }
135  }
136 
137  return NULL;
138 }
139 
140 #if (PDL_INTERRUPT_ENABLE_MFT0_WFG == PDL_ON) || \
141  (PDL_INTERRUPT_ENABLE_MFT1_WFG == PDL_ON) || \
142  (PDL_INTERRUPT_ENABLE_MFT2_WFG == PDL_ON)
143 
158 void Mft_Wfg_IrqHandler( volatile stc_mftn_wfg_t*pstcMft,
159  stc_mft_wfg_intern_data_t* pstcMftWfgInternData)
160 {
161  func_ptr_t funCallBack;
162  uint32_t* ptemp;
163  uint8_t ch;
164 
165  /* timer interrupt*/
166  for(ch=0;ch<3;ch++)
167  {
168  if(PdlSet == Mft_Wfg_GetTimerIntFlag(pstcMft,ch))
169  {
170  /* Clear Interrupt */
171  Mft_Wfg_ClrTimerIntFlag(pstcMft,ch);
172 
173  //get peak timer interrupt callback address of each channel
174  ptemp = (uint32_t*)&(pstcMftWfgInternData->pfnWfg10TimerCallback);
175  funCallBack = (func_ptr_t)(*(uint32_t*)((uint32_t)ptemp +
176  (sizeof(func_ptr_t) * ch)));
177 
178  if(funCallBack != NULL)
179  {
180  funCallBack();
181  }
182  }
183  }
184 
185  /* DTIF Interrupt */
186  //Digital filter interrupt
188  {
189  //Mft_Wfg_ClrDigitalFilterIntFlag(pstcMft);
190  funCallBack = pstcMftWfgInternData->pfnWfgDigtalFilterCallback;
191  if(funCallBack != NULL)
192  {
193  funCallBack();
194  }
195  }
196 
197  //analog filter interrupt
198  if(PdlSet == Mft_Wfg_GetAnalogFilterIntFlag(pstcMft))
199  {
200  //Mft_Wfg_ClrAnalogFilterIntFlag(pstcMft);
201  funCallBack = pstcMftWfgInternData->pfnWfgAnalogFilterCallback;
202  if(funCallBack != NULL)
203  {
204  funCallBack();
205  }
206  }
207 }
208 
219 static en_result_t Mft_Wfg_InitIrq( volatile stc_mftn_wfg_t* pstcMft )
220 {
221 #if (PDL_INTERRUPT_ENABLE_MFT0_WFG == PDL_ON)
222  if (pstcMft == (stc_mftn_wfg_t*)(&MFT0_WFG))
223  {
224  NVIC_ClearPendingIRQ(WFG0_DTIF0_IRQn);
225  NVIC_EnableIRQ(WFG0_DTIF0_IRQn);
226  NVIC_SetPriority(WFG0_DTIF0_IRQn, PDL_IRQ_LEVEL_MFT0_WFG);
227  }
228 #endif
229 #if (PDL_INTERRUPT_ENABLE_MFT1_WFG == PDL_ON)
230  if (pstcMft == (stc_mftn_wfg_t*)(&MFT1_WFG))
231  {
232  NVIC_ClearPendingIRQ(WFG1_DTIF1_IRQn);
233  NVIC_EnableIRQ(WFG1_DTIF1_IRQn);
234  NVIC_SetPriority(WFG1_DTIF1_IRQn, PDL_IRQ_LEVEL_MFT1_WFG);
235  }
236 #endif
237 #if (PDL_INTERRUPT_ENABLE_MFT2_WFG == PDL_ON)
238  if (pstcMft == (stc_mftn_wfg_t*)(&MFT2_WFG))
239  {
240  NVIC_ClearPendingIRQ(WFG2_DTIF2_IRQn);
241  NVIC_EnableIRQ(WFG2_DTIF2_IRQn);
242  NVIC_SetPriority(WFG2_DTIF2_IRQn, PDL_IRQ_LEVEL_MFT2_WFG);
243  }
244 #endif
245  return Ok;
246 }
247 
257 static en_result_t Mft_Wfg_DeInitIrq( volatile stc_mftn_wfg_t* pstcMft )
258 {
259  if((pstcMft->NZCL & 0x7300) == 0x7300) // DIMA=DIMB=WIM10=WIM32=WIM54=1
260  {
261  #if (PDL_INTERRUPT_ENABLE_MFT0_WFG == PDL_ON)
262  if (pstcMft == (stc_mftn_wfg_t*)(&MFT0_WFG))
263  {
264  NVIC_ClearPendingIRQ(WFG0_DTIF0_IRQn);
265  NVIC_DisableIRQ(WFG0_DTIF0_IRQn);
266  NVIC_SetPriority(WFG0_DTIF0_IRQn, PDL_DEFAULT_INTERRUPT_LEVEL);
267  }
268  #endif
269  #if (PDL_INTERRUPT_ENABLE_MFT1_WFG == PDL_ON)
270  if (pstcMft == (stc_mftn_wfg_t*)(&MFT1_WFG))
271  {
272  NVIC_ClearPendingIRQ(WFG1_DTIF1_IRQn);
273  NVIC_DisableIRQ(WFG1_DTIF1_IRQn);
274  NVIC_SetPriority(WFG1_DTIF1_IRQn, PDL_DEFAULT_INTERRUPT_LEVEL);
275  }
276  #endif
277  #if (PDL_INTERRUPT_ENABLE_MFT2_WFG == PDL_ON)
278  if (pstcMft == (stc_mftn_wfg_t*)(&MFT2_WFG))
279  {
280  NVIC_ClearPendingIRQ(WFG2_DTIF2_IRQn);
281  NVIC_DisableIRQ(WFG2_DTIF2_IRQn);
282  NVIC_SetPriority(WFG2_DTIF2_IRQn, PDL_DEFAULT_INTERRUPT_LEVEL);
283  }
284  #endif
285  }
286  return Ok;
287 }
288 
289 #endif
290 
291 /******************************************************************************/
292 /* Local Functions */
293 /******************************************************************************/
294 
314  uint8_t u8CoupleCh, en_mft_wfg_mode_t enMode)
315 {
316  stc_mft_wfg_wfsa10_field_t* pstcWFSA;
317  stc_mft_wfg_intern_data_t* pstcWfgInternData;
318 
319  // Check for NULL pointer
320  if ( (pstcMft == NULL)
321  || (u8CoupleCh >= MFT_WFG_MAXCH))
322  {
323  return ErrorInvalidParameter ;
324  }
325  // Get pointer to internal data structure ...
326  pstcWfgInternData = MftGetInternDataPtr( pstcMft ) ;
327 
328  // ... and check for NULL
329  if ( pstcWfgInternData != NULL )
330  {
331  pstcWfgInternData->pfnWfg10TimerCallback = NULL;
332  pstcWfgInternData->pfnWfg32TimerCallback = NULL;
333  pstcWfgInternData->pfnWfg54TimerCallback = NULL;
334  }
335 
336  //Get pointer of current channel WFG register address
337  pstcWFSA = (stc_mft_wfg_wfsa10_field_t*)((uint8_t*)pstcMft + 0xA4UL + u8CoupleCh*4);
338 
339  //configure WFG mode
340  pstcWFSA->TMD = (uint16_t)enMode;
341 
342  return Ok;
343 }
344 
362 en_result_t Mft_Wfg_ConfigCtrlBits( volatile stc_mftn_wfg_t*pstcMft,uint8_t u8CoupleCh,
363  stc_wfg_ctrl_bits* pstcCtrlBits)
364 {
365  stc_mft_wfg_wfsa10_field_t* pstcWFSA;
366 
367  // Check for NULL pointer
368  if ( (pstcMft == NULL)
369  || (u8CoupleCh >= MFT_WFG_MAXCH))
370  {
371  return ErrorInvalidParameter ;
372  }
373 
374  //Get pointer of current channel WFG register address
375  pstcWFSA = (stc_mft_wfg_wfsa10_field_t*)((uint8_t*)pstcMft + 0xA4UL + u8CoupleCh*4);
376 
377  //set register
378  pstcWFSA->DMOD = pstcCtrlBits->enDmodBit;
379  pstcWFSA->PGEN0 = (pstcCtrlBits->enPgenBits >> 0) & 0x01;
380  pstcWFSA->PGEN1 = (pstcCtrlBits->enPgenBits >> 1) & 0x01;
381  pstcWFSA->PSEL0 = (pstcCtrlBits->enPselBits >> 0) & 0x01;
382  pstcWFSA->PSEL1 = (pstcCtrlBits->enPselBits >> 1) & 0x01;
383  pstcWFSA->GTEN0 = (pstcCtrlBits->enGtenBits >> 0) & 0x01;
384  pstcWFSA->GTEN1 = (pstcCtrlBits->enGtenBits >> 1) & 0x01;
385 
386  return Ok;
387 }
388 
406 en_result_t Mft_Wfg_InitTimerClock( volatile stc_mftn_wfg_t*pstcMft,uint8_t u8CoupleCh,
407  en_wfg_timer_clock_t enClk)
408 {
409  stc_mft_wfg_wfsa10_field_t* pstcWFSA;
410 
411  // Check for NULL pointer
412  if ( (pstcMft == NULL)
413  || (u8CoupleCh >= MFT_WFG_MAXCH))
414  {
415  return ErrorInvalidParameter ;
416  }
417 
418  //Get pointer of current channel WFG register address
419  pstcWFSA = (stc_mft_wfg_wfsa10_field_t*)((uint8_t*)pstcMft + 0xA4UL + u8CoupleCh*4);
420 
421  //set count clock
422  pstcWFSA->DCK0 = (enClk >> 0) & 0x01;
423  pstcWFSA->DCK1 = (enClk >> 1) & 0x01;
424  pstcWFSA->DCK2 = (enClk >> 2) & 0x01;
425 
426  return Ok;
427 }
428 
429 #if (PDL_INTERRUPT_ENABLE_MFT0_WFG == PDL_ON) || \
430  (PDL_INTERRUPT_ENABLE_MFT1_WFG == PDL_ON) || \
431  (PDL_INTERRUPT_ENABLE_MFT2_WFG == PDL_ON)
432 
450  uint8_t u8CoupleCh, func_ptr_t pfnCallback)
451 {
452  stc_mft_wfg_intern_data_t* pstcWfgInternData;
453 
454  // Check for NULL pointer
455  if ( (pstcMft == NULL)
456  || (u8CoupleCh >= MFT_WFG_MAXCH))
457  {
458  return ErrorInvalidParameter ;
459  }
460 
461  // Get pointer to internal data structure ...
462  pstcWfgInternData = MftGetInternDataPtr( pstcMft ) ;
463 
464  switch(u8CoupleCh)
465  {
466  case MFT_WFG_CH10:
467  pstcWfgInternData->pfnWfg10TimerCallback = pfnCallback;
468  pstcMft->NZCL_f.WIM10 = 0;
469  break;
470  case MFT_WFG_CH32:
471  pstcWfgInternData->pfnWfg32TimerCallback = pfnCallback;
472  pstcMft->NZCL_f.WIM32 = 0;
473  break;
474  case MFT_WFG_CH54:
475  pstcWfgInternData->pfnWfg54TimerCallback = pfnCallback;
476  pstcMft->NZCL_f.WIM54 = 0;
477  break;
478  }
479 
480  Mft_Wfg_InitIrq(pstcMft);
481 
482  return Ok;
483 }
484 
500 en_result_t Mft_Wfg_DisableTimerInt( volatile stc_mftn_wfg_t*pstcMft, uint8_t u8CoupleCh)
501 {
502  stc_mft_wfg_intern_data_t* pstcWfgInternData;
503 
504  // Check for NULL pointer
505  if ( (pstcMft == NULL)
506  || (u8CoupleCh >= MFT_WFG_MAXCH))
507  {
508  return ErrorInvalidParameter ;
509  }
510 
511  // Get pointer to internal data structure ...
512  pstcWfgInternData = MftGetInternDataPtr( pstcMft ) ;
513 
514  switch(u8CoupleCh)
515  {
516  case MFT_WFG_CH10:
517  pstcWfgInternData->pfnWfg10TimerCallback = NULL;
518  pstcMft->NZCL_f.WIM10 = 1;
519  break;
520  case MFT_WFG_CH32:
521  pstcWfgInternData->pfnWfg32TimerCallback = NULL;
522  pstcMft->NZCL_f.WIM32 = 1;
523  break;
524  case MFT_WFG_CH54:
525  pstcWfgInternData->pfnWfg54TimerCallback = NULL;
526  pstcMft->NZCL_f.WIM54 = 1;
527  break;
528  }
529 
530  Mft_Wfg_DeInitIrq(pstcMft);
531 
532  return Ok;
533 }
534 
535 #endif
536 
552 en_result_t Mft_Wfg_StartTimer(volatile stc_mftn_wfg_t*pstcMft, uint8_t u8CoupleCh)
553 {
554  if ( (pstcMft == NULL)
555  || (u8CoupleCh >= MFT_WFG_MAXCH))
556  {
557  return ErrorInvalidParameter ;
558  }
559 
560  switch(u8CoupleCh)
561  {
562  case MFT_WFG_CH10:
563  pstcMft->WFIR_f.TMIE10 = 1;
564  break;
565  case MFT_WFG_CH32:
566  pstcMft->WFIR_f.TMIE32 = 1;
567  break;
568  case MFT_WFG_CH54:
569  pstcMft->WFIR_f.TMIE54 = 1;
570  break;
571  default:
572  break;
573  }
574 
575  return Ok;
576 }
577 
593 en_result_t Mft_Wfg_StopTimer(volatile stc_mftn_wfg_t*pstcMft, uint8_t u8CoupleCh)
594 {
595  if ( (pstcMft == NULL)
596  || (u8CoupleCh >= MFT_WFG_MAXCH))
597  {
598  return ErrorInvalidParameter ;
599  }
600 
601  switch(u8CoupleCh)
602  {
603  case MFT_WFG_CH10:
604  pstcMft->WFIR_f.TMIS10 = 1;
605  break;
606  case MFT_WFG_CH32:
607  pstcMft->WFIR_f.TMIS32 = 1;
608  break;
609  case MFT_WFG_CH54:
610  pstcMft->WFIR_f.TMIS54 = 1;
611  break;
612  default:
613  break;
614  }
615 
616  return Ok;
617 }
618 
619 
634 en_int_flag_t Mft_Wfg_GetTimerIntFlag( volatile stc_mftn_wfg_t*pstcMft,uint8_t u8CoupleCh)
635 {
636  en_int_flag_t retval;
637 
638  switch(u8CoupleCh)
639  {
640  case MFT_WFG_CH10:
641  retval = (en_int_flag_t)pstcMft->WFIR_f.TMIF10;
642  break;
643  case MFT_WFG_CH32:
644  retval = (en_int_flag_t)pstcMft->WFIR_f.TMIF32;
645  break;
646  case MFT_WFG_CH54:
647  retval = (en_int_flag_t)pstcMft->WFIR_f.TMIF54;
648  break;
649  }
650 
651  return retval;
652 }
653 
669 en_result_t Mft_Wfg_ClrTimerIntFlag( volatile stc_mftn_wfg_t*pstcMft, uint8_t u8CoupleCh)
670 {
671  // Check for NULL pointer
672  if ( (pstcMft == NULL)
673  || (u8CoupleCh >= MFT_WFG_MAXCH))
674  {
675  return ErrorInvalidParameter ;
676  }
677 
678  //set register value
679  switch(u8CoupleCh)
680  {
681  case MFT_WFG_CH10:
682  pstcMft->WFIR_f.TMIC10 = 1;
683  break;
684  case MFT_WFG_CH32:
685  pstcMft->WFIR_f.TMIC32 = 1;
686  break;
687  case MFT_WFG_CH54:
688  pstcMft->WFIR_f.TMIC54 = 1;
689  break;
690  }
691 
692  return Ok;
693 }
694 
715  uint8_t u8CoupleCh,
716  uint16_t u16CycleA,
717  uint16_t u16CycleB)
718 {
719  uint16_t* pWFTA;
720  uint16_t* pWFTB;
721 
722  // Check for NULL pointer
723  if ( (pstcMft == NULL)
724  || (u8CoupleCh >= MFT_WFG_MAXCH))
725  {
726  return ErrorInvalidParameter ;
727  }
728 
729  //Get pointer of current channel WFG register address
730  pWFTA = (uint16_t*)((uint8_t*)pstcMft + 0x90UL + u8CoupleCh*8);
731  pWFTB = (uint16_t*)((uint8_t*)pstcMft + 0x92UL + u8CoupleCh*8);
732 
733  //set the register
734  *pWFTA = u16CycleA;
735  *pWFTB = u16CycleB;
736 
737  return Ok;
738 
739 }
740 
759  uint8_t u8CoupleCh, uint16_t u16Count)
760 {
761  uint16_t* pWFTF;
762 
763  //Get pointer of current channel WFG register address
764  pWFTF = (uint16_t*)((uint8_t*)pstcMft + 0x8EUL + u8CoupleCh*8);
765 
766  *pWFTF =u16Count;
767  return Ok;
768 }
783 uint16_t Mft_Wfg_GetTimerCurCycle( volatile stc_mftn_wfg_t*pstcMft, uint8_t u8CoupleCh)
784 {
785  uint16_t retval;
786  uint16_t* pWFTF;
787 
788  //Get pointer of current channel WFG register address
789  pWFTF = (uint16_t*)((uint8_t*)pstcMft + 0x8EUL + u8CoupleCh*8);
790 
791  retval = *pWFTF;
792  return retval;
793 }
794 
811  stc_wfg_nzcl_config_t* pstcNzclConfig)
812 {
813  // Check for NULL pointer
814  if ( (pstcMft == NULL))
815  {
816  return ErrorInvalidParameter ;
817  }
818 
819  //set register value
820  pstcMft->NZCL_f.DTIEA = pstcNzclConfig->bEnDigitalFilter;
821  pstcMft->NZCL_f.DTIEB = pstcNzclConfig->bEnAnalogFilter;
822  pstcMft->NZCL &= ~(7ul<<1);
823  pstcMft->NZCL |= (pstcNzclConfig->enDigitalFilterWidth <<1 );
824  if(pstcMft == &MFT0_WFG)
825  {
826  bFM4_GPIO_EPFR01_DTTI0C = pstcNzclConfig->bSwitchToGpio;
827  }
828  else if (pstcMft == &MFT1_WFG)
829  {
830  bFM4_GPIO_EPFR02_DTTI1C = pstcNzclConfig->bSwitchToGpio;
831  }
832  else if(pstcMft == &MFT2_WFG)
833  {
834  bFM4_GPIO_EPFR03_DTTI2C = pstcNzclConfig->bSwitchToGpio;
835  }
836  return Ok;
837 }
838 
839 #if (PDL_INTERRUPT_ENABLE_MFT0_WFG == PDL_ON) || \
840  (PDL_INTERRUPT_ENABLE_MFT1_WFG == PDL_ON) || \
841  (PDL_INTERRUPT_ENABLE_MFT2_WFG == PDL_ON)
842 
859  stc_dtif_int_cb_t* pstcCallback)
860 {
861  stc_mft_wfg_intern_data_t* pstcWfgInternData;
862  // Check for NULL pointer
863  if ((pstcMft == NULL ) ||
864  (pstcIntSel->bDtifAnalogFilterInt > 1) ||
865  (pstcIntSel->bDtifDigitalFilterInt > 1))
866  {
867  return ErrorInvalidParameter ;
868  }
869 
870  // Get pointer to internal data structure ...
871  pstcWfgInternData = MftGetInternDataPtr( pstcMft ) ;
872 
873  if(TRUE == pstcIntSel->bDtifDigitalFilterInt)
874  {
875  pstcMft->NZCL_f.DIMA = 0;
876  pstcWfgInternData->pfnWfgDigtalFilterCallback = pstcCallback->pfnWfgDigtalFilterCallback;
877 
878  }
879  if(TRUE == pstcIntSel->bDtifAnalogFilterInt)
880  {
881  pstcMft->NZCL_f.DIMB = 0;
882  pstcWfgInternData->pfnWfgAnalogFilterCallback = pstcCallback->pfnWfgAnalogFilterCallback;
883  }
884 
885  Mft_Wfg_InitIrq(pstcMft);
886 
887  return Ok;
888 }
889 
905 {
906  stc_mft_wfg_intern_data_t* pstcWfgInternData;
907  // Check for NULL pointer
908  if ( (pstcMft == NULL) ||
909  (pstcIntSel->bDtifAnalogFilterInt > 1) ||
910  (pstcIntSel->bDtifDigitalFilterInt > 1)
911  )
912  {
913  return ErrorInvalidParameter ;
914  }
915 
916  // Get pointer to internal data structure ...
917  pstcWfgInternData = MftGetInternDataPtr( pstcMft ) ;
918 
919  if(TRUE == pstcIntSel->bDtifDigitalFilterInt)
920  {
921  pstcMft->NZCL_f.DIMA = 1;
922  pstcWfgInternData->pfnWfgDigtalFilterCallback = NULL;
923 
924  }
925  if(TRUE == pstcIntSel->bDtifAnalogFilterInt)
926  {
927  pstcMft->NZCL_f.DIMB = 1;
928  pstcWfgInternData->pfnWfgAnalogFilterCallback = NULL;
929  }
930 
931  Mft_Wfg_DeInitIrq(pstcMft);
932 
933  return Ok;
934 }
935 
936 #endif
937 
952 {
953  // Check for NULL pointer
954  if ( (pstcMft == NULL))
955  {
956  return ErrorInvalidParameter ;
957  }
958 
959  pstcMft->NZCL_f.SDTI = 1;
960  return Ok;
961 }
962 
976 {
977  en_int_flag_t retval;
978 
979  //get interrupt flag via digital noise-canceler
980  retval = (en_int_flag_t)pstcMft->WFIR_f.DTIFA;
981  return retval;
982 }
983 
998 {
999  // Check for NULL pointer
1000  if ( (pstcMft == NULL))
1001  {
1002  return ErrorInvalidParameter ;
1003  }
1004 
1005  pstcMft->WFIR_f.DTICA = 1;
1006  return Ok;
1007 }
1008 
1022 {
1023  en_int_flag_t retval;
1024 
1025  //get interrupt flag via analog noise filter
1026  retval =(en_int_flag_t) pstcMft->WFIR_f.DTIFB;
1027  return retval;
1028 }
1043 {
1044  // Check for NULL pointer
1045  if ( (pstcMft == NULL))
1046  {
1047  return ErrorInvalidParameter ;
1048  }
1049 
1050  pstcMft->WFIR_f.DTICB = 1;
1051  return Ok;
1052 }
1053 
1055 
1056 #endif // #if (defined(PDL_PERIPHERAL_$$X_ACTIVE))
1057 
1058 /******************************************************************************/
1059 /* EOF (not truncated) */
1060 /******************************************************************************/