source: anotherchoice/tags/jsp-1.4.4-full-UTF8/config/tlcs900-toshiba/zup_f16_ex/uart.h@ 26

Last change on this file since 26 was 26, checked in by ykominami, 12 years ago

initial

File size: 7.7 KB
Line 
1/*
2 * TOPPERS/JSP Kernel
3 * Toyohashi Open Platform for Embedded Real-Time Systems/
4 * Just Standard Profile Kernel
5 *
6 * Copyright (C) 2006-2010 by Witz Corporation, JAPAN
7 *
8 * The above copyright holders grant permission gratis to use,
9 * duplicate, modify, or redistribute (hereafter called use) this
10 * software (including the one made by modifying this software),
11 * provided that the following four conditions (1) through (4) are
12 * satisfied.
13 *
14 * (1) When this software is used in the form of source code, the above
15 * copyright notice, this use conditions, and the disclaimer shown
16 * below must be retained in the source code without modification.
17 *
18 * (2) When this software is redistributed in the forms usable for the
19 * development of other software, such as in library form, the above
20 * copyright notice, this use conditions, and the disclaimer shown
21 * below must be shown without modification in the document provided
22 * with the redistributed software, such as the user manual.
23 *
24 * (3) When this software is redistributed in the forms unusable for the
25 * development of other software, such as the case when the software
26 * is embedded in a piece of equipment, either of the following two
27 * conditions must be satisfied:
28 *
29 * (a) The above copyright notice, this use conditions, and the
30 * disclaimer shown below must be shown without modification in
31 * the document provided with the redistributed software, such as
32 * the user manual.
33 *
34 * (b) How the software is to be redistributed must be reported to the
35 * TOPPERS Project according to the procedure described
36 * separately.
37 *
38 * (4) The above copyright holders and the TOPPERS Project are exempt
39 * from responsibility for any type of damage directly or indirectly
40 * caused from the use of this software and are indemnified by any
41 * users or end users of this software from any and all causes of
42 * action whatsoever.
43 *
44 * THIS SOFTWARE IS PROVIDED "AS IS." THE ABOVE COPYRIGHT HOLDERS AND
45 * THE TOPPERS PROJECT DISCLAIM ANY EXPRESS OR IMPLIED WARRANTIES,
46 * INCLUDING, BUT NOT LIMITED TO, ITS APPLICABILITY TO A PARTICULAR
47 * PURPOSE. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS AND THE
48 * TOPPERS PROJECT BE LIABLE FOR ANY TYPE OF DAMAGE DIRECTLY OR
49 * INDIRECTLY CAUSED FROM THE USE OF THIS SOFTWARE.
50 *
51 * 上記著作権者
52は,以下の (1)〜(4) の条件を満たす場合に限り,本ソフトウェ
53 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改変・
54 * 再é…
55å¸ƒï¼ˆä»¥ä¸‹ï¼Œåˆ©ç”¨ã¨å‘¼ã¶ï¼‰ã™ã‚‹ã“とを無償で許諾する.
56 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作権
57 * 表示,この利用条件および下記の無保証規定が,そのままの形でソース
58 * コード中に含まれていること.
59 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使用
60 * できる形で再é…
61å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é…
62å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€…
63マ
64 * ニュアルなど)に,上記の著作権表示,この利用条件および下記の無保
65 * 証規定を掲載すること.
66 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使用
67 * できない形で再é…
68å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®ã„ずれかの条件を満たすこと.
69 * (a) 再é…
70å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€…
71マニュアルなど)に,上記の著作
72 * 権表示,この利用条件および下記の無保証規定を掲載すること.
73 * (b) 再é…
74å¸ƒã®å½¢æ…
75‹ã‚’,別に定める方法によって,TOPPERSプロジェクトに報
76 * 告すること.
77 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損害
78 * からも,上記著作権者
79およびTOPPERSプロジェクトをå…
80è²¬ã™ã‚‹ã“と.また,
81 * 本ソフトウェアのユーザまたはエンドユーザからのいかなる理由に基づ
82 * く請求からも,上記著作権者
83およびTOPPERSプロジェクトをå…
84è²¬ã™ã‚‹ã“と.
85 *
86 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者
87およ
88 * びTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的に対す
89 * る適合性も含めて,いかなる保証も行わない.また,本ソフトウェアの利用
90 * により直接的または間接的に生じたいかなる損害に関しても,その責任を負
91 * わない.
92 *
93 * @(#) $Id: uart.h,v 1.1 2006/04/10 08:19:25 honda Exp $
94 */
95
96/*
97 * 非同期通信 (UART)シリアルチャンネルデバイス(SIO)ドライバ
98 * (Zup-F16拡張ボード用)
99 */
100
101#ifndef _UART_H_
102#define _UART_H_
103
104/*
105 * シリアルコントロールレジスタの設定値
106 */
107/* 19200bps = (6144000*4)/4/(BRCK)/(BRS+(16-BRK)/16)/16 */
108/* BRCK=4分周,BRS=5カウント,+(16-BRK)/16 は未使用 */
109#define BRCR_19200 (TBIT_SIOBRCK2 | 5)
110#define BRADD_19200 0
111/* 38400bps = (6144000*4)/4/(BRCK)/(BRS+(16-BRK)/16)/16 */
112/* BRCK=1分周,BRS=10カウント,+(16-BRK)/16 は未使用 */
113#define BRCR_38400 (TBIT_SIOBRCK0 | 10)
114#define BRADD_38400 0
115#define INT_LEVEL_UART 5 /* 割込みレベル */
116
117/*
118 * シリアルI/Oの割込みハンドラのベクタ番号
119 */
120#define INHNO_SERIAL_IN1 INT_NO_RX1
121#define INHNO_SERIAL_OUT1 INT_NO_TX1
122#define INHNO_SERIAL_IN2 INT_NO_RX0
123#define INHNO_SERIAL_OUT2 INT_NO_TX0
124
125#ifndef _MACRO_ONLY
126
127/*
128 * シリアルI/Oポート初期化ブロックの定義
129 */
130typedef struct sio_port_initialization_block {
131 UH cntrl; /* コントロールレジスタの番地 */
132 UH hint; /* 割込みレジスタの番地 */
133
134 UB pcrfc_def; /* デフォールトの設定値 (P9CR/P9FC) */
135 UB scmod0_def; /* デフォールトの設定値 (SCMOD0) */
136 UB sccr_def; /* デフォールトの設定値 (SCCR) */
137 UB brcr_def; /* デフォールトの設定値 (BRCR) */
138 UB bradd_def; /* デフォールトの設定値 (BRADD) */
139 UB int_clr; /* 割込み要求フラグクリアコマンド */
140} SIOPINIB;
141
142/*
143 * シリアルI/Oポート管理ブロックの定義
144 */
145typedef struct sio_port_control_block {
146 const SIOPINIB *siopinib; /* シリアルI/Oポート初期化ブロック */
147 VP_INT exinf; /* 拡張情
148å ± */
149 INT rxb; /* 受信バッファ */
150 volatile UB sts_flag; /* 送信バッファ空フラグ */
151} SIOPCB;
152
153/*
154 * コールバックルーチンの識別番号
155 */
156#define UART_ERDY_SND 1u /* 送信可能コールバック */
157#define UART_ERDY_RCV 2u /* 受信通知コールバック */
158
159/*
160 * SIOドライバの初期化ルーチン
161 */
162extern void uart_initialize(void);
163
164/*
165 * シリアルI/Oポートのオープン
166 */
167extern SIOPCB * uart_opn_por(ID siopid, VP_INT exinf);
168
169/*
170 * シリアルI/Oポートのクローズ
171 */
172extern void uart_cls_por(SIOPCB *siopcb);
173
174/*
175 * シリアルI/Oポートへの文字送信
176 */
177extern BOOL uart_snd_chr(SIOPCB *siopcb, char c);
178
179/*
180 * シリアルI/Oポートからの文字受信
181 */
182extern INT uart_rcv_chr(SIOPCB *siopcb);
183
184/*
185 * シリアルI/Oポートからのコールバックの許可
186 */
187extern void uart_ena_cbr(SIOPCB *siopcb, UINT cbrtn);
188
189/*
190 * シリアルI/Oポートからのコールバックの禁止
191 */
192extern void uart_dis_cbr(SIOPCB *siopcb, UINT cbrtn);
193
194/*
195 * シリアルI/Oポートからの送信可能コールバック
196 */
197extern void uart_ierdy_snd(VP_INT exinf);
198
199/*
200 * シリアルI/Oポートからの受信通知コールバック
201 */
202extern void uart_ierdy_rcv(VP_INT exinf);
203
204#endif /* _MACRO_ONLY */
205#endif /* _UART_H_ */
206
Note: See TracBrowser for help on using the repository browser.