beautypg.com

Intel 386 User Manual

Page 476

background image

15-15

REFRESH CONTROL UNIT

Parameters:

Counter_Value Value of the refresh interval

Returns:

Error Codes:

E_BADVECTOR

User input an invalid parameter

E_OK

Executed correctly

Assumptions:

None

Syntax:

#define REFRESH_INTERVAL 0x186

//Counter value for DRAM with

// 1024 rows and a refresh period

// of 16 msec (25 MHz Processor Clock)

int error_code;

error_code = InitRCU(REFRESH_INTERVAL);

Real/Protected Mode:

No changes required

*****************************************************************************/

extern int InitRCU(WORD Counter_Value)

{

/* Check that Counter_Value is 10 bits in length */

if (Counter_Value != (Counter_Value & 0x03ff) )

return(E_BADVECTOR);

/* Clear lower 10 bits of RFSCIR */

_SetEXRegWord(RFSCIR, 0xfc00);

/* Set lower 10 bits of RFSCIR to Counter_Value */

_SetEXRegWord(RFSCIR, _GetEXRegWord(RFSCIR) | Counter_Value);

/* Enable Refresh Unit */

_SetEXRegWord(RFSCON, _GetEXRegWord(RFSCON) | 0x8000);

return(E_OK);

}/* InitRCU */

/*****************************************************************************

Get_RCUCounterValue:

Description:

This function returns the current value of the refresh interval timer.