source: rubycfg_asp/trunk/asp_dcre/target/gr_sakura_ccrx/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 * UART用シリアルI/Oモジュール
64 */
65#include <kernel.h>
66#include <sil.h>
67#include <t_syslog.h>
68#include "gr_sakura.h"
69#include "target_serial.h"
70
71/*
72 * SIOドライバの初期化
73 */
74void
75sio_initialize(intptr_t exinf)
76{
77 rx630_uart_initialize();
78}
79
80/*
81 * シリアルI/Oポートのオープン
82 */
83SIOPCB *
84sio_opn_por(ID siopid, intptr_t exinf)
85{
86 SIOPCB *p_siopcb = NULL;
87 ER ercd;
88 INTNO intno_sio_tx, intno_sio_rx;
89
90 /*
91 * シリアルI/O割込みをマスクする.
92 * (dis_int関数は、"\kernel\interrupt.c"に記述)
93 */
94 p_siopcb = rx630_uart_get_siopcb(siopid);
95 intno_sio_tx = rx630_uart_intno_tx(p_siopcb);
96 intno_sio_rx = rx630_uart_intno_rx(p_siopcb);
97 ercd = dis_int(intno_sio_tx);
98 assert(ercd == E_OK);
99 ercd = dis_int(intno_sio_rx);
100 assert(ercd == E_OK);
101
102 p_siopcb =
103 rx630_uart_opn_por(siopid , exinf , UART_BAUDRATE , UART_CLKSRC);
104
105 /*
106 * シリアルI/O割込みをマスク解除する.
107 * (ena_int関数は、"\kernel\interrupt.c"に記述)
108 */
109 ercd = ena_int(intno_sio_tx);
110 assert(ercd == E_OK);
111 ercd = ena_int(intno_sio_rx);
112 assert(ercd == E_OK);
113
114 return(p_siopcb);
115}
116
117/*
118 * シリアルI/Oポートのクローズ
119 */
120void
121sio_cls_por(SIOPCB *p_siopcb)
122{
123 ER ercd;
124 INTNO intno_sio_tx, intno_sio_rx;
125
126 /*
127 * デバイス依存のクローズ処理.
128 */
129 rx630_uart_cls_por(p_siopcb);
130
131 /*
132 * シリアルI/O割込みをマスクする.
133 */
134 intno_sio_tx = rx630_uart_intno_tx(p_siopcb);
135 intno_sio_rx = rx630_uart_intno_rx(p_siopcb);
136 ercd = dis_int(intno_sio_tx);
137 assert(ercd == E_OK);
138 ercd = dis_int(intno_sio_rx);
139 assert(ercd == E_OK);
140}
141
142/*
143 * SIOの割込みハンドラ
144 */
145void sio_tx_isr(intptr_t exinf)
146{
147 rx630_uart_tx_isr(exinf);
148}
149
150/*
151 * SIOの割込みハンドラ
152 */
153void sio_rx_isr(intptr_t exinf)
154{
155 rx630_uart_rx_isr(exinf);
156}
157
158/*
159 * シリアルI/Oポートへの文字送信
160 */
161bool_t
162sio_snd_chr(SIOPCB *siopcb, char c)
163{
164 return(rx630_uart_snd_chr(siopcb, c));
165}
166
167/*
168 * シリアルI/Oポートからの文字受信
169 */
170int_t
171sio_rcv_chr(SIOPCB *siopcb)
172{
173 return(rx630_uart_rcv_chr(siopcb));
174}
175
176/*
177 * シリアルI/Oポートからのコールバックの許可
178 */
179void
180sio_ena_cbr(SIOPCB *siopcb, uint_t cbrtn)
181{
182 rx630_uart_ena_cbr(siopcb, cbrtn);
183}
184
185/*
186 * シリアルI/Oポートからのコールバックの禁止
187 */
188void
189sio_dis_cbr(SIOPCB *siopcb, uint_t cbrtn)
190{
191 rx630_uart_dis_cbr(siopcb, cbrtn);
192}
193
194/*
195 * シリアルI/Oポートからの送信可能コールバック
196 */
197void
198rx630_uart_irdy_snd(intptr_t exinf)
199{
200 /* å…
201±é€šéƒ¨ï¼ˆsyssvc\serial.c)にあるsio_irdy_snd関数を呼び出し*/
202 sio_irdy_snd(exinf);
203}
204
205/*
206 * シリアルI/Oポートからの受信通知コールバック
207 */
208void
209rx630_uart_irdy_rcv(intptr_t exinf)
210{
211 /* å…
212±é€šéƒ¨ï¼ˆsyssvc\serial.c)にあるsio_irdy_rcv関数を呼び出し*/
213 sio_irdy_rcv(exinf);
214}
215
Note: See TracBrowser for help on using the repository browser.