IBT Technologies IB791 User Manual page 65

Via cle266 5.25” embedded board
Table of Contents

Advertisement

// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
//===========================================================================
#include "W697HF.H"
#include <dos.h>
//===========================================================================
unsigned int W697HF_BASE;
void Unlock_W697HF (void);
void Lock_W697HF (void);
//===========================================================================
unsigned int Init_W697HF(void)
{
unsigned int result;
W697HF_BASE = 0x2E;
result = W697HF_BASE;
if (Get_W697HF_Reg(0x20) == 0x60)
{
goto Init_Finish;
W697HF_BASE = 0x4E;
result = W697HF_BASE;
if (Get_W697HF_Reg(0x20) == 0x60)
{
goto Init_Finish;
W697HF_BASE = 0x00;
result = W697HF_BASE;
Init_Finish:
return (result);
}
//===========================================================================
void Unlock_W697HF (void)
{
outportb(W697HF_INDEX_PORT, W697HF_UNLOCK);
outportb(W697HF_INDEX_PORT, W697HF_UNLOCK);
}
//===========================================================================
void Lock_W697HF (void)
{
outportb(W697HF_INDEX_PORT, W697HF_LOCK);
}
//===========================================================================
void Set_W697HF_LD( unsigned char LD)
{
Unlock_W697HF();
outportb(W697HF_INDEX_PORT, W697HF_REG_LD);
outportb(W697HF_DATA_PORT, LD);
Lock_W697HF();
}
//===========================================================================
void Set_W697HF_Reg( unsigned char REG, unsigned char DATA)
{
Unlock_W697HF();
outportb(W697HF_INDEX_PORT, REG);
outportb(W697HF_DATA_PORT, DATA);
Lock_W697HF();
}
//===========================================================================
unsigned char Get_W697HF_Reg(unsigned char REG)
{
unsigned char Result;
Unlock_W697HF();
outportb(W697HF_INDEX_PORT, REG);
Result = inportb(W697HF_DATA_PORT);
Lock_W697HF();
return Result;
}
//===========================================================================
Filename:W697hf.h
//===========================================================================
}
}
IB791 User' s Manual
APPENDIX
61

Advertisement

Table of Contents
loading

Table of Contents