⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 etpuc_ppa.c

📁 mpc55**系列芯片的例程 包括SCI,SPI,TIMER,FIT,EDMA等几乎所有功能的实现
💻 C
📖 第 1 页 / 共 4 页
字号:
				 			| Conditions under which this state is executed:-                           |
				 			|   Measurement =Active                                                     |
				 			|   LastPin = Low                                                           |
				 			|   Transition occurred                                                     |
				 			|   Mode is Period measurement                                              |
              |Falling edge of rising edge period measurement OR                          |
              |rising edge of falling edge period measurement				 			                |
              |Clear transition detect latch                                              |
							|Add TCRs elapsed between this event and the previous event to Accum        |
							|If Accum overflows send a Channel Interrupt and DMA Request                |
				 			|Record erta in LastTime                                                    |
				 			|Schedule a match SampleTime in the future                                  |
						  |If sufficient Periods have been accumulated update Result with Accum       |
						  |  and Status takes the value of StatAcc; StatAcc get set to 0              |
				 			| Measurement remains Active                                                |
				 			+--------------------------------------------------------------------------*/

                 ClearTransLatch();
                 AccumTime();
                 Read1Retrig();
                 CheckCount();           /* measurement always stays active in period mode, until re-initialized */
              }
          }
          else    /* it is a match */
          {
					/*--------------------------------------------------------------------------+
					| STATE NAME: MATCH3                                                        |
					| Conditions under which this state is executed:-                           |
					|   Measurement = Active                                                    |
					|   LastPin = Low                                                           |
					|   Match occurred                                                          |
					|Add TCRs elapsed between this event and the previous event to Accum        |
					|If Accum overflows send a Channel Interrupt and DMA Request                |
				 	|Record erta in LastTime                                                    |
				 	|Clear match flagA                                                          |
				 	|Schedule a match SampleTime in the future                                  |
					|                                                                           |
					+--------------------------------------------------------------------------*/

              AccumTime();
              Read1Retrig();
          }    /* end Transition_A */
      } /* end Measurement active service request, LastPin low */
/*--------------------------------------------------------------------------+
| THREAD NAME: THREAD6                                                      |
| DESCRIPTION:                                                              |
| Measurement active service request, LastPin high                          |
| If entered due to a transition; then:                                     |
| 	Latch the pin state and clear transition detect latch                   |
|   Set LastPin to the sample pin state                                     |
|   Execute state TRANS14 or TRANS15 or TRANS16 dependant upon              |
|     PulseMeasurement/PinSampledState                                      |
| Else must have been entered due to a match; then                          |
|   Execute state MATCH4                                                    |
| NB Can't be period measurement because LastPin must be 0 for Period       |
|    Measurement                                                            |
|                                                                           |
+--------------------------------------------------------------------------*/
else if (((Measurement==Active) && (LastPin==High) && m1) ||
 			   ((Measurement==Active) && (LastPin==High) && m2))
      {
          if (Transition_A)
          {
              CheckPin();
              Assign(LastPin,SampledInputPin);	/* update Last_Pin state */
              if (HighPulse)
              {
                  if (SampledInputPin == 0)        /* Stop normal high measurement */
                  {
								  /*--------------------------------------------------------------------------+
									| STATE NAME: TRANS14                                                       |
						   		| Conditions under which this state is executed:-                           |
							 		|   Measurement = active                                                    |
							 		|   LastPin = HIgh                                                          |
							 		|   Transition occurred                                                     |
							 		|   Mode is High pulse measurement                                          |
							 		|   Channel.PSS is 0                                                        |
							 		|Stop High Pulse Measurement                                                |
									|Add TCRs elapsed between this event and the previous event to Accum        |
									|If Accum overflows send a Channel Interrupt and DMA Request                |
						   		|If sufficient Periods have been accumulated update Result with Accum       |
						   		|  and Status takes the value of StatAcc; StatAcc get set to 0              |
						   		|Measurement set to Inactive                                                |
									|                                                                           |
								  +--------------------------------------------------------------------------*/

                      AccumTime();
                      CheckCount();    /* Update measurement if all done */
                      Measurement = Inactive;
                  }
                  else	               /* A narrow negative pulse occurred */
                  {
							    /*--------------------------------------------------------------------------+
								  | STATE NAME: TRANS15                                                       |
						  		| Conditions under which this state is executed:-                           |
									|   Measurement = active                                                    |
									|   LastPin = High                                                          |
									|   Transition occurred                                                     |
									|   Mode is High pulse measurement                                          |
							 		|   Channel.PSS is 1                                                        |
							 		|A short negative pulse occurred                                            |
									|Add TCRs elapsed between this event and the previous event to Accum        |
									|If Accum overflows send a Channel Interrupt and DMA Request                |
						   		|Record ertb in LastTime                                                    |
            		  |Clear match flagA                                                          |
						   		|Schedule a match SampleTime in the future                                  |
						   		|If sufficient Periods have been accumulated update Result with Accum       |
						   		|  and Status takes the value of StatAcc; StatAcc get set to 0              |
						   		|Measurement remains Active                                                 |
									|                                                                           |
									+--------------------------------------------------------------------------*/

                      AccumTime();     /* Accumulate time to falling edge */
                      Read2Retrig();   /* start next measurement on second edge (measurement stays active) */
                      CheckCount();    /* and update measurement if all done */

                  }
              }
              else	               /* Illegal state for Low pulse measurement - should never happen */
              {
							/*--------------------------------------------------------------------------+
							| STATE NAME: TRANS16                                                       |
						  | Conditions under which this state is executed:-                           |
							|   Measurement = active                                                    |
							|   LastPin = High                                                          |
							|   Transition occurred                                                     |
							|   Mode is Low pulse measurement                                           |
							|Illegal state for Low pulse measurement                                    |
							|Set LowPulseError flag in StatAcc                                          |
							|Set Measurement to Inactive                                                |
							|                                                                           |
							+--------------------------------------------------------------------------*/

                  this.StatAcc = this.StatAcc | LowPulseError;
                  Measurement = Inactive;    /* Disable measurement */
              }
          }
          else    /* it is a match */
          {
 					/*--------------------------------------------------------------------------+
					| STATE NAME: MATCH4                                                        |
					| Conditions under which this state is executed:-                           |
					|   Measurement = active                                                    |
					|   LastPin = High                                                          |
					|   Match occurred                                                          |
					|Add TCRs elapsed between this event and the previous event to Accum        |
					|If Accum overflows send a Channel Interrupt and DMA Request                |
				 	|Record erta in LastTime                                                    |
				 	|Clear match flagA                                                          |
				 	|Schedule a match SampleTime in the future                                  |
					|                                                                           |
					+--------------------------------------------------------------------------*/

              AccumTime();
              Read1Retrig();
          }    /* end Transition_A */
      } /* end Measurement active service request, LastPin High */

	  else
		/*--------------------------------------------------------------------------+
		| THREAD NAME: THREAD7                                                      |
		| DESCRIPTION: Something has gone wrong. :-(                                |
		|                Call the Global error routine if available and end.        |
		+--------------------------------------------------------------------------*/
	  {
#ifdef GLOBAL_ERROR_FUNC
        Global_Error_Func();
#else
		ClearAllLatches();
#endif
	  }
}

