?? cpu.c
字號:
/** ###################################################################
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : Cpu.C
** Project : Project
** Processor : MC9S08DZ60MLF
** Beantype : MC9S08DZ60_48
** Version : Bean 01.036, Driver 01.29, CPU db: 2.87.131
** Datasheet : MC9S08DZ60 Rev. 1 Draft G 2/2007
** Compiler : CodeWarrior HCS08 C Compiler
** Date/Time : 2008-12-10, 上午 09:28
** Abstract :
** This bean "MC9S08DZ60_48" contains initialization of the
** CPU and provides basic methods and events for CPU core
** settings.
** Settings :
**
** Contents :
** EnableInt - void Cpu_EnableInt(void);
** DisableInt - void Cpu_DisableInt(void);
**
** (c) Copyright UNIS, spol. s r.o. 1997-2006
** UNIS, spol. s r.o.
** Jundrovska 33
** 624 00 Brno
** Czech Republic
** http : www.processorexpert.com
** mail : info@processorexpert.com
** ###################################################################*/
/* MODULE Cpu. */
#pragma MESSAGE DISABLE C4002 /* WARNING C4002: Result not used is ignored */
#include "SM1.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 byte CCR_reg; /* Current CCR register */
/*
** ===================================================================
** Method : Cpu_Interrupt (bean MC9S08DZ60_48)
**
** Description :
** The method services unhandled interrupt vectors.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
ISR(Cpu_Interrupt)
{
}
/*
** ===================================================================
** Method : Cpu_DisableInt (bean MC9S08DZ60_48)
**
** Description :
** Disables maskable interrupts
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
/*
void Cpu_DisableInt(void)
** This method is implemented as macro in the header module. **
*/
/*
** ===================================================================
** Method : Cpu_EnableInt (bean MC9S08DZ60_48)
**
** Description :
** Enables maskable interrupts
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
/*
void Cpu_EnableInt(void)
** This method is implemented as macro in the header module. **
*/
/*
** ===================================================================
** Method : _EntryPoint (bean MC9S08DZ60_48)
**
** Description :
** Initializes the whole system like timing and so on. At the end
** of this function, the C startup is invoked to initialize stack,
** memory areas and so on.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
extern void _Startup(void); /* Forward declaration of external startup function declared in file Start12.c */
#pragma NO_FRAME
#pragma NO_EXIT
void _EntryPoint(void)
{
/* ### MC9S08DZ60_48 "Cpu" init code ... */
/* PE initialization code after reset */
/* Common initialization of the write once registers */
/* SOPT1: COPT=0,STOPE=0,SCI2PS=0,IICPS=0,??=0,??=0,??=0 */
setReg8(SOPT1, 0x00);
/* SOPT2: COPCLKS=0,COPW=0,??=0,ADHTS=0,??=0,MCSEL=0 */
setReg8(SOPT2, 0x00);
/* SPMSC1: LVWF=0,LVWACK=0,LVWIE=0,LVDRE=1,LVDSE=1,LVDE=1,??=0,BGBE=0 */
setReg8(SPMSC1, 0x1C);
/* SPMSC2: ??=0,??=0,LVDV=0,LVWV=0,PPDF=0,PPDACK=0,??=0,PPDC=0 */
setReg8(SPMSC2, 0x00);
/* System clock initialization */
MCGTRM = *(unsigned char*)0xFFAF; /* Initialize MCGTRM register from a non volatile memory */
MCGSC = *(unsigned char*)0xFFAE; /* Initialize MCGSC register from a non volatile memory */
/* MCGC2: BDIV=1,RANGE=0,HGO=0,LP=0,EREFS=0,ERCLKEN=1,EREFSTEN=0 */
setReg8(MCGC2, 0x42); /* Set MCGC2 register */
/* MCGC1: CLKS=0,RDIV=0,IREFS=1,IRCLKEN=1,IREFSTEN=0 */
setReg8(MCGC1, 0x06); /* Set MCGC1 register */
/* MCGC3: LOLIE=0,PLLS=0,CME=0,??=0,VDIV=1 */
setReg8(MCGC3, 0x01); /* Set MCGC3 register */
while(!MCGSC_LOCK) { /* Wait until FLL is locked */
}
/*** End of PE initialization code after reset ***/
__asm jmp _Startup ; /* Jump to C startup code */
}
/*
** ===================================================================
** Method : PE_low_level_init (bean MC9S08DZ60_48)
**
** Description :
** Initializes beans and provides common register initialization.
** The method is called automatically as a part of the
** application initialization code.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void PE_low_level_init(void)
{
/* Common initialization of the CPU registers */
/* PTEDD: PTEDD5=0,PTEDD4=0,PTEDD3=1 */
clrSetReg8Bits(PTEDD, 0x30, 0x08);
/* PTED: PTED3=0 */
clrReg8Bits(PTED, 0x08);
/* PTASE: PTASE7=0,PTASE6=0,PTASE5=0,PTASE4=0,PTASE3=0,PTASE2=0,PTASE1=0,PTASE0=0 */
setReg8(PTASE, 0x00);
/* PTBSE: PTBSE7=0,PTBSE6=0,PTBSE5=0,PTBSE4=0,PTBSE3=0,PTBSE2=0,PTBSE1=0,PTBSE0=0 */
setReg8(PTBSE, 0x00);
/* PTDSE: PTDSE7=0,PTDSE6=0,PTDSE5=0,PTDSE4=0,PTDSE3=0,PTDSE2=0,PTDSE1=0,PTDSE0=0 */
setReg8(PTDSE, 0x00);
/* PTESE: PTESE7=0,PTESE6=0,PTESE5=0,PTESE4=0,PTESE3=0,PTESE2=0,PTESE0=0 */
clrReg8Bits(PTESE, 0xFD);
/* PTFSE: PTFSE5=0,PTFSE4=0,PTFSE3=0,PTFSE2=0,PTFSE1=0,PTFSE0=0 */
clrReg8Bits(PTFSE, 0x3F);
/* PTGSE: PTGSE1=0,PTGSE0=0 */
clrReg8Bits(PTGSE, 0x03);
/* PTADS: PTADS7=1,PTADS6=1,PTADS5=1,PTADS4=1,PTADS3=1,PTADS2=1,PTADS1=1,PTADS0=1 */
setReg8(PTADS, 0xFF);
/* PTBDS: PTBDS7=1,PTBDS6=1,PTBDS5=1,PTBDS4=1,PTBDS3=1,PTBDS2=1,PTBDS1=1,PTBDS0=1 */
setReg8(PTBDS, 0xFF);
/* PTDDS: PTDDS7=1,PTDDS6=1,PTDDS5=1,PTDDS4=1,PTDDS3=1,PTDDS2=1,PTDDS1=1,PTDDS0=1 */
setReg8(PTDDS, 0xFF);
/* PTEDS: PTEDS7=1,PTEDS6=1,PTEDS5=1,PTEDS4=1,PTEDS3=1,PTEDS2=1,PTEDS1=0,PTEDS0=1 */
setReg8(PTEDS, 0xFD);
/* PTFDS: PTFDS7=0,PTFDS6=0,PTFDS5=1,PTFDS4=1,PTFDS3=1,PTFDS2=1,PTFDS1=1,PTFDS0=1 */
setReg8(PTFDS, 0x3F);
/* PTGDS: ??=0,??=0,PTGDS5=0,PTGDS4=0,PTGDS3=0,PTGDS2=0,PTGDS1=1,PTGDS0=1 */
setReg8(PTGDS, 0x03);
/* ### Shared modules init code ... */
/* ### Synchro master "SM1" init code ... */
SM1_Init();
__EI(); /* Enable interrupts */
}
/* Initialization of the CPU registers in FLASH */
/* NVPROT: EPS=3,FPS=0x3F */
const unsigned char NVPROT_INIT @0x0000FFBD = 0xFF;
/* NVOPT: KEYEN=0,FNORED=1,EPGMOD=1,??=1,??=1,??=1,SEC1=1,SEC0=0 */
const unsigned char NVOPT_INIT @0x0000FFBF = 0x7E;
/* END Cpu. */
/*
** ###################################################################
**
** This file was created by UNIS Processor Expert 3.01 [03.92]
** for the Freescale HCS08 series of microcontrollers.
**
** ###################################################################
*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -