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{\tgEF
|
---|
16 | * Ai{\tgEFAðüϵ½àÌðÜÞDȺ¯¶jðgpE¡»Eü
|
---|
17 | * ÏEÄzziȺCpÆÄÔj·é±Æð³Åø·éD
|
---|
18 | * (1) {\tgEFAð\[XR[hÌ`Åp·éêÉÍCãLÌì
|
---|
19 | * \¦C±Ìpð¨æѺL̳ÛØKèªC»ÌÜÜÌ`Å\[
|
---|
20 | * XR[hÉÜÜêÄ¢é±ÆD
|
---|
21 | * (2) {\tgEFAðCCu`®ÈÇC¼Ì\tgEFAJÉg
|
---|
22 | * pÅ«é`ÅÄzz·éêÉÍCÄzzɺ¤hL
|
---|
23 | gip
|
---|
24 | * Ò}j
|
---|
25 | AÈÇjÉCãLÌì \¦C±Ìpð¨æѺL
|
---|
26 | * ̳ÛØKèðfÚ·é±ÆD
|
---|
27 | * (3) {\tgEFAðC@íÉgÝÞÈÇC¼Ì\tgEFAJÉg
|
---|
28 | * pÅ«È¢`ÅÄzz·éêÉÍCÌ¢¸ê©Ìðð½·±
|
---|
29 | * ÆD
|
---|
30 | * (a) Äzzɺ¤hL
|
---|
31 | gipÒ}j
|
---|
32 | AÈÇjÉCãLÌ
|
---|
33 | * ì \¦C±Ìpð¨æѺL̳ÛØKèðfÚ·é±ÆD
|
---|
34 | * (b) ÄzzÌ`ÔðCÊÉèßéû@ÉæÁÄCTOPPERSvWFNgÉ
|
---|
35 | * ñ·é±ÆD
|
---|
36 | * (4) {\tgEFAÌpÉæè¼ÚIܽÍÔÚIɶ¶é¢©Èé¹
|
---|
37 | * Q©çàCãLì Ò¨æÑTOPPERSvWFNgðÆÓ·é±ÆD
|
---|
38 | * ܽC{\tgEFAÌ[UܽÍGh[U©çÌ¢©Èé
|
---|
39 | * RÉîÿ©çàCãLì Ò¨æÑTOPPERSvWFNgð
|
---|
40 | * ÆÓ·é±ÆD
|
---|
41 | *
|
---|
42 | * {\tgEFAÍC³ÛØÅñ³êÄ¢éàÌÅ éDãLì Ò¨
|
---|
43 | * æÑTOPPERSvWFNgÍC{\tgEFAÉÖµÄCÁèÌgpÚI
|
---|
44 | * ÉηéK«àÜßÄC¢©ÈéÛØàsíÈ¢DܽC{\tgEF
|
---|
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 UARTpVAI/OW
|
---|
53 | [
|
---|
54 | */
|
---|
55 | #include "kernel_impl.h"
|
---|
56 | #include <sil.h>
|
---|
57 | #include "target_serial.h"
|
---|
58 |
|
---|
59 | /*
|
---|
60 | * SIOhCoÌú»
|
---|
61 | */
|
---|
62 | void
|
---|
63 | sio_initialize(intptr_t exinf)
|
---|
64 | {
|
---|
65 | rx630_uart_initialize();
|
---|
66 | }
|
---|
67 |
|
---|
68 | /*
|
---|
69 | * VAI/O|[gÌI[v
|
---|
70 | */
|
---|
71 | SIOPCB *
|
---|
72 | sio_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 | * VAI/OÝð}XN·éD
|
---|
80 | * (dis_intÖÍA"\kernel\interrupt.c"ÉLq)
|
---|
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 | * VAI/OÝð}XNð·éD
|
---|
95 | * (ena_intÖÍA"\kernel\interrupt.c"ÉLq)
|
---|
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 | * VAI/O|[gÌN[Y
|
---|
107 | */
|
---|
108 | void
|
---|
109 | sio_cls_por(SIOPCB *p_siopcb)
|
---|
110 | {
|
---|
111 | ER ercd;
|
---|
112 | INTNO intno_sio_tx, intno_sio_rx;
|
---|
113 |
|
---|
114 | /*
|
---|
115 | * foCX˶ÌN[YD
|
---|
116 | */
|
---|
117 | rx630_uart_cls_por(p_siopcb);
|
---|
118 |
|
---|
119 | /*
|
---|
120 | * VAI/OÝð}XN·é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ÌÝnh
|
---|
132 | */
|
---|
133 | void sio_tx_isr(intptr_t exinf)
|
---|
134 | {
|
---|
135 | rx630_uart_tx_isr(exinf);
|
---|
136 | }
|
---|
137 |
|
---|
138 | /*
|
---|
139 | * SIOÌÝnh
|
---|
140 | */
|
---|
141 | void sio_rx_isr(intptr_t exinf)
|
---|
142 | {
|
---|
143 | rx630_uart_rx_isr(exinf);
|
---|
144 | }
|
---|
145 |
|
---|
146 | /*
|
---|
147 | * VAI/O|[gÖ̶M
|
---|
148 | */
|
---|
149 | bool_t
|
---|
150 | sio_snd_chr(SIOPCB *siopcb, char c)
|
---|
151 | {
|
---|
152 | return(rx630_uart_snd_chr(siopcb, c));
|
---|
153 | }
|
---|
154 |
|
---|
155 | /*
|
---|
156 | * VAI/O|[g©ç̶óM
|
---|
157 | */
|
---|
158 | int_t
|
---|
159 | sio_rcv_chr(SIOPCB *siopcb)
|
---|
160 | {
|
---|
161 | return(rx630_uart_rcv_chr(siopcb));
|
---|
162 | }
|
---|
163 |
|
---|
164 | /*
|
---|
165 | * VAI/O|[g©çÌR[obNÌÂ
|
---|
166 | */
|
---|
167 | void
|
---|
168 | sio_ena_cbr(SIOPCB *siopcb, uint_t cbrtn)
|
---|
169 | {
|
---|
170 | rx630_uart_ena_cbr(siopcb, cbrtn);
|
---|
171 | }
|
---|
172 |
|
---|
173 | /*
|
---|
174 | * VAI/O|[g©çÌR[obNÌÖ~
|
---|
175 | */
|
---|
176 | void
|
---|
177 | sio_dis_cbr(SIOPCB *siopcb, uint_t cbrtn)
|
---|
178 | {
|
---|
179 | rx630_uart_dis_cbr(siopcb, cbrtn);
|
---|
180 | }
|
---|
181 |
|
---|
182 | /*
|
---|
183 | * VAI/O|[g©çÌMÂ\R[obN
|
---|
184 | */
|
---|
185 | void
|
---|
186 | rx630_uart_irdy_snd(intptr_t exinf)
|
---|
187 | {
|
---|
188 | /* ¤Êisyssvc\serial.cjÉ ésio_irdy_sndÖðÄÑoµ*/
|
---|
189 | sio_irdy_snd(exinf);
|
---|
190 | }
|
---|
191 |
|
---|
192 | /*
|
---|
193 | * VAI/O|[g©çÌóMÊmR[obN
|
---|
194 | */
|
---|
195 | void
|
---|
196 | rx630_uart_irdy_rcv(intptr_t exinf)
|
---|
197 | {
|
---|
198 | /* ¤Êisyssvc\serial.cjÉ ésio_irdy_rcvÖðÄÑoµ*/
|
---|
199 | sio_irdy_rcv(exinf);
|
---|
200 | }
|
---|
201 |
|
---|