IBASE IB905 User Manual
Page 61
APPENDIX
IB905 User’s Manual
57
//===========================================================================
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
//===========================================================================
#include "W627DHG.H"
#include
//===========================================================================
unsigned int W627DHG_BASE;
void Unlock_W627DHG (void);
void Lock_W627DHG (void);
//===========================================================================
unsigned int Init_W627DHG(void)
{
unsigned int result;
unsigned char ucDid;
W627DHG_BASE = 0x2E;
result = W627DHG_BASE;
ucDid = Get_W627DHG_Reg(0x20);
if (ucDid == 0x88)
{
goto
Init_Finish;
}
W627DHG_BASE = 0x4E;
result = W627DHG_BASE;
ucDid = Get_W627DHG_Reg(0x20);
if (ucDid == 0x88)
{
goto
Init_Finish;
}
W627DHG_BASE = 0x00;
result = W627DHG_BASE;
Init_Finish:
return
(result);
}
//===========================================================================
void Unlock_W627DHG (void)
{
outportb(W627DHG_INDEX_PORT,
W627DHG_UNLOCK);
outportb(W627DHG_INDEX_PORT,
W627DHG_UNLOCK);
}
//===========================================================================
void Lock_W627DHG (void)
{
outportb(W627DHG_INDEX_PORT,
W627DHG_LOCK);
}
//===========================================================================
void Set_W627DHG_LD( unsigned char LD)
{
Unlock_W627DHG();
outportb(W627DHG_INDEX_PORT,
W627DHG_REG_LD);
outportb(W627DHG_DATA_PORT,
LD);
Lock_W627DHG();
}