Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mcu_arch.c
Go to the documentation of this file.
1 /*
2  * Paparazzi lpc21 arch dependant microcontroller initialisation function
3  *
4  * Copyright (C) 2010 The Paparazzi team
5  *
6  * This file is part of Paparazzi.
7  *
8  * Paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * Paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Paparazzi; see the file COPYING. If not, write to
20  * the Free Software Foundation, 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  *
23  */
24 
25 #include "mcu.h"
26 
27 
28 #include <inttypes.h>
29 #include BOARD_CONFIG
30 #include "LPC21xx.h"
31 
32 
33 /* declare functions and values from crt0.S & the linker control file */
34 extern void reset(void);
35 
36 void mcu_arch_init(void) {
37 
38  /* set PLL multiplier & divisor. */
39  /* values computed from config.h */
41  /* enable PLL */
43  /* commit changes */
44  PLLFEED = 0xAA;
45  PLLFEED = 0x55;
46 
47  /* wait for PLL lock */
48  while (!(PLLSTAT & PLLSTAT_LOCK))
49  continue;
50 
51  /* enable & connect PLL */
53  /* commit changes */
54  PLLFEED = 0xAA;
55  PLLFEED = 0x55;
56 
57  /* setup & enable the MAM */
59  MAMCR = MAMCR_FULL;
60 
61  /* set the peripheral bus speed */
62  /* value computed from config.h */
64 
65  /* set the interrupt controller to flash */
67 
68  /* clear all interrupts */
69  VICIntEnClear = 0xFFFFFFFF;
70  /* clear all FIQ selections */
71  VICIntSelect = 0x00000000;
72  /* point unvectored IRQs to reset() */
74 
75 }
#define VICIntSelect
Definition: LPC21xx.h:398
#define PLLCFG_MSEL
Definition: lpcSCB.h:105
#define PLLCON_PLLE
Definition: lpcSCB.h:101
void reset(void)
#define MAMCR
Definition: LPC21xx.h:365
#define MEMMAP_FLASH
Definition: lpcSCB.h:85
#define MAMTIM_CYCLES
Definition: lpcSCB.h:80
#define MAMTIM
Definition: LPC21xx.h:366
#define PLLCON
Definition: LPC21xx.h:372
#define PLLCFG_PSEL
Definition: lpcSCB.h:106
#define PLLFEED
Definition: LPC21xx.h:375
#define PLLCFG
Definition: LPC21xx.h:373
#define VPBDIV
Definition: LPC21xx.h:382
#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:405
#define PLLSTAT
Definition: LPC21xx.h:374
#define VICIntEnClear
Definition: LPC21xx.h:400
arch independent mcu ( Micro Controller Unit ) utilities
#define MEMMAP
Definition: LPC21xx.h:369
#define MAMCR_FULL
Definition: lpcSCB.h:78
void mcu_arch_init(void)
Definition: mcu_arch.c:36
#define PLLSTAT_LOCK
Definition: lpcSCB.h:109