#include "IFsh1.h" #include "BTN1.h" #include "Inhr1.h" #include "AS1.h" #include "PE_Types.h" #include "PE_Error.h" #include "PE_Const.h" #include "IO_Map.h" #include "Events.h" #include "Cpu.h" /* Global variables */ volatile word SR_lock=0; /* Lock */ volatile word SR_reg; /* Current value of the SR register */
/* ** =================================================================== ** Method : Cpu_Interrupt (bean 56F807) ** ** Description : ** This method is internal. It is used by Processor Expert ** only. ** =================================================================== */ #pragma interrupt void Cpu_Interrupt(void) { asm(DEBUG); /* Halt the core and placing it in the debug processing state */ } /* ** =================================================================== ** Method : Cpu_DisableInt (bean 56F807) ** ** Description : ** Disables all maskable interrupts ** Parameters : None ** Returns : Nothing ** =================================================================== */ /* void Cpu_DisableInt(void) ** This method is implemented as macro in the header module. ** */ /* ** =================================================================== ** Method : Cpu_EnableInt (bean 56F807) ** ** Description : ** Enables all maskable interrupts ** Parameters : None ** Returns : Nothing ** =================================================================== */ /* void Cpu_EnableInt(void) ** This method is implemented as macro in the header module. ** */ /* ** =================================================================== ** Method : Cpu_SetStopMode (bean 56F807) ** ** Description : ** Sets low power mode - Stop mode. ** For more information about the stop mode see this CPU ** documentation. ** Parameters : None ** Returns : Nothing ** =================================================================== */ /* void Cpu_SetStopMode(void) ** This method is implemented as macro in the header module. ** */ /* ** =================================================================== ** Method : Cpu_SetWaitMode (bean 56F807) ** ** Description : ** Sets low power mode - Wait mode. ** For more information about the wait mode see this CPU ** documentation. ** Release from wait mode: Reset or interrupt ** Parameters : None ** Returns : Nothing ** =================================================================== */ /* void Cpu_SetWaitMode(void) ** This method is implemented as macro in the header module. ** */ /* ** =================================================================== ** Method : Cpu_SetDataMode (bean 56F807) ** ** Description : ** Sets the Data memory map to use either internal & ** external resources or external resources only. ** Parameters : ** NAME - DESCRIPTION ** Mode - Data memory access mode. ** Possible modes: ** INT_EXT_MODE - use internal & external ** resources ** EXT_MODE - use external resources only ** Returns : Nothing ** =================================================================== */ void Cpu_SetDataMode(byte Mode) { if (Mode == INT_EXT_MODE) asm { bfclr #0x0008,OMR } /* Set internal and external data memory mode */ else asm { bfset #0x0008,OMR } /* Set external data memory mode */ } /* ** =================================================================== ** Method : Cpu_GetSpeedMode (bean 56F807) ** ** Description : ** Gets current speed mode ** Parameters : None ** Returns : ** --- - Speed mode (HIGH_SPEED, LOW_SPEED, ** SLOW_SPEED) ** =================================================================== */ byte Cpu_GetSpeedMode(void) { return HIGH_SPEED; /* Result the actual cpu mode - high speed mode*/ } /* ** =================================================================== ** Method : _EntryPoint (bean 56F807) ** ** Description : ** This method is internal. It is used by Processor Expert ** only. ** =================================================================== */ extern void init_56800_(void); /* Forward declaration of external startup function declared in startup file */ /*** !!! Here you can place your own code using property "User data declarations" on the build options tab. !!! ***/ void _EntryPoint(void) { /*** !!! Here you can place your own code before PE initialization using property "User code before PE initialization" on the build options tab. !!! ***/ /*** ### 56F807 "Cpu" init code ... ***/ /*** PE initialization code after reset ***/ /* System clock initialization */ setReg(PLLCR, (PLLCR_LCKON_MASK | PLLCR_ZSRC0_MASK)); /* Enable PLL, LCKON and select clock source from prescaler */ /* CLKOSR: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,CLKOSEL=0 */ setReg16(CLKOSR, 0); /* CLKO = ZCLOCK */ /* PLLDB: LORTP=2,PLLCOD=0,PLLCID=1,??=0,PLLDB=39 */ setReg16(PLLDB, 8487); /* Set the clock prescalers */ while(!getRegBit(PLLSR, LCK0)){} /* Wait for PLL lock */ setReg(PLLCR, (PLLCR_LCKON_MASK | PLLCR_ZSRC1_MASK)); /* Select clock source from postscaler */ /* External bus initialization */ /* BCR: ??=0,??=0,??=0,??=0,??=0,??=0,DRV=0,??=0,WSX=0,WSP=0 */ setReg16(BCR, 0); /* Bus control register */ /*** End of PE initialization code after reset ***/ /*** !!! Here you can place your own code after PE initialization using property "User code after PE initialization" on the build options tab. !!! ***/ asm(JMP init_56800_); /* Jump to C startup code */ } /* ** =================================================================== ** Method : PE_low_level_init (bean 56F807) ** ** Description : ** This method is internal. It is used by Processor Expert ** only. ** =================================================================== */ void PE_low_level_init(void) { /* Common initialization of the CPU registers */ /* IPR: CH3=1,IAL1=1,IAINV=0 */ clrSetReg16Bits(IPR, 1, 4100); /* GPR3: PLR12=4 */ clrSetReg16Bits(GPR3, 3, 4); /* GPIO_E_PER: PE|=3 */ setReg16Bits(GPIO_E_PER, 3); /* GPR13: PLR53=4,PLR52=4 */ clrSetReg16Bits(GPR13, 51, 68); /* GPR12: PLR51=4,PLR50=4 */ clrSetReg16Bits(GPR12, 13056, 17408); IFsh1_Init(); /* ### External interrupt "Inhr1" init code ... */ setRegBit(IPR,IAL0); /* Enable interrupt "INT_IRQA" */ /* ### Button "BTN1" init code ... */ BTN1_Init(); /* ### Asynchro serial "AS1" init code ... */ AS1_Init(); __EI(); /* Enable interrupts */ } /* END Cpu. */ /* ** ################################################################### ** ** This file was created by UNIS Processor Expert 2.96 [03.65] ** for the Freescale 56800 series of microcontrollers. ** ** ################################################################### */ void Cpu_Interrupt(void)定义的应该是bean里面的吧,但是我始终在PE中CPU的下拉菜单项里面找不到Cpu_Interrupt函数啊,为什么呢? |