source: UsbWattMeter/trunk/asp_dcre/target/grsakura_ccrx/target_serial.c@ 473

Last change on this file since 473 was 167, checked in by coas-nagasima, 8 years ago

MIMEにSJISを設定

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-csrc; charset=SHIFT_JIS
File size: 4.8 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 167 2016-03-08 11:37:45Z coas-nagasima $
45 */
46
47/*
48 * RX630 UART用シリアルI/Oモジュール
49 */
50#include "kernel_impl.h"
51#include <sil.h>
52#include "target_serial.h"
53
54/*
55 * SIOドライバの初期化
56 */
57void
58sio_initialize(intptr_t exinf)
59{
60 rx630_uart_initialize();
61}
62
63/*
64 * シリアルI/Oポートのオープン
65 */
66SIOPCB *
67sio_opn_por(ID siopid, intptr_t exinf)
68{
69 SIOPCB *p_siopcb = NULL;
70 ER ercd;
71 INTNO intno_sio_tx, intno_sio_rx;
72
73 /*
74 * シリアルI/O割込みをマスクする.
75 * (dis_int関数は、"\kernel\interrupt.c"に記述)
76 */
77 p_siopcb = rx630_uart_get_siopcb(siopid);
78 intno_sio_tx = rx630_uart_intno_tx(p_siopcb);
79 intno_sio_rx = rx630_uart_intno_rx(p_siopcb);
80 ercd = dis_int(intno_sio_tx);
81 assert(ercd == E_OK);
82 ercd = dis_int(intno_sio_rx);
83 assert(ercd == E_OK);
84
85 p_siopcb =
86 rx630_uart_opn_por(siopid , exinf , UART_BAUDRATE , UART_CLKSRC);
87
88 /*
89 * シリアルI/O割込みをマスク解除する.
90 * (ena_int関数は、"\kernel\interrupt.c"に記述)
91 */
92 ercd = ena_int(intno_sio_tx);
93 assert(ercd == E_OK);
94 ercd = ena_int(intno_sio_rx);
95 assert(ercd == E_OK);
96
97 return(p_siopcb);
98}
99
100/*
101 * シリアルI/Oポートのクローズ
102 */
103void
104sio_cls_por(SIOPCB *p_siopcb)
105{
106 ER ercd;
107 INTNO intno_sio_tx, intno_sio_rx;
108
109 /*
110 * デバイス依存のクローズ処理.
111 */
112 rx630_uart_cls_por(p_siopcb);
113
114 /*
115 * シリアルI/O割込みをマスクする.
116 */
117 intno_sio_tx = rx630_uart_intno_tx(p_siopcb);
118 intno_sio_rx = rx630_uart_intno_rx(p_siopcb);
119 ercd = dis_int(intno_sio_tx);
120 assert(ercd == E_OK);
121 ercd = dis_int(intno_sio_rx);
122 assert(ercd == E_OK);
123}
124
125/*
126 * SIOの割込みハンドラ
127 */
128void sio_tx_isr(intptr_t exinf)
129{
130 rx630_uart_tx_isr(exinf);
131}
132
133/*
134 * SIOの割込みハンドラ
135 */
136void sio_rx_isr(intptr_t exinf)
137{
138 rx630_uart_rx_isr(exinf);
139}
140
141/*
142 * シリアルI/Oポートへの文字送信
143 */
144bool_t
145sio_snd_chr(SIOPCB *siopcb, char c)
146{
147 return(rx630_uart_snd_chr(siopcb, c));
148}
149
150/*
151 * シリアルI/Oポートからの文字受信
152 */
153int_t
154sio_rcv_chr(SIOPCB *siopcb)
155{
156 return(rx630_uart_rcv_chr(siopcb));
157}
158
159/*
160 * シリアルI/Oポートからのコールバックの許可
161 */
162void
163sio_ena_cbr(SIOPCB *siopcb, uint_t cbrtn)
164{
165 rx630_uart_ena_cbr(siopcb, cbrtn);
166}
167
168/*
169 * シリアルI/Oポートからのコールバックの禁止
170 */
171void
172sio_dis_cbr(SIOPCB *siopcb, uint_t cbrtn)
173{
174 rx630_uart_dis_cbr(siopcb, cbrtn);
175}
176
177/*
178 * シリアルI/Oポートからの送信可能コールバック
179 */
180void
181rx630_uart_irdy_snd(intptr_t exinf)
182{
183 /* 共通部(syssvc\serial.c)にあるsio_irdy_snd関数を呼び出し*/
184 sio_irdy_snd(exinf);
185}
186
187/*
188 * シリアルI/Oポートからの受信通知コールバック
189 */
190void
191rx630_uart_irdy_rcv(intptr_t exinf)
192{
193 /* 共通部(syssvc\serial.c)にあるsio_irdy_rcv関数を呼び出し*/
194 sio_irdy_rcv(exinf);
195}
196
Note: See TracBrowser for help on using the repository browser.