source: anotherchoice/tags/jsp-1.4.4-full-UTF8/config/armv4/frk_aduc/frk_aduc.h@ 26

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

initial

File size: 15.2 KB
RevLine 
[26]1/*
2 * TOPPERS/JSP Kernel
3 * Toyohashi Open Platform for Embedded Real-Time Systems/
4 * Just Standard Profile Kernel
5 *
6 * Copyright (C) 2000-2006 by Embedded and Real-Time Systems Laboratory
7 * Toyohashi Univ. of Technology, JAPAN
8 * Copyright (C) 2005-2006 by Logic Research Co., Ltd.
9 *
10 * 上記著作権者
11は,以下の (1)〜(4) の条件か,Free Software Foundation
12 * によってå…
13¬è¡¨ã•ã‚Œã¦ã„ã‚‹ GNU General Public License の Version 2 に記
14 * 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
15 * を改変したものを含む.以下同じ)を使用・複製・改変・再é…
16å¸ƒï¼ˆä»¥ä¸‹ï¼Œ
17 * 利用と呼ぶ)することを無償で許諾する.
18 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
19 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
20 * スコード中に含まれていること.
21 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
22 * 用できる形で再é…
23å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é…
24å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨
25 * 者
26マニュアルなど)に,上記の著作権表示,この利用条件および下記
27 * の無保証規定を掲載すること.
28 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
29 * 用できない形で再é…
30å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®ã„ずれかの条件を満たすこ
31 * と.
32 * (a) 再é…
33å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€…
34マニュアルなど)に,上記の著
35 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
36 * (b) 再é…
37å¸ƒã®å½¢æ…
38‹ã‚’,別に定める方法によって,TOPPERSプロジェクトに
39 * 報告すること.
40 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
41 * 害からも,上記著作権者
42およびTOPPERSプロジェクトをå…
43è²¬ã™ã‚‹ã“と.
44 *
45 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者
46お
47 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
48 * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
49 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
50 *
51 */
52
53#ifndef _FRK_ADUC_H_
54#define _FRK_ADUC_H_
55
56#ifndef _MACRO_ONLY
57#include <itron.h>
58#include <sil.h>
59#endif /* _MACRO_ONLY */
60
61#include <armv4.h>
62#include "sys_config.h"
63#include "cpu_config.h"
64
65
66
67/*
68 * GPIO
69 */
70/* GPIO Register address */
71#define GPIO_BASE 0xFFFFF400 /* GPIO base-address */
72#define GP0CON (GPIO_BASE | 0x00) /* GPIO port0 condition register */
73#define GP1CON (GPIO_BASE | 0x04) /* GPIO port1 condition register */
74#define GP2CON (GPIO_BASE | 0x08) /* GPIO port2 condition register */
75#define GP4CON (GPIO_BASE | 0x10) /* GPIO port4 condition register */
76#define GP4DAT (GPIO_BASE | 0x60) /* GPIO data register */
77#define GP4SET (GPIO_BASE | 0x64) /* GPIO SET feild */
78#define GP4CLR (GPIO_BASE | 0x68) /* GPIO CLEAR feild */
79
80/* Port4 data */
81#define P47_DIR 0x80000000 /* Port4 pin7 Direction - Output */
82#define LED 0x00800000 /* Port4 pin7 data */
83
84/* Serial mode */
85#define GP07_SIN 0x20000000
86#define GP10_SIN 0x00000001
87#define GP11_SOUT 0x00000010
88#define GP12_RTS 0x00000100
89#define GP13_CTS 0x00001000
90#define GP14_RI 0x00010000
91#define GP15_DCD 0x00100000
92#define GP16_DSR 0x01000000
93#define GP17_DTR 0x10000000
94#define GP20_SOUT 0x00000002
95
96
97
98
99/*
100 * PLL
101 */
102/* PLL Registers */
103#define PLL_BASE 0xFFFF0400 /* PLL base-address */
104#define POWKEY1_VCT 0x04
105#define POWCON_VCT 0x08
106#define POWKEY2_VCT 0x0C
107#define PLLKEY1_VCT 0x10
108#define PLLCON_VCT 0x14
109#define PLLKEY2_VCT 0x18
110
111#define POWKEY1 (PLL_BASE|POWKEY1_VCT) /* POWKEY1 address */
112#define POWCON (PLL_BASE|POWCON_VCT) /* POWCOM address */
113#define POWKEY2 (PLL_BASE|POWKEY2_VCT) /* POWKEY2 address */
114#define PLLKEY1 (PLL_BASE|PLLKEY1_VCT) /* PLLKEY1 address */
115#define PLLCON (PLL_BASE|PLLCON_VCT) /* PLLCON address */
116#define PLLKEY2 (PLL_BASE|PLLKEY2_VCT) /* PLLKEY2 address */
117
118
119
120/* KEY's offset */
121#define POWKEY1_DATA 0x01 /* POWKEY1 data */
122#define POWKEY2_DATA 0xF4 /* POWKEY2 data */
123#define PLLKEY1_DATA 0xAA /* PLLKEY1 data */
124#define PLLKEY2_DATA 0x55 /* PLLKEY2 data */
125
126/* POWCON bits */
127#define POWCON_PC_STP 0x40 /* Stop mode */
128#define POWCON_PC_SLP 0x30 /* Sleep mode */
129#define POWCON_PC_NAP 0x20 /* Nap. */
130#define POWCON_PC_PAU 0x10 /* Pause mode */
131#define POWCON_PC_ACT 0x00 /* Active mode */
132
133#define POWCON_CD_326K 0x07 /* Core Clock = 326KHz */
134#define POWCON_CD_653K 0x06 /* Core Clock = 653KHz */
135#define POWCON_CD_1M 0x05 /* Core Clock = 1.31MHz */
136#define POWCON_CD_2M 0x04 /* Core Clock = 2.61MHz */
137#define POWCON_CD_5M 0x03 /* Core Clock = 5.22MHz */
138#define POWCON_CD_10M 0x02 /* Core Clock = 10.44MHz */
139#define POWCON_CD_20M 0x01 /* Core Clock = 20.89MHz */
140#define POWCON_CD_41M 0x00 /* Core Clock = 41.78MHz */
141
142/* PLLCON bits */
143#define PLLCON_OSEL 0x20 /* 1:internal oscillator, 0:external crystal */
144
145#define PLLCON_MDCLK_EXT 0x03 /* External Clock on P0.7 pin */
146#define PLLCON_MDCLK_PLL 0x01 /* PLL */
147
148
149
150/*
151 * FRK_ADuC Peripheral Base Address
152 */
153#define IRQ_BASE 0xFFFF0000 /* IRQ base-address */
154#define TIMER_BASE 0xFFFF0300 /* Timer base-address */
155#define UART_BASE 0xFFFF0700
156
157
158
159/*
160 * Remap Register
161 */
162#define REMAP 0xFFFF0220
163
164#define REMAP_SRAM 0x01 /* remap the sram to address to 0 */
165
166
167
168/*
169 * IRQ
170 */
171/* IRQ Registers */
172#define IRQSTA (IRQ_BASE | 0x00) /* IRQ Status Register */
173#define IRQSIG (IRQ_BASE | 0x04) /* IRQ Signal Register */
174#define IRQEN (IRQ_BASE | 0x08) /* IRQ enable Register */
175#define IRQCLR (IRQ_BASE | 0x0C) /* IRQ Clear Register */
176#define SWICFG (IRQ_BASE | 0x10)
177
178#define IRQ_PWMTRIP_BIT 23
179#define IRQ_EXT3_BIT 22
180#define IRQ_EXT2_BIT 21
181#define IRQ_PLA1_BIT 20
182#define IRQ_PLA0_BIT 19
183#define IRQ_EXT1_BIT 18
184#define IRQ_PSM_BIT 17
185#define IRQ_COMP_BIT 16
186#define IRQ_EXT0_BIT 15
187#define IRQ_UART_BIT 14
188#define IRQ_SPIM_BIT 13
189#define IRQ_SPIS_BIT 12
190#define IRQ_I2C1M_BIT 11
191#define IRQ_I2C0M_BIT 10
192#define IRQ_I2C0S_BIT 9
193#define IRQ_PLLL_BIT 8
194#define IRQ_ADCC_BIT 7
195#define IRQ_FLAC_BIT 6
196#define IRQ_TIM3_BIT 5
197#define IRQ_TIM2_BIT 4
198#define IRQ_TIM1_BIT 3
199#define IRQ_TIM0_BIT 2
200#define IRQ_SWI_BIT 1
201#define ALL_INT_OR 0
202
203#define IRQ_PWM_TRIP (1 << IRQ_PWMT_BIT)
204#define IRQ_EXT_IRQ3 (1 << IRQ_EXT3_BIT)
205#define IRQ_EXT_IRQ2 (1 << IRQ_EXT2_BIT)
206#define IRQ_PLA_IRQ1 (1 << IRQ_PLA1_BIT)
207#define IRQ_PLA_IRQ0 (1 << IRQ_PLA0_BIT)
208#define IRQ_EXT_IRQ1 (1 << IRQ_EXT1_BIT)
209#define IRQ_PSM (1 << IRQ_PSM_BIT)
210#define IRQ_COMP (1 << IRQ_COMP_BIT)
211#define IRQ_EXT_IRQ0 (1 << IRQ_EXT0_BIT)
212#define IRQ_UART (1 << IRQ_UART_BIT)
213#define IRQ_SPI_MST (1 << IRQ_SPIM_BIT)
214#define IRQ_SPI_SLV (1 << IRQ_SPIS_BIT)
215#define IRQ_I2C1_MST (1 << IRQ_I2C1M_BIT)
216#define IRQ_I2C0_MST (1 << IRQ_I2C0M_BIT)
217#define IRQ_I2C0_SLV (1 << IRQ_I2C0S_BIT)
218#define IRQ_PLL_LOCK (1 << IRQ_PLLL_BIT)
219#define IRQ_ADC_CH (1 << IRQ_ADCC_BIT)
220#define IRQ_FLA_CTRL (1 << IRQ_FLAC_BIT)
221#define IRQ_TIMER3 (1 << IRQ_TIM3_BIT)
222#define IRQ_TIMER2 (1 << IRQ_TIM2_BIT)
223#define IRQ_TIMER1 (1 << IRQ_TIM1_BIT)
224#define IRQ_TIMER0 (1 << IRQ_TIM0_BIT)
225#define IRQ_SWI (1 << IRQ_SWI_BIT)
226#define ALL_INT (1 << ALL_INT_OR)
227
228#define MASK_IRQ_TIMER3 0xFFFFFF
229#define MASK_IRQ_TIMER2 0xFFFFDF
230#define MASK_IRQ_TIMER1 0xFFFFCF
231#define MASK_IRQ_TIMER0 0xFFFFC7
232#define MASK_IRQ_UART 0xFFFFC3
233#define MASK_IRQ_SWI 0xFFBFC3
234
235#define MASK_IRQ_PWM_TRIP 0xFFBFC1
236#define MASK_IRQ_EXT_IRQ3 0x7FBFC1
237#define MASK_IRQ_EXT_IRQ2 0x3FBFC1
238#define MASK_IRQ_PLA_IRQ1 0x1FBFC1
239#define MASK_IRQ_PLA_IRQ0 0x0FBFC1
240#define MASK_IRQ_EXT_IRQ1 0x07BFC1
241#define MASK_IRQ_PSM 0x03BFC1
242#define MASK_IRQ_COMP 0x01BFC1
243#define MASK_IRQ_EXT_IRQ0 0x00BFC1
244#define MASK_IRQ_SPI_MST 0x003FC1
245#define MASK_IRQ_SPI_SLV 0x001FC1
246#define MASK_IRQ_I2C1_MST 0x000FC1
247#define MASK_IRQ_I2C0_MST 0x0007C1
248#define MASK_IRQ_I2C0_SLV 0x0003C1
249#define MASK_IRQ_PLL_LOCK 0x0001C1
250#define MASK_IRQ_ADC_CH 0x0000C1
251#define MASK_IRQ_FLA_CTRL 0x000041
252#define MASK_ALL_INT 0x000001
253
254#define INT_DISABLE_ALL 0xFFFFFF
255
256/*
257 * Timer0
258 */
259/* Timer0 Register address */
260#define T0LD (TIMER_BASE | 0x00) /* Timer0 Load Register */
261#define T0VAL (TIMER_BASE | 0x04) /* Timer0 Value Register */
262#define T0CON (TIMER_BASE | 0x08) /* Timer0 Control Register */
263#define T0CLRI (TIMER_BASE | 0x0C) /* Timer0 Clear Register */
264
265/* Timer0 Control Register bits */
266#define T0CON_ENA 0x80 /* Timer0 enable */
267#define T0CON_MOD 0x40 /* 1:periodic mode, 0:free-running mode */
268#define T0CON_PSC_UDF 0x0C /* Prescale: undefined, equal 0x00 */
269#define T0CON_PSC_256 0x08 /* Prescale: 1/256 */
270#define T0CON_PSC_16 0x04 /* Prescale: 1/16 */
271#define T0CON_PSC_1 0x00 /* Prescale: 1/1 */
272
273/* Timer0 count number */
274#define TIM0_COUNT_MAX 0xFFFF /* 16 bit */
275#define TIM0_COUNT 0x55FF /* 16 bit */
276
277
278
279/*
280 * Timer1
281 */
282/* Timer1 Register address */
283#define T1LD (TIMER_BASE | 0x20) /* Timer1 Load Register */
284#define T1VAL (TIMER_BASE | 0x24) /* Timer1 Value Register */
285#define T1CON (TIMER_BASE | 0x28) /* Timer1 Control Register */
286#define T1CLRI (TIMER_BASE | 0x2C) /* Timer1 Clear Register */
287#define T1CAP (TIMER_BASE | 0x30) /* Timer1 Capture Register */
288
289/* Timer1 Control Register bits */
290#define T1CON_CAP 0x20000 /* capture */
291
292#define T1CON_CLS_P0_6 0x0600 /* Clock source from Port0 pin6 */
293#define T1CON_CLS_P1_0 0x0400 /* Clock source from Port1 pin0 */
294#define T1CON_CLS_OSCI 0x0200 /* Clock source from oscillator */
295#define T1CON_CLS_CORE 0x0000 /* Clock source from core clock */
296
297#define T1CON_CUP 0x0100 /* 1:count up, 0:count down */
298#define T1CON_ENA 0x0080 /* Timer1 enable */
299#define T1CON_MOD 0x0040 /* 1:periodic mode, 0:free-running mode */
300
301#define T1CON_FMT_BIN 0x0000 /* Format: binary */
302#define T1CON_FMT_23H 0x0020 /* Format: hr:min:sec:hundredths -23h to 0h */
303#define T1CON_FMT_255H 0x0030 /* Format: hr:min:sec:hundredths -255h to 0h */
304
305#define T1CON_PSC_32768 0x000F /* Prescale: 1/32768 */
306#define T1CON_PSC_256 0x0008 /* Prescale: 1/256 */
307#define T1CON_PSC_16 0x0004 /* Prescale: 1/16 */
308#define T1CON_PSC_1 0x0000 /* Prescale: 1/1 */
309
310
311/* Timer1 count number */
312//#define TIM1_CNT_1S 41780000 /* 1s (41.78MHz) */
313//#define TIM1_CNT_1mS 41780 /* 1ms (41.78MHz) */
314//#define TIM1_CNT_OSC 32768 /* 1s (32.768kHz) */
315
316
317
318/*
319 * UART
320 */
321/* UART Registers */
322#define COMTX (UART_BASE | 0x00) /* Transmit */
323#define COMRX (UART_BASE | 0x00) /* Receive */
324#define COMDIV0 (UART_BASE | 0x00) /* Low-byte divisor latch */
325#define COMIEN0 (UART_BASE | 0x04) /* Interrupt Enable */
326#define COMDIV1 (UART_BASE | 0x04) /* High-byte divisor latch */
327#define COMIID0 (UART_BASE | 0x08) /* Interrupt identification */
328#define COMCON0 (UART_BASE | 0x0C) /* Line control */
329#define COMSTA0 (UART_BASE | 0x14) /* Line status */
330#define COMSCR (UART_BASE | 0x1C) /* Scratch register */
331
332
333/* COMIEN0 bits */
334#define COMIEN0_EDSSI 0x08 /* Modem status interrupt-enable */
335#define COMIEN0_ELSI 0x04 /* RX status interrupt-enable */
336#define COMIEN0_ETBEI 0x02 /* Enable Transmit buffer empty interrupt */
337#define COMIEN0_ERBFI 0x01 /* Enable Receive buffer full interrupt */
338
339/* COMIID0 bits */
340#define COMIID0_NOINT 0x01 /* No Interrutp */
341#define COMIID0_RXLINT 0x06 /* Recieve line status Interrupt */
342#define COMIID0_RXFINT 0x06 /* Recieve buffer full Interrupt */
343#define COMIID0_TXEINT 0x02 /* Transmit buffer empty Interrupt */
344#define COMIID0_MODINT 0x00 /* Modem status Interrupt */
345
346/* COMCON0 bits */
347#define COMCON0_DLAB 0x80 /* Set: Enable access COMDIV0 and COMDIV1 */
348 /* Clear: Enable access COMRX and COMTX */
349#define COMCON0_BRK 0x40 /* Force SOUT to 0 */
350#define COMCON0_SP 0x20 /* Stick Parity (?) */
351#define COMCON0_EPS 0x10 /* Even Parity Select bit */
352#define COMCON0_PEN 0x08 /* Parity Enable bit */
353#define COMCON0_STOP 0x04 /* Stop bit */
354
355#define COMCON0_WLS_8b 0x03 /* Word length is 8 bits */
356#define COMCON0_WLS_7b 0x02 /* Word length is 7 bits */
357#define COMCON0_WLS_6b 0x01 /* Word length is 6 bits */
358#define COMCON0_WLS_5b 0x00 /* Word length is 5 bits */
359
360/* COMSTA0 bits */
361#define COMSTA0_TEMT 0x40 /* COMTX empty */
362#define COMSTA0_THRE 0x20 /* COMTX and COMRX empty */
363#define COMSTA0_BI 0x10 /* Break error */
364#define COMSTA0_FE 0x08 /* Framing error */
365#define COMSTA0_PE 0x04 /* parity error */
366#define COMSTA0_OE 0x02 /* Overrun error */
367#define COMSTA0_DR 0x01 /* Data ready (COMRX is full) */
368
369/* COMDIVx bits : Baud Rate = 9600 */
370#define COMDIV0_BR9600 0x88 /* Low byte */
371#define COMDIV1_BR9600 0x00 /* High byte */
372
373/*
374 * SRAM
375 */
376#define VCT_TB_SRAM 0x10000
377#define VCT_TB 0x00000
378
379
380#ifndef _MACRO_ONLY
381
382/*
383 * 内
384蔵UART用 簡易SIOドライバ
385 */
386/*
387 * カーネル起動時用の初期化(sys_putcを使用するため)
388 */
389extern void init_uart(void);
390
391
392/*
393 * シリアルI/Oポート初期化ブロック
394 */
395typedef struct sio_port_initialization_block
396{
397 VP uart_data;
398 VP divisor_lo;
399 VP divisor_hi;
400 VP int_enable;
401 VP int_identifier;
402 VP line_control;
403 VP line_status;
404 VW irq_bit;
405}
406SIOPINIB;
407
408/*
409 * シリアルI/Oポート管理ブロックの定義
410 */
411typedef struct sio_port_control_block
412{
413 const SIOPINIB *siopinib; /* シリアルI/Oポート初期化ブロック */
414 VP_INT exinf; /* 拡張情
415å ± */
416 BOOL openflag; /* オープン済みフラグ */
417 BOOL sendflag; /* 送信割込みイネーブルフラグ */
418 BOOL getready; /* 文字を受信した状æ…
419‹ */
420 BOOL putready; /* 文字を送信できる状æ…
421‹ */
422
423}SIOPCB;
424
425
426/*
427 * コールバックルーチンの識別番号
428 */
429#define SIO_ERDY_SND 1u /* 送信可能コールバック */
430#define SIO_ERDY_RCV 2u /* 受信通知コールバック */
431
432/*
433 * オンチップのUARTからのポーリング出力
434 */
435extern void uart_putc(char c);
436
437/*
438 * SIOドライバの初期化ルーチン
439 */
440extern void uart_initialize(void);
441
442/*
443 * オープンしているポートがあるか?
444 */
445extern BOOL uart_openflag(void);
446
447/*
448 * シリアルI/Oポートのオープン
449 */
450extern SIOPCB *uart_opn_por(ID siopid, VP_INT exinf);
451
452/*
453 * シリアルI/Oポートのクローズ
454 */
455extern void uart_cls_por(SIOPCB *siopcb);
456
457/*
458 * シリアルI/Oポートへの文字送信
459 */
460extern BOOL uart_snd_chr(SIOPCB *siopcb, char c);
461
462/*
463 * シリアルI/Oポートからの文字受信
464 */
465extern INT uart_rcv_chr(SIOPCB *siopcb);
466
467/*
468 * シリアルI/Oポートからのコールバックの許可
469 */
470extern void uart_ena_cbr(SIOPCB *siopcb, UINT cbrtn);
471
472/*
473 * シリアルI/Oポートからのコールバックの禁止
474 */
475extern void uart_dis_cbr(SIOPCB *siopcb, UINT cbrtn);
476
477/*
478 * SIOの割込みサービスルーチン
479 */
480extern void uart_in_isr(void);
481extern void uart_out_isr(void);
482
483/*
484 * シリアルI/Oポートからの送信可能コールバック
485 */
486extern void uart_ierdy_snd(VP_INT exinf);
487
488/*
489 * シリアルI/Oポートからの受信通知コールバック
490 */
491extern void uart_ierdy_rcv(VP_INT exinf);
492
493
494
495#endif /* _MACRO_ONLY */
496#endif /* _FRK_ADUC_H_ */
Note: See TracBrowser for help on using the repository browser.