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

📄 main.c

📁 freescale 协处理器应用相关实例
💻 C
📖 第 1 页 / 共 2 页
字号:
      /* value. the other changes can be ignored */

            /* disable the EEE */
   ftmStat = LaunchFlashCommand(1 ,DISABLE_EEPROM_EMULATION, 0, 0, 0, 0, 0, 0);
   if ((ftmStat & (ACCERR|FPVIOL|MGSTAT1|MGSTAT0)))
      Error(ftmStat);    
   
            /* and here we trash the EEE value to see what reset or power down does */

   EEE_Int[0] = 0xDEAD;
            /* and read it */
   temp = EEE_Int[0];    
   
   while(1) /* now reset the part and reload this binary. The value at EEE_Int[0] should still be 0x6000 */
   {
   
            
   
   }
}


/******************************************************************************
Function Name	:	Error
Engineer		   :	r32151
Date			   :	02/05/06
Parameters		:	error code
Returns			:	NONE
Notes			   :	Flashes an error code on the LEDS
******************************************************************************/
void 
Error(unsigned char error_code)					
{
   while(1) 
   {
   }
}

/******************************************************************************
Function Name	:	Delay
Engineer		   :	r32151
Date			   :	02/06/00
Parameters		:	unsigned int delayTime
Returns			:	NONE
Notes			   :	Simple software delay dependent on CPU clock frequency and
					   compile strategy 
******************************************************************************/
void 
Delay(unsigned int delayTime)					
{
   unsigned int x;						 /*outer loop counter */
  	char y;									 /*inner loop counter */

  	for (x=0; x<delayTime; x++)
  	{	
  		for (y=0; y<100; y++)
  		{} 
	}
}

/*****************************************************************************/
/********* interrupt SERVICE ROUTINES - Non-Maskable vectors shown ***********/
/*****************************************************************************/
#pragma CODE_SEG __NEAR_SEG NON_BANKED 

/******************************************************************************  
Function Name  : System_Call_ISR	  ===== non maskable
Engineer       : 	
Date           : 
Parameters     : NONE
Returns        : NONE
Notes          : 
******************************************************************************/
interrupt void System_Call_ISR(void) {
   asm NOP;		 /* to avoid unintentional single stepping of BGND instruction */
   asm BGND;
}

/******************************************************************************  
Function Name  : Spurious_ISR		  ===== non maskable
Engineer       : r32151	
Date           : 06/05/2003
Parameters     : NONE
Returns        : NONE
Notes          : interrupt service routine for unused interrupt vectors. 
******************************************************************************/
interrupt void Spurious_ISR(void) {
   asm NOP;		 /* to avoid unintentional single stepping of BGND instruction */
   asm BGND;
}

/******************************************************************************  
Function Name  : XGATE_Error_ISR	  ===== non maskable										
Engineer       : r32151	
Date           : 06/05/2003
Parameters     : NONE
Returns        : NONE
Notes          : interrupt service routine for unused interrupt vectors. 
******************************************************************************/
interrupt void XGATE_Error_ISR(void) {
   asm NOP;		 /* to avoid unintentional single stepping of BGND instruction */
   asm BGND;
            /* clear the error flag */
   XGATE.xgmctl = XGSWEF | XGSWEFM;	
}

/******************************************************************************  
Function Name  : MPU_ISR			  ===== non maskable
Engineer       : r32151	
Date           : 06/05/2003
Parameters     : NONE
Returns        : NONE
Notes          : interrupt service routine for unused interrupt vectors. 
******************************************************************************/
interrupt void MPU_ISR(void) {
   asm NOP;		 /* to avoid unintentional single stepping of BGND instruction */
   asm BGND;
            /* clear the error flag */
   MPU.mpuflg.byte = AEF;
}

/******************************************************************************
Function Name  : CM_ISR			     ===== Clock Monitor Reset Vector
Engineer       : r32151	
Date           : 06/05/2003
Parameters     : NONE
Returns        : NONE
Notes          : interrupt service routine for unused interrupt vectors. 
******************************************************************************/
interrupt void CM_ISR(void) {
   asm NOP;		 /* to avoid unintentional single stepping of BGND instruction */
   asm BGND;
}

/******************************************************************************
Function Name  : COP_ISR		     ===== COP Watchdog Reset Vector
Engineer       : r32151	
Date           : 06/05/2003
Parameters     : NONE
Returns        : NONE
Notes          : interrupt service routine for unused interrupt vectors. 
******************************************************************************/
interrupt void COP_ISR(void) {
   asm NOP;		 /* to avoid unintentional single stepping of BGND instruction */
   asm BGND;
}