/* Information exported to Host CPU program */
#pragma write h, (::ETPUfilename (cpu/etpu_ppa_auto.h));
#pragma write h, ( );
#pragma write h, (/****************************************************************);
#pragma write h, ( * WARNING this file is automatically generated DO NOT EDIT IT! *);
#pragma write h, ( *                                                              *);
#pragma write h, ( * FILE NAME: etpu_ppa_auto.c      COPYRIGHT (c) Freescale 2004 *);
#pragma write h, ( *                                      All Rights Reserved     *);
#pragma write h, ( * This file generated by:                                      *);
#pragma write h, ( * $RCSfile: etpuc_ppa.c,v $ $Revision: 1.2 $);
#pragma write h, ( *                                                              *);
#pragma write h, ( * This file provides an interface between eTPU code and CPU    *);
#pragma write h, ( * code. All references to the PPA function should be made with *);
#pragma write h, ( * information in this file. This allows only symbolic          *);
#pragma write h, ( * information to be referenced which allows the eTPU code to be*);
#pragma write h, ( * optimized without effecting the CPU code.                    *);
#pragma write h, ( ****************************************************************/);
#pragma write h, (#ifndef _ETPU_PPA_AUTO_H_ );
#pragma write h, (#define _ETPU_PPA_AUTO_H_ );
#pragma write h, ( );
#pragma write h, (/* Function Configuration Information */);
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_FUNCTION_NUMBER) PPA_FUNCTION_NUMBER );
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_TABLE_SELECT) ::ETPUentrytype(PPA) );
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_NUM_PARMS) ::ETPUram(PPA) );
#pragma write h, ( );
#pragma write h, (/* Host Service Request Definitions -timer options*/);
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_INIT_TCR1) INIT_TCR1  );
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_INIT_TCR2) INIT_TCR2  );
#pragma write h, ( );
#pragma write h, (/* Function Mode Bit Definitions - pulse/period measurement options - mode options*/);
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_LOW_PULSE) PulseLow  );
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_HIGH_PULSE) PulseHigh  );
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_FALLING_EDGE) PeriodFall  );
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_RISING_EDGE) PeriodRise  );
#pragma write h, ( );
#pragma write h, (/* Parameter Definitions */);
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_ACCUM_OFFSET) ::ETPUlocation (PPA, this.Accum) );
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_SAMPLE_TIME_OFFSET) ::ETPUlocation (PPA, this.SampleTime) );
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_PERIOD_COUNT_OFFSET) ::ETPUlocation (PPA, this.PeriodCount) );
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_MAX_COUNT_OFFSET) ::ETPUlocation (PPA, this.MaxCount) );
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_RESULT_OFFSET) ::ETPUlocation (PPA, this.Result) );
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_STAT_ACC_OFFSET) ::ETPUlocation (PPA, this.StatAcc) );
#pragma write h, (::ETPUliteral(#define FS_ETPU_PPA_STATUS_OFFSET) ::ETPUlocation (PPA, this.Status) );
#pragma write h, ( );
#pragma write h, (#endif /* _ETPU_PPA_AUTO_H_ */);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -