source: anotherchoice/tags/jsp-1.4.4-full-UTF8/config/armv4/integrator/integrator.h@ 363

Last change on this file since 363 was 363, checked in by ykominami, 5 years ago

add tags/jsp-1.4.4-full-UTF8

  • Property svn:executable set to *
File size: 14.9 KB
RevLine 
[363]1/*
2 * TOPPERS/JSP Kernel
3 * Toyohashi Open Platform for Embedded Real-Time Systems/
4 * Just 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 by Advanced Data Controls, Corp
9 * Copyright (C) 2004 by Embedded and Real-Time Systems Laboratory
10 * Graduate School of Information Science, Nagoya Univ., JAPAN
11 *
12 * 上記著作権者
13は,以下の (1)〜(4) の条件か,Free Software Foundation
14 * によってå…
15¬è¡¨ã•ã‚Œã¦ã„ã‚‹ GNU General Public License の Version 2 に記
16 * 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
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お
49 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
50 * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
51 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
52 *
53 * @(#) $Id: integrator.h,v 1.2 2004/05/26 19:14:24 honda Exp $
54 */
55
56#ifndef _INTEGRATOR_H_
57#define _INTEGRATOR_H_
58
59#ifndef _MACRO_ONLY
60#include <itron.h>
61#include <sil.h>
62#endif /* _MACRO_ONLY */
63
64#include "armv4.h"
65#include "sys_config.h"
66#include "cpu_config.h"
67
68
69
70
71/*
72 * CMxx Base Address
73 */
74#define CM_BASE 0x10000000
75
76/*
77 * CM Registers
78 */
79#define CM_ID (CM_BASE)
80#define CM_PROC (CM_BASE + 0004)
81#define CM_OSC (CM_BASE + 0x008)
82#define CM_CTRL (CM_BASE + 0x00c)
83#define CM_STAT (CM_BASE + 0x010)
84#define CM_LOCK (CM_BASE + 0x014)
85#define CM_SDRAM (CM_BASE + 0x020)
86#define CM_IRQ_STAT (CM_BASE + 0x040)
87#define CM_IRQ_RSTAT (CM_BASE + 0x044)
88#define CM_IRQ_ENSET (CM_BASE + 0x048)
89#define CM_IRQ_ENCLR (CM_BASE + 0x04c)
90#define CM_SOFT_INTSET (CM_BASE + 0x050)
91#define CM_SOFT_INTCLR (CM_BASE + 0x054)
92#define CM_FIR_STAT (CM_BASE + 0x060)
93#define CM_FIR_RSTAT (CM_BASE + 0x064)
94#define CM_FIR_ENSET (CM_BASE + 0x068)
95#define CM_FIR_ENCLR (CM_BASE + 0x06c)
96#define CM_SPD (CM_BASE + 0x100)
97
98
99/*
100 * Core module oscillator register : CM_OSC
101 */
102#define L_OD_MASK (0x7 << 20)
103#define L_OD_DIV10 (0x0 << 20)
104#define L_OD_DIV2 (0x1 << 20)
105#define L_OD_DIV8 (0x2 << 20)
106#define L_OD_DIV4 (0x3 << 20)
107#define L_OD_DIV5 (0x4 << 20)
108#define L_OD_DIV7 (0x5 << 20)
109#define L_OD_DIV9 (0x6 << 20)
110#define L_OD_DIV6 (0x7 << 20)
111
112#define L_VDW_MASK (0xff << 12)
113#define L_VDW(x) ((x) << 12)
114
115#define LCLK_MASK (L_OD_MASK | L_VDW_MASK)
116#define LCLK_20MHZ (L_OD_DIV2 | L_VDW( 0x20))
117#define LCLK_33MHZ (L_OD_DIV2 | L_VDW( 0x3a))
118#define LCLK_50MHZ (L_OD_DIV2 | L_VDW( 0x5c))
119#define LCLK_66MHZ (L_OD_DIV2 | L_VDW( 0x7c))
120
121#define C_OD_MASK (0x7 << 8)
122#define C_OD_DIV10 (0x0 << 8)
123#define C_OD_DIV2 (0x1 << 8)
124#define C_OD_DIV8 (0x2 << 8)
125#define C_OD_DIV4 (0x3 << 8)
126#define C_OD_DIV5 (0x4 << 8)
127#define C_OD_DIV7 (0x5 << 8)
128#define C_OD_DIV9 (0x6 << 8)
129#define C_OD_DIV6 (0x7 << 8)
130
131#define C_VDW_MASK (0xff << 0)
132#define C_VDW(x) ((x) << 0)
133
134#define CORECLK_MASK (C_OD_MASK | C_VDW_MASK)
135#define CORECLK_50MHZ (C_OD_DIV2 | C_VDW( 0x2a))
136#define CORECLK_66MHZ (C_OD_DIV2 | C_VDW( 0x3a))
137#define CORECLK_100MHZ (C_OD_DIV2 | C_VDW( 0x5c))
138#define CORECLK_133MHZ (C_OD_DIV2 | C_VDW( 0x7d))
139#define CORECLK_150MHZ (C_OD_DIV2 | C_VDW( 0x8e))
140#define CORECLK_160MHZ (C_OD_DIV2 | C_VDW( 0x98))
141
142
143/*
144 * Core module control register : CM_CTRL
145 */
146#define CM_CTRL_RESET 0x08
147#define CM_CTRL_REMAP 0x04
148#define CM_CTRL_LED 0x01
149
150
151/*
152 * Core modeule lock register : CM_LOCK
153 */
154#define CM_LOCK_LOCKED 0x0100
155#define LOCKVAL_LOCK 0x0000
156#define LOCKVAL_UNLOCK 0xa05f
157
158
159/*
160 * Integrator AP Peripheral Base Address
161 *
162 */
163#define IRQ_BASE_REG 0x14000000
164#define TIMER_BASE_REG 0x13000000
165#define UART0_BASE_REG 0x16000000
166#define UART1_BASE_REG 0x17000000
167
168
169/*
170 * Interrupt Control Registers
171 */
172#define IRQ0_STATUS (IRQ_BASE_REG)
173#define IRQ0_RAWSTAT (IRQ_BASE_REG + 0x04)
174#define IRQ0_ENABLESET (IRQ_BASE_REG + 0x08)
175#define IRQ0_ENABLECLR (IRQ_BASE_REG + 0x0c)
176
177#define IRQ_EXTINT_BIT 0x15
178#define IRQ_PCILBINT_BIT 0x14
179#define IRQ_ENUMINT_BIT 0x13
180#define IRQ_DEGINT_BIT 0x12
181#define IRQ_LINT_BIT 0x11
182#define IRQ_PCIINT3_BIT 0x10
183#define IRQ_PCIINT2_BIT 0x0f
184#define IRQ_PCIINT1_BIT 0x0e
185#define IRQ_PCIINT0_BIT 0x0d
186#define IRQ_EXPINT3_BIT 0x0c
187#define IRQ_EXPINT2_BIT 0x0b
188#define IRQ_EXPINT1_BIT 0x0a
189#define IRQ_EXPINT0_BIT 0x09
190#define IRQ_RTCINT_BIT 0x08
191#define IRQ_TM2_BIT 0x07
192#define IRQ_TM1_BIT 0x06
193#define IRQ_TM0_BIT 0x05
194#define IRQ_MOUSEINT_BIT 0x04
195#define IRQ_KBDINT_BIT 0x03
196#define IRQ_UART1_BIT 0x02
197#define IRQ_UART0_BIT 0x01
198#define IRQ_SOFTINT_BIT 0x00
199
200#define IRQ_EXTINT (1 << IRQ_EXTINT_BIT)
201#define IRQ_PCILBIN (1 << IRQ_PCILBIN_BIT)
202#define IRQ_ENUMINT (1 << IRQ_ENUMINT_BIT)
203#define IRQ_DEGINT (1 << IRQ_DEGINT_BIT)
204#define IRQ_LINT (1 << IRQ_LINT_BIT)
205#define IRQ_PCIINT3 (1 << IRQ_PCIINT3_BIT)
206#define IRQ_PCIINT2 (1 << IRQ_PCIINT2_BIT)
207#define IRQ_PCIINT1 (1 << IRQ_PCIINT1_BIT)
208#define IRQ_PCIINT0 (1 << IRQ_PCIINT0_BIT)
209#define IRQ_EXPINT3 (1 << IRQ_EXPINT3_BIT)
210#define IRQ_EXPINT2 (1 << IRQ_EXPINT2_BIT)
211#define IRQ_EXPINT1 (1 << IRQ_EXPINT1_BIT)
212#define IRQ_EXPINT0 (1 << IRQ_EXPINT0_BIT)
213#define IRQ_RTCINT (1 << IRQ_RTCINT_BIT)
214#define IRQ_TM2 (1 << IRQ_TM2_BIT)
215#define IRQ_TM1 (1 << IRQ_TM1_BIT)
216#define IRQ_TM0 (1 << IRQ_TM0_BIT)
217#define IRQ_MOUSEINT (1 << IRQ_MOUSEINT_BIT)
218#define IRQ_KBDINT (1 << IRQ_KBDINT_BIT)
219#define IRQ_UART1 (1 << IRQ_UART1_BIT)
220#define IRQ_UART0 (1 << IRQ_UART0_BIT)
221#define IRQ_SOFTINT (1 << IRQ_SOFTINT_BIT)
222
223
224/*
225 * Interrupt Mask
226 * Timer2は最高優å…
227ˆåº¦ã‚’もつ ??
228 */
229
230#define MASK_IRQ_TM2 0x3FFFFF
231#define MASK_IRQ_TM1 0x3FFF7F
232#define MASK_IRQ_TM0 0x3FFF3F
233#define MASK_IRQ_MOUSEINT 0x3FFF1F
234#define MASK_IRQ_KBDINT 0x3FFF0F
235#define MASK_IRQ_UART1 0x3FFF07
236#define MASK_IRQ_UART0 0x3FFF03
237#define MASK_IRQ_SOFTINT 0x3FFF01
238
239#define MASK_IRQ_EXTINT 0x3FFF00
240#define MASK_IRQ_PCILBINT 0x1FFF00
241#define MASK_IRQ_ENUMINT 0x0FFF00
242#define MASK_IRQ_DEGINT 0x07FF00
243#define MASK_IRQ_LINT 0x03FF00
244#define MASK_IRQ_PCIINT3 0x01FF00
245#define MASK_IRQ_PCIINT2 0x00FF00
246#define MASK_IRQ_PCIINT1 0x007F00
247#define MASK_IRQ_PCIINT0 0x003F00
248#define MASK_IRQ_EXPINT3 0x001F00
249#define MASK_IRQ_EXPINT2 0x000F00
250#define MASK_IRQ_EXPINT1 0x000700
251#define MASK_IRQ_EXPINT0 0x000300
252#define MASK_IRQ_RTCINT 0x000100
253
254#define INT_DISABLE_ALL 0x3FFFFF
255
256
257
258/*
259 * UART0 Control Registers
260 */
261#define UART0_DR (UART0_BASE_REG)
262#define UART0_RSR (UART0_BASE_REG + 0x04)
263#define UART0_ECR (UART0_BASE_REG + 0x04)
264#define UART0_LCRH (UART0_BASE_REG + 0x08)
265#define UART0_LCRM (UART0_BASE_REG + 0x0C)
266#define UART0_LCRL (UART0_BASE_REG + 0x10)
267#define UART0_CR (UART0_BASE_REG + 0x14)
268#define UART0_FR (UART0_BASE_REG + 0x18)
269#define UART0_IIR (UART0_BASE_REG + 0x1C)
270#define UART0_ICR (UART0_BASE_REG + 0x1C)
271
272
273/*
274 * UART1 Control Registers
275 */
276#define UART1_DR (UART1_BASE_REG)
277#define UART1_RSR (UART1_BASE_REG + 0x04)
278#define UART1_ECR (UART1_BASE_REG + 0x04)
279#define UART1_LCRH (UART1_BASE_REG + 0x08)
280#define UART1_LCRM (UART1_BASE_REG + 0x0C)
281#define UART1_LCRL (UART1_BASE_REG + 0x10)
282#define UART1_CR (UART1_BASE_REG + 0x14)
283#define UART1_FR (UART1_BASE_REG + 0x18)
284#define UART1_IIR (UART1_BASE_REG + 0x1C)
285#define UART1_ICR (UART1_BASE_REG + 0x1C)
286
287/*
288 * Receive Error Constants : UARTx_RSR
289 */
290#define URSR_OVERRUN 0x8
291#define URSR_BREAK 0x4
292#define URSR_PARITY 0x2
293#define URSR_FRAMING 0x1
294
295/*
296 * Line Control Constants: UARTx_LCRH
297 */
298/*[6:5] Word Length*/
299#define ULCRH_WLEN_8BIT 0x60
300#define ULCRH_WLEN_7BIT 0x40
301#define ULCRH_WLEN_6BIT 0x20
302#define ULCRH_WLEN_5BIT 0x00
303/*[4] FIFO*/
304#define ULCRH_FEN 0x10
305/*[3] Stop Bit*/
306#define ULCRH_STP2 0x08
307/*[2] Even Parity Select*/
308#define ULCRH_EPS 0x04
309/*[1] Parity Enable*/
310#define ULCRH_PEN 0x02
311/*[0] Send Break*/
312#define ULCRH_BRK 0x01
313
314
315/*
316 * Line Control Constants: UARTx_LCRM
317 */
318/*[7:0] Baud Rate*/
319#define ULCRM_460800 0x00
320#define ULCRL_460800 0x01
321
322#define ULCRM_230400 0x00
323#define ULCRL_230400 0x03
324
325#define ULCRM_115200 0x00
326#define ULCRL_115200 0x07
327
328#define ULCRM_76800 0x00
329#define ULCRL_76800 0x0B
330
331#define ULCRM_57600 0x00
332#define ULCRL_57600 0x0F
333
334#define ULCRM_38400 0x0
335#define ULCRL_38400 0x17
336
337#define ULCRM_19200 0x00
338#define ULCRL_19200 0x2F
339
340#define ULCRM_14400 0x00
341#define ULCRL_14400 0x3F
342
343#define ULCRM_9600 0x0
344#define ULCRL_9600 0x5F
345
346#define ULCRM_2400 0x00
347#define ULCRL_2400 0x7F
348
349#define ULCRM_1200 0x00
350#define ULCRL_1200 0xFF
351
352
353/*
354 * Control Register Constants : UARTx_CR
355 */
356/*[7] Loop Back Enable*/
357#define UCR_LBE 0x80
358/*[6] Receive Timeout Interrupt Enable*/
359#define UCR_RTIE 0x40
360/*[5] Transmit Interrupt Enable*/
361#define UCR_TIE 0x20
362/*[4] Receive Interrupt Enable*/
363#define UCR_RIE 0x10
364/*[3] Modem Status Interrupt Enable*/
365#define UCR_MSIE 0x08
366/*[0] UART Enable*/
367#define UCR_UARTEN 0x01
368
369/*
370 * Flag Register Constants : UARTx_FR
371 */
372/*[7] Transmit FIFO Empty*/
373#define UFR_TXFE 0x80
374/*[6] Receive FIFO Full*/
375#define UFR_RXFF 0x40
376/*[5] Transmit FIFO Full*/
377#define UFR_TXFF 0x20
378/*[4] Receive FIFO Empty*/
379#define UFR_RXFE 0x10
380/*[3] UART Busy*/
381#define UFR_BUSY 0x08
382/*[2] Data Carrier Detect*/
383#define UFR_DCD 0x04
384/*[1] Data Set Ready*/
385#define UFR_DSR 0x02
386/*[0] Clear To Send*/
387#define UFR_CTS 0x01
388
389/*
390 * Interrupt Identifier Constantse: UARTx_IIR
391 */
392/*[3] Receive Timeout Interrupt Status*/
393#define IIR_TRIS 0x08
394/*[2] Transmit Interrupt Status*/
395#define IIR_TIS 0x04
396/*[1] Receive Interrupt Status*/
397#define IIR_RIS 0x02
398/*[0] Modem Interrupt Status*/
399#define IIR_MIS 0x01
400
401
402/*
403 * Timer 1 Control Registers
404 */
405#define TM1_LOAD (TIMER_BASE_REG + 0x100)
406#define TM1_VAL (TIMER_BASE_REG + 0x104)
407#define TM1_CTRL (TIMER_BASE_REG + 0x108)
408#define TM1_CLR (TIMER_BASE_REG + 0x10c)
409
410/*
411 * Timer 0 Control Registers
412 */
413#define TM2_LOAD (TIMER_BASE_REG + 0x200)
414#define TM2_VAL (TIMER_BASE_REG + 0x204)
415#define TM2_CTRL (TIMER_BASE_REG + 0x208)
416#define TM2_CLR (TIMER_BASE_REG + 0x20C)
417
418/*
419 * Timer Constants : TMx_CTRL and TMx_CLR
420 */
421#define TCTRL_STOP 0x0
422/*
423 * start bit (7th bit) enabled
424 * periodic bit (6th bit) enabled
425 */
426#define TCTRL_START 0x80
427#define TCLR_CLEAR 0x01
428
429#define TCTRL_PERIODIC 0x40
430
431#define TCTRL_D016 0x04
432#define TCTRL_D256 0x08
433
434/*disable timer1 interrupt*/
435#define TCLR_DISABLE 0x20
436
437#ifndef _MACRO_ONLY
438
439/*
440 * 内
441蔵UART用 簡易SIOドライバ
442 */
443/*
444 * カーネル起動時用の初期化(sys_putcを使用するため)
445 */
446extern void init_uart(void);
447
448
449/*
450 * シリアルI/Oポート初期化ブロック
451 */
452typedef struct sio_port_initialization_block
453{
454 VP uart_data;
455 VP uart_control;
456 VP linectrl_lo;
457 VP linectrl_mid;
458 VP linectrl_hi;
459 VP int_identifier;
460 VP flag_register;
461 VW irq_bit;
462}
463SIOPINIB;
464
465/*
466 * シリアルI/Oポート管理ブロックの定義
467 */
468typedef struct sio_port_control_block
469{
470 const SIOPINIB *siopinib; /* シリアルI/Oポート初期化ブロック */
471 VP_INT exinf; /* 拡張情
472å ± */
473 BOOL openflag; /* オープン済みフラグ */
474 BOOL sendflag; /* 送信割込みイネーブルフラグ */
475 BOOL getready; /* 文字を受信した状æ…
476‹ */
477 BOOL putready; /* 文字を送信できる状æ…
478‹ */
479
480}SIOPCB;
481
482
483/*
484 * コールバックルーチンの識別番号
485 */
486#define SIO_ERDY_SND 1u /* 送信可能コールバック */
487#define SIO_ERDY_RCV 2u /* 受信通知コールバック */
488
489/*
490 * オンチップのUARTからのポーリング出力
491 */
492extern void uart_putc(char c);
493
494/*
495 * SIOドライバの初期化ルーチン
496 */
497extern void uart_initialize(void);
498
499/*
500 * オープンしているポートがあるか?
501 */
502extern BOOL uart_openflag(void);
503
504/*
505 * シリアルI/Oポートのオープン
506 */
507extern SIOPCB *uart_opn_por(ID siopid, VP_INT exinf);
508
509/*
510 * シリアルI/Oポートのクローズ
511 */
512extern void uart_cls_por(SIOPCB *siopcb);
513
514/*
515 * シリアルI/Oポートへの文字送信
516 */
517extern BOOL uart_snd_chr(SIOPCB *siopcb, char c);
518
519/*
520 * シリアルI/Oポートからの文字受信
521 */
522extern INT uart_rcv_chr(SIOPCB *siopcb);
523
524/*
525 * シリアルI/Oポートからのコールバックの許可
526 */
527extern void uart_ena_cbr(SIOPCB *siopcb, UINT cbrtn);
528
529/*
530 * シリアルI/Oポートからのコールバックの禁止
531 */
532extern void uart_dis_cbr(SIOPCB *siopcb, UINT cbrtn);
533
534/*
535 * SIOの割込みサービスルーチン
536 */
537extern void uart_in_isr(void);
538extern void uart_out_isr(void);
539
540/*
541 * シリアルI/Oポートからの送信可能コールバック
542 */
543extern void uart_ierdy_snd(VP_INT exinf);
544
545/*
546 * シリアルI/Oポートからの受信通知コールバック
547 */
548extern void uart_ierdy_rcv(VP_INT exinf);
549
550
551
552#endif /* _MACRO_ONLY */
553#endif /* _INTEGRATOR_H_ */
Note: See TracBrowser for help on using the repository browser.