(toppers-users 3087) [H8]バス初期化について

中村 和博 norichan1108 @ gmail.com
2010年 2月 18日 (木) 08:24:01 JST


おはようございます。中村です。

H8での実装についてです。
H8ポートでは、sys_support.SにてDRAMやRTL8019に関するバスの初期化を
行っているのですが、この初期化処理にバスのウェイト設定やアクセスステートの
設定処理がありません。

H8は初期状態ですべての外部バスを3ステートアクセスに設定します。
また、すべての外部バスに対し3ステートのアクセスウェイトを設定します。
その為、外部RAMでの16bitアクセス(命令フェッチも含む)に6ステートx2回
(12ステート)の時間が必要になりDRAMアクセスがとても遅くなってしまいます。
これらはWCRH/WCRL及びASTCRで設定するのですが、これらに関する記述も
ないようです。設定変更後は、DRAMでアクセス時間が1/3になります。
RTL8019で17%程度速くなります。

一応、ローカルで設定して問題なく動いているようなので修正点を上げておきます。
次回取り込んで戴けると幸です。

変更内容としては、
CS1 RTL8019AS   3/3  ->  3/2
CS2 DRAM         3/3  ->  2/0
CS3 増設DRAM      3/3  ->  2/0
x/x = アクセスステート数/ウェイトステート数

config/h8/h8_3069.h
--------------------------------------------------------------------
/* BUS Wait Control Registers */
#define H8WCRH			0xfee022 	/* Control Register H */
#define H8WCRL			0xfee023 	/* Control Register L */

#define H8WCRH_W71_BIT		6
#define H8WCRH_W70_BIT		6
#define H8WCRH_W61_BIT		5
#define H8WCRH_W60_BIT		4
#define H8WCRH_W51_BIT		3
#define H8WCRH_W50_BIT		2
#define H8WCRH_W41_BIT		1
#define H8WCRH_W40_BIT		0

#define H8WCRL_W31_BIT		7
#define H8WCRL_W30_BIT		6
#define H8WCRL_W21_BIT		5
#define H8WCRL_W20_BIT		4
#define H8WCRL_W11_BIT		3
#define H8WCRL_W10_BIT		2
#define H8WCRL_W01_BIT		1
#define H8WCRL_W00_BIT		0

#define H8WCRH_W7_NOWAIT	(0<<H8WCRH_W70_BIT)
#define H8WCRH_W7_1WAIT		(1<<H8WCRH_W70_BIT)
#define H8WCRH_W7_2WAIT		(2<<H8WCRH_W70_BIT)
#define H8WCRH_W7_3WAIT		(3<<H8WCRH_W70_BIT)
#define H8WCRH_W6_NOWAIT	(0<<H8WCRH_W60_BIT)
#define H8WCRH_W6_1WAIT		(1<<H8WCRH_W60_BIT)
#define H8WCRH_W6_2WAIT		(2<<H8WCRH_W60_BIT)
#define H8WCRH_W6_3WAIT		(3<<H8WCRH_W60_BIT)
#define H8WCRH_W5_NOWAIT	(0<<H8WCRH_W50_BIT)
#define H8WCRH_W5_1WAIT		(1<<H8WCRH_W50_BIT)
#define H8WCRH_W5_2WAIT		(2<<H8WCRH_W50_BIT)
#define H8WCRH_W5_3WAIT		(3<<H8WCRH_W50_BIT)
#define H8WCRH_W4_NOWAIT	(0<<H8WCRH_W40_BIT)
#define H8WCRH_W4_1WAIT		(1<<H8WCRH_W40_BIT)
#define H8WCRH_W4_2WAIT		(2<<H8WCRH_W40_BIT)
#define H8WCRH_W4_3WAIT		(3<<H8WCRH_W40_BIT)
#define H8WCRL_W3_NOWAIT	(0<<H8WCRL_W30_BIT)
#define H8WCRL_W3_1WAIT		(1<<H8WCRL_W30_BIT)
#define H8WCRL_W3_2WAIT		(2<<H8WCRL_W30_BIT)
#define H8WCRL_W3_3WAIT		(3<<H8WCRL_W30_BIT)
#define H8WCRL_W2_NOWAIT	(0<<H8WCRL_W20_BIT)
#define H8WCRL_W2_1WAIT		(1<<H8WCRL_W20_BIT)
#define H8WCRL_W2_2WAIT		(2<<H8WCRL_W20_BIT)
#define H8WCRL_W2_3WAIT		(3<<H8WCRL_W20_BIT)
#define H8WCRL_W1_NOWAIT	(0<<H8WCRL_W10_BIT)
#define H8WCRL_W1_1WAIT		(1<<H8WCRL_W10_BIT)
#define H8WCRL_W1_2WAIT		(2<<H8WCRL_W10_BIT)
#define H8WCRL_W1_3WAIT		(3<<H8WCRL_W10_BIT)
#define H8WCRL_W0_NOWAIT	(0<<H8WCRL_W00_BIT)
#define H8WCRL_W0_1WAIT		(1<<H8WCRL_W00_BIT)
#define H8WCRL_W0_2WAIT		(2<<H8WCRL_W00_BIT)
#define H8WCRL_W0_3WAIT		(3<<H8WCRL_W00_BIT)

/* BUS Access State Control Register */

#define H8ASTCR			0xfee021

#define H8ASTCR_AST7_BIT	7
#define H8ASTCR_AST6_BIT	6
#define H8ASTCR_AST5_BIT	5
#define H8ASTCR_AST4_BIT	4
#define H8ASTCR_AST3_BIT	3
#define H8ASTCR_AST2_BIT	2
#define H8ASTCR_AST1_BIT	1
#define H8ASTCR_AST0_BIT	0

#define H8ASTCR_AST7    	(1<<H8ASTCR_AST7_BIT)
#define H8ASTCR_AST6    	(1<<H8ASTCR_AST6_BIT)
#define H8ASTCR_AST5    	(1<<H8ASTCR_AST5_BIT)
#define H8ASTCR_AST4    	(1<<H8ASTCR_AST4_BIT)
#define H8ASTCR_AST3    	(1<<H8ASTCR_AST3_BIT)
#define H8ASTCR_AST2    	(1<<H8ASTCR_AST2_BIT)
#define H8ASTCR_AST1    	(1<<H8ASTCR_AST1_BIT)
#define H8ASTCR_AST0    	(1<<H8ASTCR_AST0_BIT)
--------------------------------------------------------------------

config/h8/aki_3069f/sys_support.S
--------------------------------------------------------------------
	/*
	 *  BUSウェイトコントロールレジスタ
	 *
	 *  CS1(RTL8019AS):	2WAIT
	 *  CS2(DRAM):		NOWAIT
	 *  CS3(増設DRAM):	NOWAIT
	 *  OTHER		3WAIT
	 */
	mov.b	#0xff, r0h
	mov.b	r0h, @H8WCRH

	mov.b	#(H8WCRL_W3_NOWAIT | H8WCRL_W2_NOWAIT | H8WCRL_W1_2WAIT | H8WCRL_W0_3WAIT), r0h
	mov.b	r0h, @H8WCRL

	/*
	 * BUSアクセスステートコントロールレジスタの設定
	 */
	mov.b	#0xff, r0h
	and.b	#~(H8ASTCR_AST3 | H8ASTCR_AST2):8, r0h
	mov.b	r0h, @H8ASTCR	
--------------------------------------------------------------------

以上、よろしくお願いします。