source: UsbWattMeter/trunk/asp_dcre/target/grsakura_ccrx/target_config.c@ 164

Last change on this file since 164 was 164, checked in by coas-nagasima, 6 years ago

TOPPERS/ECNLサンプルアプリ「USB充電器電力計」を追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-csrc
File size: 5.3 KB
Line 
1/*
2 * TOPPERS/ASP Kernel
3 * Toyohashi Open Platform for Embedded Real-Time Systems/
4 * Advanced Standard Profile Kernel
5 *
6 * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
7 * Toyohashi Univ. of Technology, JAPAN
8 * Copyright (C) 2005-2007 by Embedded and Real-Time Systems Laboratory
9 * Graduate School of Information Science, Nagoya Univ., JAPAN
10 * Copyright (C) 2008-2010 by Witz Corporation, JAPAN
11 * Copyright (C) 2013 by Mitsuhiro Matsuura
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 * @(#) $Id: target_config.c 164 2016-03-07 11:33:50Z coas-nagasima $
47 */
48
49/*
50 * ƒ^[ƒQƒbƒgƒVƒXƒeƒ€ˆË‘¶ƒ‚ƒWƒ…
51[ƒ‹iGR-SAKURA—pj
52 */
53
54#include "kernel_impl.h"
55#include <sil.h>
56#include "grsakura.h"
57#include "rx600/rx630_uart.h"
58
59/*
60 * ƒ^[ƒQƒbƒgƒVƒXƒeƒ€ˆË‘¶ ‰Šú‰»ƒ‹[ƒ`ƒ“
61 */
62void
63target_initialize( void )
64{
65 /*
66 * ƒvƒƒZƒbƒTˆË‘¶‚̏‰Šú‰»
67 */
68 prc_initialize();
69
70 /* IOƒ|[ƒg‰Šú‰» */
71 /* P25‚ðo—̓|[ƒg‚É‚·‚é */
72 sil_wrb_mem((uint8_t *)PORT2_PDR_ADDR,
73 sil_reb_mem((uint8_t *)PORT2_PDR_ADDR) | PORT_PDR_B5_BIT);
74 /* PA0, PA1, PA2, PA6‚ðo—̓|[ƒg‚É‚·‚é */
75 sil_wrb_mem((uint8_t *)PORTA_PDR_ADDR,
76 sil_reb_mem((uint8_t *)PORTA_PDR_ADDR) | PORT_PDR_B0_BIT | PORT_PDR_B1_BIT | PORT_PDR_B2_BIT | PORT_PDR_B6_BIT);
77 /* PA7‚ð“ü—̓|[ƒg‚É‚·‚é */
78 sil_wrb_mem((uint8_t *)PORTA_PDR_ADDR,
79 sil_reb_mem((uint8_t *)PORTA_PDR_ADDR) & ~PORT_PDR_B7_BIT);
80
81 /*
82 * ƒVƒŠƒAƒ‹ƒ|[ƒg‚̐ݒè
83 */
84 rx630_uart_init(TARGET_PUTC_PORTID, UART_BAUDRATE, UART_CLKSRC);
85
86 /* ƒ|[ƒgP20‚ðTxD0, ƒ|[ƒgP21‚ðRxD0‚É */
87 sil_wrb_mem((uint8_t *)PORT2_PMR_ADDR, 0x03);
88
89 /* ƒf[ƒ^ƒfƒBƒŒƒNƒVƒ‡ƒ“ƒŒƒWƒXƒ^(PDR)‚̐ݒè P21(RxD0)‚ð“ü—̓|[ƒg‚É‚·‚é */
90 sil_wrb_mem((uint8_t *)PORT2_PDR_ADDR,
91 sil_reb_mem((uint8_t *)PORT2_PDR_ADDR) & ~PORT_PDR_B1_BIT);
92
93 /* ƒf[ƒ^ƒfƒBƒŒƒNƒVƒ‡ƒ“ƒŒƒWƒXƒ^(PDR)‚̐ݒè P20(TxD0)‚ðo—̓|[ƒg‚É‚·‚é */
94 sil_wrb_mem((uint8_t *)PORT2_PDR_ADDR,
95 sil_reb_mem((uint8_t *)PORT2_PDR_ADDR) | PORT_PDR_B0_BIT);
96
97 /* ƒ|[ƒgP40`P47‚ðŽü•Ó‹@Ší‚É */
98 sil_wrb_mem((uint8_t *)PORT4_PMR_ADDR, 0xFF);
99
100 /* ƒ|[ƒgP40`P47‚ð“ü—̓|[ƒg‚É‚·‚é */
101 sil_wrb_mem((uint8_t *)PORT4_PDR_ADDR, 0x00);
102
103 /* ‘‚«ž‚݃vƒƒeƒNƒgƒŒƒWƒXƒ^‚̐ݒè PFSWEƒrƒbƒg‚ւ̏‘‚«ž‚Ý‚ð‹–‰Â */
104 sil_wrb_mem((uint8_t *)MPC_PWPR_ADDR, 0x00);
105 /* ‘‚«ž‚݃vƒƒeƒNƒgƒŒƒWƒXƒ^‚̐ݒè PxxFSƒŒƒWƒXƒ^‚ւ̏‘‚«ž‚Ý‚ð‹–‰Â */
106 sil_wrb_mem((uint8_t *)MPC_PWPR_ADDR, 0x40);
107
108 /* P21’[Žq‹@”\§ŒäƒŒƒWƒXƒ^ RXD0‚Æ‚·‚é */
109 sil_wrb_mem((uint8_t *)MPC_P21PFS_ADDR, 0x0a);
110 /* P20’[Žq‹@”\§ŒäƒŒƒWƒXƒ^ TXD0‚Æ‚·‚é */
111 sil_wrb_mem((uint8_t *)MPC_P20PFS_ADDR, 0x0a);
112
113 /* P40’[Žq‹@”\§ŒäƒŒƒWƒXƒ^ ƒAƒiƒƒO“ü—ÍAN000‚Æ‚·‚é */
114 sil_wrb_mem((uint8_t *)MPC_P40PFS_ADDR, 0x80);
115 /* P41’[Žq‹@”\§ŒäƒŒƒWƒXƒ^ ƒAƒiƒƒO“ü—ÍAN001‚Æ‚·‚é */
116 sil_wrb_mem((uint8_t *)MPC_P41PFS_ADDR, 0x80);
117 /* P42’[Žq‹@”\§ŒäƒŒƒWƒXƒ^ ƒAƒiƒƒO“ü—ÍAN002‚Æ‚·‚é */
118 sil_wrb_mem((uint8_t *)MPC_P42PFS_ADDR, 0x80);
119 /* P43’[Žq‹@”\§ŒäƒŒƒWƒXƒ^ ƒAƒiƒƒO“ü—ÍAN003‚Æ‚·‚é */
120 sil_wrb_mem((uint8_t *)MPC_P43PFS_ADDR, 0x80);
121 /* P44’[Žq‹@”\§ŒäƒŒƒWƒXƒ^ ƒAƒiƒƒO“ü—ÍAN004‚Æ‚·‚é */
122 sil_wrb_mem((uint8_t *)MPC_P44PFS_ADDR, 0x80);
123 /* P45’[Žq‹@”\§ŒäƒŒƒWƒXƒ^ ƒAƒiƒƒO“ü—ÍAN005‚Æ‚·‚é */
124 sil_wrb_mem((uint8_t *)MPC_P45PFS_ADDR, 0x80);
125 /* P46’[Žq‹@”\§ŒäƒŒƒWƒXƒ^ ƒAƒiƒƒO“ü—ÍAN006‚Æ‚·‚é */
126 sil_wrb_mem((uint8_t *)MPC_P46PFS_ADDR, 0x80);
127 /* P47’[Žq‹@”\§ŒäƒŒƒWƒXƒ^ ƒAƒiƒƒO“ü—ÍAN007‚Æ‚·‚é */
128 sil_wrb_mem((uint8_t *)MPC_P47PFS_ADDR, 0x80);
129
130 /* ‘‚«ž‚݃vƒƒeƒNƒgƒŒƒWƒXƒ^‚ÌÝ’è ‘‚«ž‚Ý‚ð‹ÖŽ~ */
131 sil_wrb_mem((uint8_t *)MPC_PWPR_ADDR, 0x80);
132}
133
134
135/*
136 * ƒ^[ƒQƒbƒgƒVƒXƒeƒ€‚̏I—¹ƒ‹[ƒ`ƒ“
137 */
138void
139target_exit( void )
140{
141 /*
142 * ƒvƒƒZƒbƒTˆË‘¶‚̏I—¹ˆ—
143 */
144 prc_terminate();
145
146 while ( 1 );
147}
148
149
150/*
151 * ƒVƒXƒeƒ€ƒƒO‚̒჌ƒxƒ‹o—Í‚Ì‚½‚ß‚Ì•¶Žšo—Í
152 */
153void
154target_fput_log( char c )
155{
156 if( c == '\n' ){
157 rx630_uart_pol_putc( '\r' , TARGET_PUTC_PORTID );
158 }
159
160 rx630_uart_pol_putc( c , TARGET_PUTC_PORTID );
161}
Note: See TracBrowser for help on using the repository browser.