source: rtems/c/src/lib/libbsp/arm/rtl22xx/startup/bspstart.c @ 06ec900

4.104.11
Last change on this file since 06ec900 was 06ec900, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 22, 2008 at 9:49:27 PM

2008-09-22 Joel Sherrill <joel.sherrill@…>

  • Makefile.am, configure.ac, console/uart.c, startup/bspstart.c: Use standardized bsp_cleanup() which can optionally print a message, poll for user to press key, and call bsp_reset(). Using this eliminates the various bsp_cleanup() implementations which had their own implementation and variety of string constants.
  • startup/bspclean.c: Removed.
  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 *  LPC22XX/LPC21xx Startup code
3 *
4 *  Copyright (c) 2007 by Ray Xu <rayx.cn@gmail.com>
5 *
6 *  The license and distribution terms for this file may be
7 *  found in the file LICENSE in this distribution or at
8 *  http://www.rtems.com/license/LICENSE.
9 *
10 *  $Id$
11 */
12
13#include <bsp.h>
14#include <lpc22xx.h>
15
16/*
17 * Function prototypes
18 */
19extern void rtems_irq_mngt_init(void);
20extern void  UART0_Ini(void);
21extern void printi(unsigned long);
22
23/*
24 * bsp_start_default - BSP initialization function
25 *
26 * This function is called before RTEMS is initialized and used
27 * adjust the kernel's configuration.
28 *
29 * This function also configures the CPU's memory protection unit.
30 *
31 * RESTRICTIONS/LIMITATIONS:
32 *   Since RTEMS is not configured, no RTEMS functions can be called.
33 *
34 */
35void bsp_start_default( void )
36{
37  PINSEL2 =0x0f814914;
38  BCFG0 = 0x1000ffef;
39  BCFG1 = 0x1000ffef;
40
41  MEMMAP = 0x2;  //debug and excute outside chip
42
43  PLLCON = 1;
44  #if (Fpclk / (Fcclk / 4)) == 1
45    VPBDIV = 0;
46  #endif
47  #if (Fpclk / (Fcclk / 4)) == 2
48    VPBDIV = 2;
49  #endif
50  #if (Fpclk / (Fcclk / 4)) == 4
51    VPBDIV = 1;
52  #endif
53
54  #if (Fcco / Fcclk) == 2
55    PLLCFG = ((Fcclk / Fosc) - 1) | (0 << 5);
56  #endif
57  #if (Fcco / Fcclk) == 4
58    PLLCFG = ((Fcclk / Fosc) - 1) | (1 << 5);
59  #endif
60  #if (Fcco / Fcclk) == 8
61    PLLCFG = ((Fcclk / Fosc) - 1) | (2 << 5);
62  #endif
63  #if (Fcco / Fcclk) == 16
64    PLLCFG = ((Fcclk / Fosc) - 1) | (3 << 5);
65  #endif
66  PLLFEED = 0xaa;
67  PLLFEED = 0x55;
68  while((PLLSTAT & (1 << 10)) == 0);
69  PLLCON = 3;
70  PLLFEED = 0xaa;
71  PLLFEED = 0x55;
72
73  /* memory configure */
74  /* it is not needed in my formatter board */
75  //MAMCR = 0;
76  // MAMTIM = 3;
77  //MAMCR = 2;
78
79  /* init VIC */
80  VICIntEnClr = 0xffffffff;
81  VICVectAddr = 0;
82  VICIntSelect = 0;
83
84  /* disable interrupts */
85  /* Setup interrupt controller.*/
86  VICProtection = 0;
87
88  UART0_Ini();
89
90  /*
91   * Init rtems exceptions management
92   */
93  rtems_exception_init_mngt();
94
95  /*
96   * Init rtems interrupt management
97   */
98  rtems_irq_mngt_init();
99} /* bsp_start */
100
101/*
102 *  By making this a weak alias for bsp_start_default, a brave soul
103 *  can override the actual bsp_start routine used.
104 */
105
106void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));
Note: See TracBrowser for help on using the repository browser.