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

📄 board_init.c

📁 ARM系列LPC2378使用ethernet进行codeloader下载更新的源代码
💻 C
字号:
//-----------------------------------------------------------------------------// Software that is described herein is for illustrative purposes only  // which provides customers with programming information regarding the  // products. This software is supplied "AS IS" without any warranties.  // NXP Semiconductors assumes no responsibility or liability for the // use of the software, conveys no license or title under any patent, // copyright, or mask work right to the product. NXP Semiconductors // reserves the right to make changes in the software without // notification. NXP Semiconductors also make no representation or // warranty that such application will be suitable for the specified // use without further testing or modification. //-----------------------------------------------------------------------------

#include <LPC23XX.H>                        /* LPC23xx definitions */
#include "board_init.h"

void init_PLL(void)
{
    unsigned MValue, NValue;
  
    if ( PLLSTAT & (1 << 25) )
    {
  	PLLCON = 1;			/* Enable PLL, disconnected */
  	PLLFEED = 0xaa;
  	PLLFEED = 0x55;
    }
  
    PLLCON = 0;				/* Disable PLL, disconnected */
    PLLFEED = 0xaa;
    PLLFEED = 0x55;
      
    SCS |= 0x20;			/* Enable main OSC */
    while( !(SCS & 0x40) );	/* Wait until main OSC is usable */
  
    CLKSRCSEL = 0x1;		/* select main OSC, 12MHz, as the PLL clock source */
  
    PLLCFG = PLL_MVAL | (PLL_NVAL << 16);
    PLLFEED = 0xaa;
    PLLFEED = 0x55;
        
    PLLCON = 1;				/* Enable PLL, disconnected */
    PLLFEED = 0xaa;
    PLLFEED = 0x55;
  
    CCLKCFG = CCLKDIV;	/* Set clock divider */
  
    while ( ((PLLSTAT & (1 << 26)) == 0) );	/* Check lock bit status */
      
    MValue = PLLSTAT & 0x00007FFF;
    NValue = (PLLSTAT & 0x00FF0000) >> 16;
    while ((MValue != PLL_MVAL) && ( NValue != PLL_NVAL) );
  
    PLLCON = 3;				/* enable and connect */
    PLLFEED = 0xaa;
    PLLFEED = 0x55;
    while ( ((PLLSTAT & (1 << 25)) == 0) );	/* Check connect bit status */
    return;
}

void init_MAM(void)
{
    MAMTIM = 3;
    MAMCR = 2;
}

void init_PCB(void)
{
  /* Turn Off all LEDs  */
  FIO2DIR |= 0x0FF;
  FIO2CLR |= 0x0FF;
}

void VectorsRemap(void)
{
}

void board_init(void)
{
    init_PLL();
	init_MAM();
	init_PCB();
	VectorsRemap();
}

⌨️ 快捷键说明

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