]> git.sur5r.net Git - freertos/blob - Demo/ColdFire_MCF52221_CodeWarrior/sources/MCF52221_sysinit.c
Comment the command line interpreter and lwIP sockets based server code.
[freertos] / Demo / ColdFire_MCF52221_CodeWarrior / sources / MCF52221_sysinit.c
1 /*\r
2  * File:                mcf52221_sysinit.c\r
3  * Purpose:             Power-on Reset configuration of the MCF52221.\r
4  *\r
5  * Notes: \r
6  *\r
7  */\r
8 #include "support_common.h"\r
9 #include "exceptions.h"\r
10 \r
11 \r
12 \r
13 /********************************************************************/\r
14 static void pll_init(void)\r
15 {\r
16 \r
17    MCF_CLOCK_CCHR =0x05; // The PLL pre divider - 48MHz / 6 = 8MHz \r
18 \r
19         /* The PLL pre-divider affects this!!! \r
20          * Multiply 8Mhz reference crystal /CCHR by 10 to acheive system clock of 80Mhz\r
21          */\r
22 \r
23         MCF_CLOCK_SYNCR = MCF_CLOCK_SYNCR_MFD(3) | MCF_CLOCK_SYNCR_CLKSRC| MCF_CLOCK_SYNCR_PLLMODE | MCF_CLOCK_SYNCR_PLLEN ;\r
24 \r
25         while (!(MCF_CLOCK_SYNSR & MCF_CLOCK_SYNSR_LOCK))\r
26         {\r
27         }\r
28 }\r
29 /********************************************************************/\r
30 static void scm_init(void)\r
31 {\r
32         /*\r
33          * Enable on-chip modules to access internal SRAM\r
34          */\r
35         MCF_SCM_RAMBAR = (0\r
36                 | MCF_SCM_RAMBAR_BA(RAMBAR_ADDRESS)\r
37                 | MCF_SCM_RAMBAR_BDE);\r
38 }\r
39 \r
40 /********************************************************************/\r
41 \r
42         /*\r
43  * Out of reset, the low-level assembly code calls this routine to\r
44  * initialize the mcf5206e for this board. A temporary stack has been\r
45  * setup in the internal SRAM, and the stack pointer will be changed\r
46  * to point to DRAM once this routine returns.\r
47          */\r
48 void __initialize_hardware(void)\r
49 {\r
50         /*******************************************************\r
51         *       Out of reset, the low-level assembly code calls this \r
52         *       routine to initialize the MCF52221 modules for the  \r
53         *       M522223EVB board. \r
54         ********************************************************/\r
55 \r
56 \r
57         asm \r
58         {\r
59             /* Initialize IPSBAR */\r
60             move.l  #__IPSBAR,d0\r
61                andi.l  #0xC0000000,d0 // need to mask\r
62             add.l   #0x1,d0\r
63             move.l  d0,0x40000000\r
64 \r
65             \r
66 \r
67             /* Initialize FLASHBAR */\r
68             move.l  #__FLASHBAR,d0\r
69                andi.l  #0xFFF80000,d0 // need to mask\r
70             add.l   #0x61,d0\r
71             movec   d0,FLASHBAR\r
72 \r
73         }\r
74 \r
75         \r
76         /* Set real time clock freq */\r
77         MCF_CLOCK_RTCDR = 48000000;\r
78         \r
79         pll_init();\r
80         scm_init();\r
81 \r
82         initialize_exceptions();\r
83 }\r
84 \r
85 \r
86 \r