source: rubycfg_asp/trunk/asp_dcre/target/gr_sakura_ccrx/target_serial.c@ 315

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

SVNプロパティを設定

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