source: rubycfg_asp/trunk/asp_dcre/target/gr_sakura_gcc/target_serial.c@ 313

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

ソースを追加

  • 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.7 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 * 上記著作権者
16は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
17 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
18 * 変・再é…
19å¸ƒï¼ˆä»¥ä¸‹ï¼Œåˆ©ç”¨ã¨å‘¼ã¶ï¼‰ã™ã‚‹ã“とを無償で許諾する.
20 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
21 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
22 * スコード中に含まれていること.
23 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
24 * 用できる形で再é…
25å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é…
26å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨
27 * 者
28マニュアルなど)に,上記の著作権表示,この利用条件および下記
29 * の無保証規定を掲載すること.
30 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
31 * 用できない形で再é…
32å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®ã„ずれかの条件を満たすこ
33 * と.
34 * (a) 再é…
35å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€…
36マニュアルなど)に,上記の著
37 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
38 * (b) 再é…
39å¸ƒã®å½¢æ…
40‹ã‚’,別に定める方法によって,TOPPERSプロジェクトに
41 * 報告すること.
42 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
43 * 害からも,上記著作権者
44およびTOPPERSプロジェクトをå…
45è²¬ã™ã‚‹ã“と.
46 * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
47 * 由に基づく請求からも,上記著作権者
48およびTOPPERSプロジェクトを
49 * å…
50è²¬ã™ã‚‹ã“と.
51 *
52 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者
53お
54 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
55 * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
56 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
57 * の責任を負わない.
58 *
59 * @(#) $Id: target_serial.c 313 2017-07-23 04:50:32Z coas-nagasima $
60 */
61
62/*
63 * RX630 UART用シリアルI/Oモジュール
64 */
65#include "kernel_impl.h"
66#include <sil.h>
67#include "target_serial.h"
68
69/*
70 * SIOドライバの初期化
71 */
72void
73sio_initialize(intptr_t exinf)
74{
75 rx630_uart_initialize();
76}
77
78/*
79 * シリアルI/Oポートのオープン
80 */
81SIOPCB *
82sio_opn_por(ID siopid, intptr_t exinf)
83{
84 SIOPCB *p_siopcb = NULL;
85 ER ercd;
86 INTNO intno_sio_tx, intno_sio_rx;
87
88 /*
89 * シリアルI/O割込みをマスクする.
90 * (dis_int関数は、"\kernel\interrupt.c"に記述)
91 */
92 p_siopcb = rx630_uart_get_siopcb(siopid);
93 intno_sio_tx = rx630_uart_intno_tx(p_siopcb);
94 intno_sio_rx = rx630_uart_intno_rx(p_siopcb);
95 ercd = dis_int(intno_sio_tx);
96 assert(ercd == E_OK);
97 ercd = dis_int(intno_sio_rx);
98 assert(ercd == E_OK);
99
100 p_siopcb =
101 rx630_uart_opn_por(siopid , exinf , UART_BAUDRATE , UART_CLKSRC);
102
103 /*
104 * シリアルI/O割込みをマスク解除する.
105 * (ena_int関数は、"\kernel\interrupt.c"に記述)
106 */
107 ercd = ena_int(intno_sio_tx);
108 assert(ercd == E_OK);
109 ercd = ena_int(intno_sio_rx);
110 assert(ercd == E_OK);
111
112 return(p_siopcb);
113}
114
115/*
116 * シリアルI/Oポートのクローズ
117 */
118void
119sio_cls_por(SIOPCB *p_siopcb)
120{
121 ER ercd;
122 INTNO intno_sio_tx, intno_sio_rx;
123
124 /*
125 * デバイス依存のクローズ処理.
126 */
127 rx630_uart_cls_por(p_siopcb);
128
129 /*
130 * シリアルI/O割込みをマスクする.
131 */
132 intno_sio_tx = rx630_uart_intno_tx(p_siopcb);
133 intno_sio_rx = rx630_uart_intno_rx(p_siopcb);
134 ercd = dis_int(intno_sio_tx);
135 assert(ercd == E_OK);
136 ercd = dis_int(intno_sio_rx);
137 assert(ercd == E_OK);
138}
139
140/*
141 * SIOの割込みハンドラ
142 */
143void sio_tx_isr(intptr_t exinf)
144{
145 rx630_uart_tx_isr(exinf);
146}
147
148/*
149 * SIOの割込みハンドラ
150 */
151void sio_rx_isr(intptr_t exinf)
152{
153 rx630_uart_rx_isr(exinf);
154}
155
156/*
157 * シリアルI/Oポートへの文字送信
158 */
159bool_t
160sio_snd_chr(SIOPCB *siopcb, char c)
161{
162 return(rx630_uart_snd_chr(siopcb, c));
163}
164
165/*
166 * シリアルI/Oポートからの文字受信
167 */
168int_t
169sio_rcv_chr(SIOPCB *siopcb)
170{
171 return(rx630_uart_rcv_chr(siopcb));
172}
173
174/*
175 * シリアルI/Oポートからのコールバックの許可
176 */
177void
178sio_ena_cbr(SIOPCB *siopcb, uint_t cbrtn)
179{
180 rx630_uart_ena_cbr(siopcb, cbrtn);
181}
182
183/*
184 * シリアルI/Oポートからのコールバックの禁止
185 */
186void
187sio_dis_cbr(SIOPCB *siopcb, uint_t cbrtn)
188{
189 rx630_uart_dis_cbr(siopcb, cbrtn);
190}
191
192/*
193 * シリアルI/Oポートからの送信可能コールバック
194 */
195void
196rx630_uart_irdy_snd(intptr_t exinf)
197{
198 /* å…
199±é€šéƒ¨ï¼ˆsyssvc\serial.c)にあるsio_irdy_snd関数を呼び出し*/
200 sio_irdy_snd(exinf);
201}
202
203/*
204 * シリアルI/Oポートからの受信通知コールバック
205 */
206void
207rx630_uart_irdy_rcv(intptr_t exinf)
208{
209 /* å…
210±é€šéƒ¨ï¼ˆsyssvc\serial.c)にあるsio_irdy_rcv関数を呼び出し*/
211 sio_irdy_rcv(exinf);
212}
213
Note: See TracBrowser for help on using the repository browser.