source: asp3_tinet_ecnl_rx/trunk/asp3_dcre/syssvc/tSerialPort.cdl@ 364

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

TINETとSocket APIなどを更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/plain;charset=UTF-8
File size: 7.4 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) 2015 by Ushio Laboratory
7 * Graduate School of Engineering Science, Osaka Univ., JAPAN
8 * Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
9 * Graduate School of Information Science, Nagoya Univ., JAPAN
10 *
11 * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
12 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
13 * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
14 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
15 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
16 * スコード中に含まれていること.
17 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
18 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
19 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
20 * の無保証規定を掲載すること.
21 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
22 * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
23 * と.
24 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
25 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
26 * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
27 * 報告すること.
28 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
29 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
30 * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
31 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
32 * 免責すること.
33 *
34 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
35 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
36 * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
37 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
38 * の責任を負わない.
39 *
40 * $Id$
41 */
42
43/*
44 * シリアルインタフェースドライバのコンポーネント記述ファイル
45 */
46
47/*
48 * シリアルインタフェースドライバをTECSを用いずに呼び出すためにも必要
49 * な定義の取込み
50 */
51import_C("syssvc/serial.h");
52
53/*
54 * シリアルインタフェースドライバのシグニチャ
55 */
56signature sSerialPort {
57 ER open(void);
58 ER close(void);
59 ER_UINT read([out,size_is(length)] char *buffer, [in] uint_t length, [in] TMO tmout);
60 ER_UINT write([in,size_is(length)] const char *buffer, [in] uint_t length);
61 ER control([in] uint_t ioControl);
62 ER refer([out] T_SERIAL_RPOR *pk_rpor);
63};
64
65/*
66 * シリアルインタフェースドライバのターゲット依存部が提供する関数
67 */
68signature sSIOPort {
69 void open(void);
70 void close(void);
71 bool_t putChar([in] char c);
72 int_t getChar(void);
73 void enableCBR([in] uint_t cbrtn);
74 void disableCBR([in] uint_t cbrtn);
75};
76
77/*
78 * コールバックルーチンの識別番号(cbrtnパラメータに用いる)
79 */
80const uint_t SIOSendReady = 1; /* 送信可能コールバック */
81const uint_t SIOReceiveReady = 2; /* 受信通知コールバック */
82
83/*
84 * ターゲット依存部からのコールバック
85 */
86[callback]
87signature siSIOCBR {
88 void readySend(void);
89 void readyReceive(void);
90};
91
92/*
93 * シリアルインタフェースドライバ管理用のシグニチャ(終了処理ルーチン
94 * からの使用を想定)
95 */
96signature snSerialPortManage {
97 bool_t getChar([out] char *p_char);
98};
99
100/*
101 * シリアルポートの制御部のセルタイプ
102 */
103celltype tSerialPortMain {
104 entry sSerialPort eSerialPort;
105 entry snSerialPortManage enSerialPortManage;
106
107 call sSIOPort cSIOPort; /* 簡易SIOドライバとの接続 */
108 entry siSIOCBR eiSIOCBR;
109
110 call sSemaphore cSendSemaphore; /* 送信用セマフォとの接続 */
111 call siSemaphore ciSendSemaphore;
112 call sSemaphore cReceiveSemaphore; /* 受信用セマフォとの接続 */
113 call siSemaphore ciReceiveSemaphore;
114
115 attr {
116 uint_t receiveBufferSize = 256; /* 受信バッファサイズ */
117 uint_t sendBufferSize = 256; /* 送信バッファサイズ */
118 };
119 var {
120 bool_t openFlag = C_EXP("false"); /* オープン済みフラグ */
121 bool_t errorFlag; /* エラーフラグ */
122 uint_t ioControl; /* 動作制御の設定値 */
123
124 [size_is(receiveBufferSize)] char *receiveBuffer; /* 受信バッファ */
125 uint_t receiveReadPointer; /* 受信バッファ読出しポインタ */
126 uint_t receiveWritePointer; /* 受信バッファ書込みポインタ */
127 uint_t receiveCount; /* 受信バッファ中の文字数 */
128 char receiveFlowControl; /* 送るべきSTART/STOP */
129 bool_t receiveStopped; /* STOPを送った状態か? */
130
131 [size_is(sendBufferSize)] char *sendBuffer; /* 送信バッファ */
132 uint_t sendReadPointer; /* 送信バッファ読出しポインタ */
133 uint_t sendWritePointer; /* 送信バッファ書込みポインタ */
134 uint_t sendCount; /* 送信バッファ中の文字数 */
135 bool_t sendStopped; /* STOPを受け取った状態か? */
136 };
137};
138
139/*
140 * シリアルポートドライバ(複合セル)のセルタイプ
141 *
142 * シリアルポートの制御部と,それが使用する2つのセマフォ(受信用と送
143 * 信用)を複合化して,1つのコンポーネントとしている.
144 */
145composite tSerialPort {
146 entry sSerialPort eSerialPort;
147 entry snSerialPortManage enSerialPortManage;
148
149 call sSIOPort cSIOPort; /* 簡易SIOドライバとの接続 */
150 entry siSIOCBR eiSIOCBR;
151
152 attr {
153 uint_t receiveBufferSize = 256; /* 受信バッファサイズ */
154 uint_t sendBufferSize = 256; /* 送信バッファサイズ */
155 };
156
157 /* 受信用のセマフォ */
158 cell tSemaphore ReceiveSemaphore {
159 attribute = C_EXP("TA_NULL");
160 initialCount = 0;
161 maxCount =1;
162 };
163
164 /* 送信用のセマフォ */
165 cell tSemaphore SendSemaphore {
166 attribute = C_EXP("TA_NULL");
167 initialCount = 1;
168 maxCount =1;
169 };
170
171 /* シリアルポートの制御部 */
172 cell tSerialPortMain SerialPortMain {
173 /* セマフォとの結合 */
174 cReceiveSemaphore = ReceiveSemaphore.eSemaphore;
175 ciReceiveSemaphore = ReceiveSemaphore.eiSemaphore;
176 cSendSemaphore = SendSemaphore.eSemaphore;
177 ciSendSemaphore = SendSemaphore.eiSemaphore;
178
179 /* 呼び口のエクスポート */
180 cSIOPort => composite.cSIOPort;
181
182 /* 属性の継承 */
183 receiveBufferSize = composite.receiveBufferSize;
184 sendBufferSize = composite.sendBufferSize;
185 };
186
187 /* 受け口のエクスポート */
188 composite.eSerialPort => SerialPortMain.eSerialPort;
189 composite.enSerialPortManage => SerialPortMain.enSerialPortManage;
190 composite.eiSIOCBR => SerialPortMain.eiSIOCBR;
191};
Note: See TracBrowser for help on using the repository browser.