?? cpu.c
字號:
/** ###################################################################
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : Cpu.C
** Project : Bulid_option_8367
** Processor : 56F8367
** Beantype : 56F8367
** Version : Bean 01.031, Driver 01.32, CPU db: 2.87.053
** Datasheet : MC56F8357/D Rev. 1.0, MC56F8300UM/D - Rev. 1.0
** Compiler : Metrowerks DSP C Compiler
** Date/Time : 8/31/2007, 1:09 PM
** Abstract :
**
** Settings :
**
** Contents :
** EnableInt - void Cpu_EnableInt(void);
** DisableInt - void Cpu_DisableInt(void);
** SetWaitMode - void Cpu_SetWaitMode(void);
** SetStopMode - void Cpu_SetStopMode(void);
** SetDataMode - void Cpu_SetDataMode(byte Mode);
**
** (c) Freescale Semiconductor
** 2004 All Rights Reserved
**
** (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. */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.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 56F8367)
**
** Description :
** The method services unhandled interrupt vectors.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
#pragma interrupt alignsp
void Cpu_Interrupt(void)
{
asm(DEBUGHLT); /* Halt the core and placing it in the debug processing state */
}
/*
** ===================================================================
** Method : Cpu_DisableInt (bean 56F8367)
**
** 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 56F8367)
**
** 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 56F8367)
**
** 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 56F8367)
**
** 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 56F8367)
**
** 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 : _EntryPoint (bean 56F8367)
**
** 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 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)
{
#pragma constarray off
/*** !!! Here you can place your own code before PE initialization using property "User code before PE initialization" on the build options tab. !!! ***/
/*** ### 56F8367 "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 */
/* PLLDB: LORTP=2,PLLCOD=0,PLLCID=1,??=0,PLLDB=59 */
setReg16(PLLDB, 8507); /* 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 */
/* FMCLKD: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,DIVLD=0,PRDIV8=1,DIV=18 */
setReg16(FMCLKD, 82); /* Set the flash clock prescaler */
/* External bus initialization */
/* SEMI_CSBAR_2: ADR23=0,ADR22=0,ADR21=0,ADR20=0,ADR19=0,ADR18=0,ADR17=0,ADR16=1,ADR15=0,ADR14=0,ADR13=0,ADR12=0,BLKSZ3=0,BLKSZ2=1,BLKSZ1=1,BLKSZ0=1 */
setReg16(SEMI_CSBAR_2, 263); /* Chip select 2 base address register */
/* SEMI_CSOR_2: RWS=23,BYTE_EN=3,R_W=3,PS_DS=1,WWS=23 */
setReg16(SEMI_CSOR_2, 49079); /* Chip select 2 option register */
/* SEMI_CSTC_2: WWSS=2,WWSH=2,RWSS=2,RWSH=2,??=0,??=0,??=0,??=0,??=0,MDAR=3 */
setReg16(SEMI_CSTC_2, 43523); /* Chip select 2 timing control register */
/* SEMI_BCR: DRV=1,BMDAR=0,??=0,??=0,BWWS=1,BRWS=1 */
setReg16(SEMI_BCR, 32801); /* 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 56F8367)
**
** 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)
{
/* DEC0_FIR: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,DELAY=0 */
setReg16(DEC0_FIR, 0); /* Set up Filter Interval Register of Quadrature Decoder 0 */
/* DEC1_FIR: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,DELAY=0 */
setReg16(DEC1_FIR, 0); /* Set up Filter Interval Register of Quadrature Decoder 1 */
/* SIM_PCE: EMI=1,ADC_B=1,ADC_A=1,CAN=1,DEC_1=1,DEC_0=1,TMR_D=1,TMR_C=1,TMR_B=1,TMR_A=1,SCI_1=1,SCI_0=1,SPI_1=1,SPI_0=1,PWM_B=1,PWM_A=1 */
setReg16(SIM_PCE, 65535); /* Set up the peripheral clock enable register */
/* SIM_PCE2: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,CAN2=1 */
setReg16(SIM_PCE2, 1); /* Set up the peripheral clock enable register */
/* SIM_CONTROL: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,emi_mode=0,OnceEbl=0,SWRst=0,stop_disable=0,wait_disable=0 */
setReg16(SIM_CONTROL, 0); /* Set up the SIM control register */
/* SIM_CLKOSR: ??=0,??=0,??=0,??=0,??=0,??=0,A23_b=0,A22_b=0,A21_b=0,A20_b=0,CLKDIS=1,CLKOSEL=0 */
setReg16(SIM_CLKOSR, 32); /* Set up the SIM clock output select register */
/* TSENSOR_CONTROL: PWR=0 */
clrReg16Bits(TSENSOR_CONTROL, 1); /* Disable power source for the temperature sensor */
/* Common initialization of the CPU registers */
/* GPIO_D_PER: PE|=1 */
setReg16Bits(GPIO_D_PER, 1);
/* GPIO_F_PER: PE=65535 */
setReg16(GPIO_F_PER, 65535);
/* GPIO_A_PER: PE=16383 */
setReg16Bits(GPIO_A_PER, 16383);
/* GPIO_E_PER: PE|=12 */
setReg16Bits(GPIO_E_PER, 12);
__EI(0); /* Enable interrupts of the selected priority level */
}
/* END Cpu. */
/*
** ###################################################################
**
** This file was created by UNIS Processor Expert 2.98.02 [03.79]
** for the Freescale 56800 series of microcontrollers.
**
** ###################################################################
*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -