source: uKadecot/trunk/ssp/target/grsakura_ccrx/target_serial.c@ 101

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

TOPPERS/uKadecotのソースコードを追加

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