Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 }
#define VICIntSelect
Definition: LPC21xx.h:430
#define PLLCFG_MSEL
Definition: lpcSCB.h:105
#define PLLCON_PLLE
Definition: lpcSCB.h:101
void reset(void)
#define MAMCR
Definition: LPC21xx.h:397
#define MEMMAP_FLASH
Definition: lpcSCB.h:85
#define MAMTIM_CYCLES
Definition: lpcSCB.h:80
void mcu_arch_init(void)
Definition: mcu_arch.c:94
#define MAMTIM
Definition: LPC21xx.h:398
#define PLLCON
Definition: LPC21xx.h:404
#define PLLCFG_PSEL
Definition: lpcSCB.h:106
#define PLLFEED
Definition: LPC21xx.h:407
#define PLLCFG
Definition: LPC21xx.h:405
#define VPBDIV
Definition: LPC21xx.h:414
#define PLLCON_PLLC
Definition: lpcSCB.h:102
unsigned long uint32_t
Definition: types.h:18
#define VPBDIV_VALUE
Definition: lpcSCB.h:113
#define VICDefVectAddr
Definition: LPC21xx.h:437
#define PLLSTAT
Definition: LPC21xx.h:406
#define VICIntEnClear
Definition: LPC21xx.h:432
Arch independent mcu ( Micro Controller Unit ) utilities.
#define MEMMAP
Definition: LPC21xx.h:401
#define MAMCR_FULL
Definition: lpcSCB.h:78
#define PLLSTAT_LOCK
Definition: lpcSCB.h:109