Advantech ITA-1611 Series User Manual page 63

Fanless embedded celeron dual core compact industrial computer
Table of Contents

Advertisement

chk_smbus_ready();//Determine if SMBUS is ready
outportb(SMBUS_PORT + 3,
moredelay();//long time delay
moredelay();//long time delay
outportb(SMBUS_PORT + 5,
moredelay();//long time delay
moredelay();//long time delay
outportb(SMBUS_PORT + 2,
2, 0x48 means starting Byte data transmission
moredelay();//long time delay
moredelay();//long time delay
for (i = 0; i <= 0x100; i++)
{
newiodelay();//long time delay
}
chk_smbus_ready();//Determine if SMBUS is ready
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/
int chk_smbus_ready()
//Determine if SMBUS is ready or finished. Basically, it will wait for a long time to
see whether SMBUS has finished the transmission command because errors
hardly occur. So, in SMBUS byte read and write, BIOS Code does not determine
the return value of this function
{
int i, result = 1;
BYTE data;
for (i = 0; i <= 0x800; i++)
{
//SMB_BASE + 0 is SMBUS status value
data =
inportb(SMBUS_PORT);//Read SMBUS status value once
data =
check_data(SMBUS_PORT);//Read SMBUS status value several
times
outportb(SMBUS_PORT, data);//Write back SMBUS status value which
means clear status value(Write 1 to the corresponding bit will clear status)
if (data & 0x02)
{
//If bit 1 is set to 1 (this means the command is finished), then
SMBUS is ready
result =
0;//SMBUS ready
break;
}
if (!(data & 0xBF))
{
//If each bit except bit 2 is set to 0, this means SMBUS error , then
SMBUS is ready
result =
0;//SMBUS ready
break;
offset);//write register offset to SMB_BASE + 3
value);//Write data value to SMB_BASE + 5
0x48);//Write SMBUS command to SMB_BASE +
53
ITA-1611 User Manual

Advertisement

Table of Contents
loading

Table of Contents