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

Last change on this file since 164 was 164, checked in by coas-nagasima, 8 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: 4.8 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) 2003-2004 by Naoki Saito
9 * Nagoya Municipal Industrial Research Institute, JAPAN
10 * Copyright (C) 2003-2004 by Platform Development Center
11 * RICOH COMPANY,LTD. JAPAN
12 * Copyright (C) 2008-2010 by Witz Corporation, JAPAN
13 * Copyright (C) 2013 by Mitsuhiro Matsuura
14 *
15 * ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì(1)`(4)‚ÌðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒF
16 * ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü
17 * •ÏEÄ”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
18 * (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
19 * Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
20 * ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
21 * (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
22 * —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
23ƒƒ“ƒgi—˜—p
24 * ŽÒƒ}ƒjƒ…
25ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
26 * ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
27 * (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
28 * —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±
29 * ‚ƁD
30 * (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
31ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
32ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
33 * ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
34 * (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É
35 * •ñ‚·‚邱‚ƁD
36 * (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
37 * ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
38 * ‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝
39 * —R‚ÉŠî‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð
40 * –Ɛӂ·‚邱‚ƁD
41 *
42 * –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
43 * ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC“Á’è‚ÌŽg—p–Ú“I
44 * ‚ɑ΂·‚é“K‡«‚àŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒF
45 * ƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»
46 * ‚̐ӔC‚𕉂í‚È‚¢D
47 *
48 * @(#) $Id: target_serial.c 164 2016-03-07 11:33:50Z coas-nagasima $
49 */
50
51/*
52 * RX630 UART—pƒVƒŠƒAƒ‹I/Oƒ‚ƒWƒ…
53[ƒ‹
54 */
55#include "kernel_impl.h"
56#include <sil.h>
57#include "target_serial.h"
58
59/*
60 * SIOƒhƒ‰ƒCƒo‚̏‰Šú‰»
61 */
62void
63sio_initialize(intptr_t exinf)
64{
65 rx630_uart_initialize();
66}
67
68/*
69 * ƒVƒŠƒAƒ‹I/Oƒ|[ƒg‚̃I[ƒvƒ“
70 */
71SIOPCB *
72sio_opn_por(ID siopid, intptr_t exinf)
73{
74 SIOPCB *p_siopcb = NULL;
75 ER ercd;
76 INTNO intno_sio_tx, intno_sio_rx;
77
78 /*
79 * ƒVƒŠƒAƒ‹I/OŠ„ž‚Ý‚ðƒ}ƒXƒN‚·‚éD
80 * (dis_intŠÖ”‚́A"\kernel\interrupt.c"‚É‹Lq)
81 */
82 p_siopcb = rx630_uart_get_siopcb(siopid);
83 intno_sio_tx = rx630_uart_intno_tx(p_siopcb);
84 intno_sio_rx = rx630_uart_intno_rx(p_siopcb);
85 ercd = dis_int(intno_sio_tx);
86 assert(ercd == E_OK);
87 ercd = dis_int(intno_sio_rx);
88 assert(ercd == E_OK);
89
90 p_siopcb =
91 rx630_uart_opn_por(siopid , exinf , UART_BAUDRATE , UART_CLKSRC);
92
93 /*
94 * ƒVƒŠƒAƒ‹I/OŠ„ž‚Ý‚ðƒ}ƒXƒN‰ðœ‚·‚éD
95 * (ena_intŠÖ”‚́A"\kernel\interrupt.c"‚É‹Lq)
96 */
97 ercd = ena_int(intno_sio_tx);
98 assert(ercd == E_OK);
99 ercd = ena_int(intno_sio_rx);
100 assert(ercd == E_OK);
101
102 return(p_siopcb);
103}
104
105/*
106 * ƒVƒŠƒAƒ‹I/Oƒ|[ƒg‚̃Nƒ[ƒY
107 */
108void
109sio_cls_por(SIOPCB *p_siopcb)
110{
111 ER ercd;
112 INTNO intno_sio_tx, intno_sio_rx;
113
114 /*
115 * ƒfƒoƒCƒXˆË‘¶‚̃Nƒ[ƒYˆ—D
116 */
117 rx630_uart_cls_por(p_siopcb);
118
119 /*
120 * ƒVƒŠƒAƒ‹I/OŠ„ž‚Ý‚ðƒ}ƒXƒN‚·‚éD
121 */
122 intno_sio_tx = rx630_uart_intno_tx(p_siopcb);
123 intno_sio_rx = rx630_uart_intno_rx(p_siopcb);
124 ercd = dis_int(intno_sio_tx);
125 assert(ercd == E_OK);
126 ercd = dis_int(intno_sio_rx);
127 assert(ercd == E_OK);
128}
129
130/*
131 * SIO‚ÌŠ„ž‚݃nƒ“ƒhƒ‰
132 */
133void sio_tx_isr(intptr_t exinf)
134{
135 rx630_uart_tx_isr(exinf);
136}
137
138/*
139 * SIO‚ÌŠ„ž‚݃nƒ“ƒhƒ‰
140 */
141void sio_rx_isr(intptr_t exinf)
142{
143 rx630_uart_rx_isr(exinf);
144}
145
146/*
147 * ƒVƒŠƒAƒ‹I/Oƒ|[ƒg‚Ö‚Ì•¶Žš‘—M
148 */
149bool_t
150sio_snd_chr(SIOPCB *siopcb, char c)
151{
152 return(rx630_uart_snd_chr(siopcb, c));
153}
154
155/*
156 * ƒVƒŠƒAƒ‹I/Oƒ|[ƒg‚©‚ç‚Ì•¶ŽšŽóM
157 */
158int_t
159sio_rcv_chr(SIOPCB *siopcb)
160{
161 return(rx630_uart_rcv_chr(siopcb));
162}
163
164/*
165 * ƒVƒŠƒAƒ‹I/Oƒ|[ƒg‚©‚ç‚̃R[ƒ‹ƒoƒbƒN‚Ì‹–‰Â
166 */
167void
168sio_ena_cbr(SIOPCB *siopcb, uint_t cbrtn)
169{
170 rx630_uart_ena_cbr(siopcb, cbrtn);
171}
172
173/*
174 * ƒVƒŠƒAƒ‹I/Oƒ|[ƒg‚©‚ç‚̃R[ƒ‹ƒoƒbƒN‚Ì‹ÖŽ~
175 */
176void
177sio_dis_cbr(SIOPCB *siopcb, uint_t cbrtn)
178{
179 rx630_uart_dis_cbr(siopcb, cbrtn);
180}
181
182/*
183 * ƒVƒŠƒAƒ‹I/Oƒ|[ƒg‚©‚ç‚Ì‘—M‰Â”\ƒR[ƒ‹ƒoƒbƒN
184 */
185void
186rx630_uart_irdy_snd(intptr_t exinf)
187{
188 /* ‹¤’Ê•”isyssvc\serial.cj‚É‚ ‚ésio_irdy_sndŠÖ”‚ðŒÄ‚яo‚µ*/
189 sio_irdy_snd(exinf);
190}
191
192/*
193 * ƒVƒŠƒAƒ‹I/Oƒ|[ƒg‚©‚ç‚ÌŽóM’Ê’mƒR[ƒ‹ƒoƒbƒN
194 */
195void
196rx630_uart_irdy_rcv(intptr_t exinf)
197{
198 /* ‹¤’Ê•”isyssvc\serial.cj‚É‚ ‚ésio_irdy_rcvŠÖ”‚ðŒÄ‚яo‚µ*/
199 sio_irdy_rcv(exinf);
200}
201
Note: See TracBrowser for help on using the repository browser.