pll_start.c
来自「FAT16 Filesystem on Philips LPC2000 seri」· C语言 代码 · 共 71 行
C
71 行
#include <stdc.h>#include <stdio.h>#include <types.h>#include <LPC21xx.h>#include <system.h>#include <sysdefs.h>/****************************************************************************** * * Function Name: lowInit() * * Description: * This function starts up the PLL then sets up the GPIO pins before * waiting for the PLL to lock. It finally engages the PLL and * returns * * Calling Sequence: * void * * Returns: * void * *****************************************************************************/static void pllInit58MHz(void){ // set PLL multiplier & divisor. // values computed from sysdefs.h PLLCFG = PLLCFG_MSEL | PLLCFG_PSEL; // enable PLL PLLCON = PLLCON_PLLE; PLLFEED = 0xAA; // Make it happen. These two updates PLLFEED = 0x55; // MUST occur in sequence. // wait for PLL lock while (!(PLLSTAT & PLLSTAT_LOCK)) continue; // enable & connect PLL PLLCON = PLLCON_PLLE | PLLCON_PLLC; PLLFEED = 0xAA; // Make it happen. These two updates PLLFEED = 0x55; // MUST occur in sequence.}void lowInit(void){ pllInit58MHz(); // setup port 0 pins IO0CLR = P0IO_ZERO_BITS; // clear the ZEROs output IO0SET = P0IO_ONE_BITS; // set the ONEs output IO0DIR = P0IO_OUTPUT_BITS; // set the output bit direction // setup port 1 pins IO1CLR = P1IO_ZERO_BITS; // clear the ZEROs output IO1SET = P1IO_ONE_BITS; // set the ONEs output IO1DIR = P1IO_OUTPUT_BITS; // set the output bit direction PCONP = ((PCTIM0 | PCTIM1 | PCUART0 | PCUART1 | PCRTC | PCSPI1 | PCAD0) & ~PCONP_MASK); // setup & enable the MAM MAMTIM = MAMTIM_CYCLES; MAMCR = MAMCR_FULL; // set the peripheral bus speed // value computed from sysdefs.h VPBDIV = VPBDIV_VALUE; // set the peripheral bus clock speed}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?