]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/ThirdParty/CMSISv2p10_LPC18xx_DriverLib/src/system_LPC18xx.c
Slight modification to license blub text in header comments.
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC / ThirdParty / CMSISv2p10_LPC18xx_DriverLib / src / system_LPC18xx.c
1 /*\r
2  * Modifications for use with Code Red's toolchain - 2011/11/24\r
3  */\r
4 /**********************************************************************\r
5 * $Id$          system_LPC18xx.c                        2011-06-02\r
6 *//**\r
7 * @file         system_LPC18xx.c\r
8 * @brief        Cortex-M3 Device System Source File for NXP LPC18xx Series.\r
9 * @version      1.0\r
10 * @date         02. June. 2011\r
11 * @author       NXP MCU SW Application Team\r
12 *\r
13 * Copyright(C) 2011, NXP Semiconductor\r
14 * All rights reserved.\r
15 *\r
16 ***********************************************************************\r
17 * Software that is described herein is for illustrative purposes only\r
18 * which provides customers with programming information regarding the\r
19 * products. This software is supplied "AS IS" without any warranties.\r
20 * NXP Semiconductors assumes no responsibility or liability for the\r
21 * use of the software, conveys no license or title under any patent,\r
22 * copyright, or mask work right to the product. NXP Semiconductors\r
23 * reserves the right to make changes in the software without\r
24 * notification. NXP Semiconductors also make no representation or\r
25 * warranty that such application will be suitable for the specified\r
26 * use without further testing or modification.\r
27 **********************************************************************/\r
28 \r
29 #include "LPC18xx.h"\r
30 #include "lpc18xx_cgu.h"\r
31 /*----------------------------------------------------------------------------\r
32   Define clocks\r
33  *----------------------------------------------------------------------------*/\r
34 #define __IRC            (12000000UL)    /* IRC Oscillator frequency          */\r
35 \r
36 /*----------------------------------------------------------------------------\r
37   Clock Variable definitions\r
38  *----------------------------------------------------------------------------*/\r
39 uint32_t SystemCoreClock = __IRC * 10UL;                /*!< System Clock Frequency (Core Clock)*/\r
40 \r
41 #ifndef __CODE_RED\r
42 extern uint32_t getPC(void);\r
43 #endif\r
44 \r
45 /**\r
46  * Initialize the system\r
47  *\r
48  * @param  none\r
49  * @return none\r
50  *\r
51  * @brief  Setup the microcontroller system.\r
52  *         Initialize the System.\r
53  */\r
54 void SystemInit (void)\r
55 {\r
56 #ifdef __CODE_RED\r
57     // CodeRed startup code will modify VTOR register to match\r
58     // when code has been linked to run from.\r
59 \r
60     // Check whether we are running from external flash\r
61     if (SCB->VTOR == 0x1C000000)\r
62         /*Enable Buffer for External Flash*/\r
63         LPC_EMC->STATICCONFIG0 |= 1<<19;\r
64 \r
65     // Call clock initialisation code\r
66     CGU_Init();\r
67 \r
68 #else\r
69         // Enable VTOR register to point to vector table\r
70         SCB->VTOR = getPC() & 0xFFF00000;\r
71     /*Enable Buffer for External Flash*/\r
72     LPC_EMC->STATICCONFIG0 |= 1<<19;\r
73 \r
74 #endif\r
75 \r
76 }\r