Paparazzi UAS
v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
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 */
45
PLLCFG
=
PLLCFG_MSEL
|
PLLCFG_PSEL
;
46
/* enable PLL */
47
PLLCON
=
PLLCON_PLLE
;
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 */
58
PLLCON
=
PLLCON_PLLE
|
PLLCON_PLLC
;
59
/* commit changes */
60
PLLFEED
= 0xAA;
61
PLLFEED
= 0x55;
62
63
/* setup & enable the MAM */
64
MAMTIM
=
MAMTIM_CYCLES
;
65
MAMCR
=
MAMCR_FULL
;
66
67
/* set the peripheral bus speed */
68
/* value computed from config.h */
69
VPBDIV
=
VPBDIV_VALUE
;
70
71
/* set the interrupt controller to flash */
72
MEMMAP
=
MEMMAP_FLASH
;
73
74
/* clear all interrupts */
75
VICIntEnClear
= 0xFFFFFFFF;
76
/* clear all FIQ selections */
77
VICIntSelect
= 0x00000000;
78
/* point unvectored IRQs to reset() */
79
VICDefVectAddr
= (
uint32_t
)
reset
;
80
81
}
VICIntSelect
#define VICIntSelect
Definition:
LPC21xx.h:430
PLLCFG_MSEL
#define PLLCFG_MSEL
Definition:
lpcSCB.h:105
PLLCON_PLLE
#define PLLCON_PLLE
Definition:
lpcSCB.h:101
reset
void reset(void)
MAMCR
#define MAMCR
Definition:
LPC21xx.h:397
MEMMAP_FLASH
#define MEMMAP_FLASH
Definition:
lpcSCB.h:85
MAMTIM_CYCLES
#define MAMTIM_CYCLES
Definition:
lpcSCB.h:80
MAMTIM
#define MAMTIM
Definition:
LPC21xx.h:398
mcu_arch_init
void mcu_arch_init(void)
Definition:
mcu_arch.c:77
PLLCON
#define PLLCON
Definition:
LPC21xx.h:404
PLLCFG_PSEL
#define PLLCFG_PSEL
Definition:
lpcSCB.h:106
PLLFEED
#define PLLFEED
Definition:
LPC21xx.h:407
PLLCFG
#define PLLCFG
Definition:
LPC21xx.h:405
VPBDIV
#define VPBDIV
Definition:
LPC21xx.h:414
PLLCON_PLLC
#define PLLCON_PLLC
Definition:
lpcSCB.h:102
uint32_t
unsigned long uint32_t
Definition:
types.h:18
VPBDIV_VALUE
#define VPBDIV_VALUE
Definition:
lpcSCB.h:113
VICDefVectAddr
#define VICDefVectAddr
Definition:
LPC21xx.h:437
inttypes.h
PLLSTAT
#define PLLSTAT
Definition:
LPC21xx.h:406
VICIntEnClear
#define VICIntEnClear
Definition:
LPC21xx.h:432
mcu.h
Arch independent mcu ( Micro Controller Unit ) utilities.
MEMMAP
#define MEMMAP
Definition:
LPC21xx.h:401
LPC21xx.h
MAMCR_FULL
#define MAMCR_FULL
Definition:
lpcSCB.h:78
PLLSTAT_LOCK
#define PLLSTAT_LOCK
Definition:
lpcSCB.h:109
sw
airborne
arch
lpc21
mcu_arch.c
Generated on Tue Jun 21 2016 14:01:08 for Paparazzi UAS by
1.8.8