📄 target.c
字号:
/*****************************************************************************
* target.c: Target C file for Philips LPC310x Family Microprocessors
*
* Copyright(C) 2006, Philips Semiconductor
* All rights reserved.
*
* History
* 2005.10.01 ver 1.00 Prelimnary version, first Release
*
*****************************************************************************/
#include "LPC318x.h"
#include "type.h"
#include "irq.h"
#include "target.h"
/******************************************************************************
** Function name: TargetInit
**
** Descriptions: Initialize the target board; it is called in a necessary
** place, change it as needed
**
** parameters: None
** Returned value: None
**
******************************************************************************/
void TargetInit(void)
{
/* Add your codes here */
return;
}
/******************************************************************************
** Function name: GPIOResetInit
**
** Descriptions: Initialize the target board before running the main()
** function; User may change it as needed, but may not
** deleted it.
**
** parameters: None
** Returned value: None
**
******************************************************************************/
void GPIOResetInit( void )
{
return;
}
/******************************************************************************
** Function name: TargetResetInit
**
** Descriptions: Initialize the target board before running the main()
** function; User may change it as needed, but may not
** deleted it.
**
** parameters: None
** Returned value: None
**
******************************************************************************/
void TargetResetInit(void)
{
/* Disable all interrupts */
MIC_ER = 0x0000;
SIC1_ER = 0x0000;
SIC2_ER = 0x0000;
MIC_RSR = 0x0000;
SIC1_RSR = 0x0000;
SIC2_RSR = 0x0000;
/* Set all the clock and power control registers to default value */
PWR_CTRL = 0x0012;
if ( SYSCLK_CTRL & 0x01 ) /* PLL397 is used */
{
while ( !(PLL397_CTRL & 0x01) );
SYSCLK_CTRL = 0x0140;
OSC_CTRL = 0x0000; /* should not happen if USB is used, otherwise, need */
/* to switch to main OSC, 13Mhz. */
HCLKPLL_CTRL = (PLL_P << 11) | (PLL_N << 9) | (PLL_M << 1);
HCLKPLL_CTRL |= ((1 << 16) | (1 << 14));
}
else
{
SYSCLK_CTRL = 0x0140;
HCLKPLL_CTRL = (PLL_P << 11) | (PLL_N << 9) | (PLL_M << 1);
HCLKPLL_CTRL |= ((1 << 16) | (1 << 14));
}
while ( !(HCLKPLL_CTRL & 0x01 ) );
HCLKDIV_CTRL = (PERIPH_DIV << 2) | (0x01 << 0);
PWR_CTRL |= ( 1 << 2 );
/* Add your codes here */
GPIOResetInit();
return;
}
/******************************************************************************
** End Of File
******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -