source: ssp_qb_r5f100le_cs/trunk/target/cq_frk_fm3_gcc/target_support.S@ 93

Last change on this file since 93 was 93, checked in by nmir-saito, 8 years ago

add Combined package of SSP kernel for QB-R5F100LE-TB(RL78 processor)

File size: 4.9 KB
Line 
1/*
2 * TOPPERS/SSP Kernel
3 * Smallest Set Profile Kernel
4 *
5 * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
6 * Toyohashi Univ. of Technology, JAPAN
7 * Copyright (C) 2007 by Embedded and Real-Time Systems Laboratory
8 * Graduate School of Information Science, Nagoya Univ., JAPAN
9 * Copyright (C) 2012 by Meika Sugimoto
10 * Copyright (C) 2015 by Naoki Saito
11 * Nagoya Municipal Industrial Research Institute, JAPAN
12 *
13 * ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì(1)`(4)‚ÌðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒF
14 * ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü
15 * •ÏEÄ”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
16 * (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
17 * Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
18 * ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
19 * (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
20 * —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
21ƒƒ“ƒgi—˜—p
22 * ŽÒƒ}ƒjƒ…
23ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
24 * ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
25 * (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
26 * —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±
27 * ‚ƁD
28 * (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
29ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
30ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
31 * ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
32 * (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É
33 * •ñ‚·‚邱‚ƁD
34 * (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
35 * ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
36 * ‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝
37 * —R‚ÉŠî‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð
38 * –Ɛӂ·‚邱‚ƁD
39 *
40 * –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
41 * ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC“Á’è‚ÌŽg—p–Ú“I
42 * ‚ɑ΂·‚é“K‡«‚àŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒF
43 * ƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»
44 * ‚̐ӔC‚𕉂í‚È‚¢D
45 *
46 */
47
48/*
49 * ƒ^[ƒQƒbƒgˆË‘¶•”@ƒAƒZƒ“ƒuƒŠŒ¾ŒêiCQ-FRM-FM3—pj
50 */
51
52#define TOPPERS_MACRO_ONLY
53#define UINT_C(val) (val)
54#define ULONG_C(val) (val)
55#include "kernel_impl.h"
56#include "cq_frm_fm3.h"
57
58/*
59 * ’჌ƒxƒ‹‚̃^[ƒQƒbƒgˆË‘¶‚̏‰Šú‰»
60 *
61 * ƒƒ‚ƒŠ‰Šú‰»‚Ì‘O‚ɌĂяo‚³‚ê‚é
62 */
63
64 .globl hardware_init_hook
65
66 .text
67 .align 2
68 .syntax unified
69 .code 16
70 .thumb
71 .type hardware_init_hook, function
72hardware_init_hook:
73 /* ŠeƒoƒXƒNƒƒbƒN‚̃vƒŠƒXƒP[ƒ‰Ý’è */
74 ldr r0 , =#BSC_PSR /* ƒx[ƒXƒNƒƒbƒN(1•ªŽü) */
75 mov r1 , #BSC_CLK_DIV_1
76 str r1 , [r0]
77
78 ldr r0 , =#APBC0_PSR /* APB0(8•ªŽü) */
79 mov r1 , #APB_CLK_DIV_8
80 str r1 , [r0]
81
82 ldr r0 , =#APBC1_PSR /* APB1(8•ªŽü) */
83 mov r1 , #(APB_CLK_DIV_8 | APBC_EN | APBC_RESET)
84 str r1 , [r0]
85 mov r1 , #(APB_CLK_DIV_8 | APBC_EN)
86 str r1 , [r0]
87
88 ldr r0 , =#APBC2_PSR /* APB2(8•ªŽü) */
89 mov r1 , #(APB_CLK_DIV_8 | APBC_EN | APBC_RESET)
90 str r1 , [r0]
91 mov r1 , #(APB_CLK_DIV_8 | APBC_EN)
92 str r1 , [r0]
93
94 ldr r0 , =#INT_CLR /* INT_CLR‚̃NƒŠƒA */
95 mov r1 , #(INT_CLL_MCS | INT_CLL_SCS | INT_CLL_PCS | INT_CLL_FCS)
96 str r1 , [r0]
97
98 /* ƒƒCƒ“ƒNƒƒbƒN”­MˆÀ’è‘Ò‚¿Š„ž‚݂̐ݒè */
99 ldr r0 , =#CSW_PSR
100 mov r1 , #PSW_TMR_MOWT_CONF12
101 str r1 , [r0]
102
103 /* ƒƒCƒ“ƒNƒƒbƒN“ü—͈À’è‘Ò‚¿Š„ž‚Ý—LŒø‰» */
104 ldr r0 , =#INT_ENR
105 mov r1 , #INT_CLL_MCS
106 str r1 , [r0]
107
108 /* ƒƒCƒ“ƒNƒƒbƒN‹N“® */
109 ldr r0 , =#SCM_CTL
110 ldr r1 , [r0]
111 and r1 , #SCM_CTL_MOSCE
112 str r1 , [r0]
113
114 /* ƒƒCƒ“ƒNƒƒbƒNˆÀ’è‘Ò‚¿ */
115 ldr r0 , =#SCM_STR
116 wait_main_clock_stable:
117 ldr r1 , [r0]
118 orr r1 , #SCM_STR_MORDY
119 beq wait_main_clock_stable
120
121 /* PLL“ü—̓NƒƒbƒN‚Æ”­MˆÀ’è‘Ò‚¿Š„ž‚݂̐ݒè */
122 ldr r0 , =#PSW_TMR
123 mov r1 , #(PSW_TMR_PINC_MO | PSW_TMR_POWT_CONF7) /* ‘Ò‚¿ŽžŠÔ‚͍őå’lŽæ‚é */
124 str r1 , [r0]
125
126 /* PLL“ü—͈À’è‘Ò‚¿Š„ž‚Ý—LŒø‰» */
127 ldr r0 , =#INT_ENR
128 mov r1 , #INT_CLL_PCS
129 str r1 , [r0]
130
131 /* PLL‚Ì•ªŽü—¦Ý’è */
132 ldr r0 , =#PLL_CTL1 /* PLLK , PLLM */
133 mov r1 , #(PLL_CTL1_PLLK(PLLK_VALUE) | PLL_CTL1_PLLM(PLLM_VALUE))
134 str r1 , [r0]
135 ldr r0 , =#PLL_CTL2 /* PLLN */
136 mov r1 , #PLL_CTL2_PLLN(PLLN_VALUE)
137 str r1 , [r0]
138
139 /* PLL‹N“® */
140 ldr r0 , =#SCM_CTL
141 ldr r1 , [r0]
142 orr r1 , #SCM_CTL_PLLE
143 str r1 , [r0]
144
145 /* PLLˆÀ’è‘Ò‚¿ */
146 ldr r0 , =#SCM_STR /* APB2(8•ªŽü) */
147 wait_pll_stable:
148 ldr r1 , [r0]
149 and r1 , #SCM_STR_PLRDY
150 beq wait_pll_stable
151
152 /* ƒ}ƒXƒ^ƒNƒƒbƒNØ‚è‘Ö‚¦ */
153 ldr r0 , =#SCM_CTL
154 ldr r1 , [r0]
155 and r1 , #~SCM_CTL_RCS_MASK
156 orr r1 , #SCM_CTL_RCS_PLLCLK
157 str r1 , [r0]
158
159 isb
160
161 /* ƒgƒŒ[ƒXƒNƒƒbƒN‚̐ݒè */
162 ldr r0 , =#TTC_PSR /* TTC(8•ªŽü) */
163 mov r1 , #(APB_CLK_DIV_8)
164 str r1 , [r0]
165
166 /* ƒgƒŒ[ƒXƒ|[ƒg‚̐ݒè */
167 ldr r0 , =#PFR0
168 ldr r1 , [r0]
169 orr r1 , #(0x01F << 5)
170 str r1 , [r0]
171
172 ldr r0 , =#EPFR0
173 ldr r1 , [r0]
174 orr r1 , #(0x03 << 24)
175 str r1 , [r0]
176
177 bx lr
178
Note: See TracBrowser for help on using the repository browser.