Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures 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  /* set PLL multiplier & divisor. */
43  /* values computed from config.h */
45  /* enable PLL */
47  /* commit changes */
48  PLLFEED = 0xAA;
49  PLLFEED = 0x55;
50 
51  /* wait for PLL lock */
52  while (!(PLLSTAT & PLLSTAT_LOCK))
53  continue;
54 
55  /* enable & connect PLL */
57  /* commit changes */
58  PLLFEED = 0xAA;
59  PLLFEED = 0x55;
60 
61  /* setup & enable the MAM */
63  MAMCR = MAMCR_FULL;
64 
65  /* set the peripheral bus speed */
66  /* value computed from config.h */
68 
69  /* set the interrupt controller to flash */
71 
72  /* clear all interrupts */
73  VICIntEnClear = 0xFFFFFFFF;
74  /* clear all FIQ selections */
75  VICIntSelect = 0x00000000;
76  /* point unvectored IRQs to reset() */
78 
79 }
#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
#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
void mcu_arch_init(void)
Definition: mcu_arch.c:40
#define PLLSTAT_LOCK
Definition: lpcSCB.h:109