Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
mcu_arch.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 The Paparazzi team
3  *
4  * This file is part of Paparazzi.
5  *
6  * Paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * Paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  */
22 
29 #include "mcu.h"
30 
31 
32 #include <inttypes.h>
33 #include BOARD_CONFIG
34 #include "LPC21xx.h"
35 
36 
37 /* declare functions and values from crt0.S & the linker control file */
38 extern void reset(void);
39 
40 void mcu_arch_init(void)
41 {
42 
43  /* set PLL multiplier & divisor. */
44  /* values computed from config.h */
46  /* enable PLL */
48  /* commit changes */
49  PLLFEED = 0xAA;
50  PLLFEED = 0x55;
51 
52  /* wait for PLL lock */
53  while (!(PLLSTAT & PLLSTAT_LOCK)) {
54  continue;
55  }
56 
57  /* enable & connect PLL */
59  /* commit changes */
60  PLLFEED = 0xAA;
61  PLLFEED = 0x55;
62 
63  /* setup & enable the MAM */
65  MAMCR = MAMCR_FULL;
66 
67  /* set the peripheral bus speed */
68  /* value computed from config.h */
70 
71  /* set the interrupt controller to flash */
73 
74  /* clear all interrupts */
75  VICIntEnClear = 0xFFFFFFFF;
76  /* clear all FIQ selections */
77  VICIntSelect = 0x00000000;
78  /* point unvectored IRQs to reset() */
80 
81 }
VPBDIV_VALUE
#define VPBDIV_VALUE
Definition: lpcSCB.h:113
MAMCR_FULL
#define MAMCR_FULL
Definition: lpcSCB.h:78
PLLCON
#define PLLCON
Definition: LPC21xx.h:404
LPC21xx.h
PLLCFG_PSEL
#define PLLCFG_PSEL
Definition: lpcSCB.h:106
VICIntSelect
#define VICIntSelect
Definition: LPC21xx.h:430
uint32_t
unsigned long uint32_t
Definition: types.h:18
PLLFEED
#define PLLFEED
Definition: LPC21xx.h:407
MAMTIM
#define MAMTIM
Definition: LPC21xx.h:398
PLLSTAT_LOCK
#define PLLSTAT_LOCK
Definition: lpcSCB.h:109
mcu.h
Arch independent mcu ( Micro Controller Unit ) utilities.
PLLCFG_MSEL
#define PLLCFG_MSEL
Definition: lpcSCB.h:105
VICDefVectAddr
#define VICDefVectAddr
Definition: LPC21xx.h:437
PLLCON_PLLE
#define PLLCON_PLLE
Definition: lpcSCB.h:101
PLLCFG
#define PLLCFG
Definition: LPC21xx.h:405
mcu_arch_init
void mcu_arch_init(void)
Definition: mcu_arch.c:109
VPBDIV
#define VPBDIV
Definition: LPC21xx.h:414
MEMMAP_FLASH
#define MEMMAP_FLASH
Definition: lpcSCB.h:85
MEMMAP
#define MEMMAP
Definition: LPC21xx.h:401
reset
void reset(void)
MAMTIM_CYCLES
#define MAMTIM_CYCLES
Definition: lpcSCB.h:80
PLLSTAT
#define PLLSTAT
Definition: LPC21xx.h:406
VICIntEnClear
#define VICIntEnClear
Definition: LPC21xx.h:432
PLLCON_PLLC
#define PLLCON_PLLC
Definition: lpcSCB.h:102
MAMCR
#define MAMCR
Definition: LPC21xx.h:397
inttypes.h