/******************************************************************************
Function Name  : Trap_ISR		     ===== non maskable
Engineer       : r32151	
Date           : 06/05/2003
Parameters     : NONE
Returns        : NONE
Notes          : interrupt service routine for unused interrupt vectors. 
******************************************************************************/
interrupt void Trap_ISR(void) {
   asm NOP;		 /* to avoid unintentional single stepping of BGND instruction */
   asm BGND;
}

/******************************************************************************
Function Name  : SWI_ISR		     ===== non maskable
Engineer       : r32151	
Date           : 06/05/2003
Parameters     : NONE
Returns        : NONE
Notes          : interrupt service routine for unused interrupt vectors. 
******************************************************************************/
interrupt void SWI_ISR(void) {
   asm NOP;		 /* to avoid unintentional single stepping of BGND instruction */
   asm BGND;
}

/******************************************************************************
Function Name  : XIRQ_ISR		     ===== X-bit maskable
Engineer       : r32151	
Date           : 06/05/2003
Parameters     : NONE
Returns        : NONE
Notes          : interrupt service routine for unused interrupt vectors. 
******************************************************************************/
interrupt void XIRQ_ISR(void) {
   asm NOP;		 /* to avoid unintentional single stepping of BGND instruction */
   asm BGND;
}

/******************************************************************************
Function Name  : FTM_ERROR_ISR     ===== X-bit maskable
Engineer       : r32151	
Date           : 06/05/2003
Parameters     : NONE
Returns        : NONE
Notes          : interrupt service routine for FTM related errors 
******************************************************************************/
interrupt void FTM_ERROR_ISR(void) {
   volatile tU08 ftmStat; /* local copy */
      /* Disable the EEE */
   ftmStat = LaunchFlashCommand(1 ,DISABLE_EEPROM_EMULATION, 0, 0, 0, 0, 0, 0);
   if ((ftmStat & (ACCERR|FPVIOL|MGSTAT1|MGSTAT0)))
      Error(ftmStat);
   asm NOP;		 /* to avoid unintentional single stepping of BGND instruction */
   asm BGND;
                /* halt if an EEE error interrupt ever occurs */
   while(1);
}

/******************************************************************************
Function Name  : LVI_ISR		     ===== Low Voltage Interrupt
Engineer       : r32151	
Date           : 06/05/2003
Parameters     : NONE
Returns        : NONE
Notes          : interrupt service routine for low voltage interrupt 
******************************************************************************/
interrupt void LVI_ISR(void) {
   volatile tU08 ftmStat; /* local copy */
      /* Disable the EEE */
   ftmStat = LaunchFlashCommand(1 ,DISABLE_EEPROM_EMULATION, 0, 0, 0, 0, 0, 0);
   if ((ftmStat & (ACCERR|FPVIOL|MGSTAT1|MGSTAT0)))
      Error(ftmStat);
   asm NOP;		 /* to avoid unintentional single stepping of BGND instruction */
   asm BGND;
}

/******************************************************************************
Function Name  : SCM_ISR		     ===== Self Clock Mode
Engineer       : r32151	
Date           : 06/05/2003
Parameters     : NONE
Returns        : NONE
Notes          : interrupt service routine for Self Clock Mode
******************************************************************************/
interrupt void SCM_ISR(void) {
   volatile tU08 ftmStat; /* local copy */   
      /* Disable the EEE */
   ftmStat = LaunchFlashCommand(1 ,DISABLE_EEPROM_EMULATION, 0, 0, 0, 0, 0, 0);
   if ((ftmStat & (ACCERR|FPVIOL|MGSTAT1|MGSTAT0)))
      Error(ftmStat);
   asm NOP;		 /* to avoid unintentional single stepping of BGND instruction */
   asm BGND;
}

/******************************************************************************
Function Name  : CRG_PLL		     ===== CRG PLL lock - if the part loses lock
Engineer       : r32151	
Date           : 06/05/2003
Parameters     : NONE
Returns        : NONE
Notes          : interrupt service routine for low voltage interrupt 
******************************************************************************/
interrupt void CRG_PLL(void) {
   volatile tU08 ftmStat; /* local copy */
      /* Disable the EEE */
   ftmStat = LaunchFlashCommand(1 ,DISABLE_EEPROM_EMULATION, 0, 0, 0, 0, 0, 0);
   if ((ftmStat & (ACCERR|FPVIOL|MGSTAT1|MGSTAT0)))
      Error(ftmStat);
   asm NOP;		 /* to avoid unintentional single stepping of BGND instruction */
   asm BGND;
}

⌨️ 快捷键说明

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