[INTEL NAVIGATION HEADER]

Sample Code to Initialize the DRAM Refresh Unit

$mod186
name example_80C186_RCU_code

;
; FUNCTION: This function initializes the DRAM Refresh
; Control Unit to refresh the DRAM starting at dram_addr
; at clock_time intervals.
;
; SYNTAX:
; extern void far config_rcu(int dram_addr, int clock_time);
;
; INPUTS: dram_addr - Base address of DRAM to refresh
; clock_time - DRAM refresh rate
;
; OUTPUTS: None
;
; NOTE: Parameters are passed on the stack as
; required by high-level languages.

;

RFBASE equ xxxxh ;substitute register offset
RFTIME equ xxxxh
RFCON equ xxxxh

Enable equ 8000h ;enable bit

lib_80186 segment public 'code'
assume cs:lib_80186

public _config_rcu
_config_rcu proc far

push bp ;save caller's bp
mov bp, sp ;get current top of stack

_clock_time equ word ptr[bp+6] ;get parameters off
_dram_addr equ word ptr[bp+8] ;the stack

push ax ;save registers that
;will be modified

push cx
push dx
push di
mov dx, RFBASER ;set upper 7 address bits
mov ax, _dram_addr
out dx, ax

mov dx, RFTIME ;set clock pre_scaler
mov ax, _clock_time
out dx, ax

mov dx, RFCON ;Enable RCU
mov ax, Enable
out dx, ax

mov cx, 8 ;8 dummy cycles are
;required by DRAMS
xor di, di ;before actual use

_exercise_ram:
mov word ptr [di], 0
loop _exercise_ram

pop di ;restore saved registers

pop dx
pop cx
pop ax

pop bp ;restore caller's bp

ret
_config_rcu endp

lib_80186 ends
end



Legal Stuff © 1997 Intel Corporation

Free Web Hosting