
A-6
GPIO WDT BKL Programming
MS-9A79
SMBus Access
4. SMBus
Access
The
base
address
of
SMBus
must
be
known
before
access.
The
relevant
bus
and
device
information
are
as
following.
#define
IO_SC
0xCF8
#define
IO_DA
0xCFC
#define
PCIBASEADDRESS
0x80000000
#define
PCI_BUS_NUM
0
#define
PCI_DEV_NUM
31
#define
PCI_FUN_NUM
1
4.1
Get
SMBus
Base
Address
int
SMBUS_BASE;
int
DATA_ADDR
=
PCIBASEADDRESS
+
(PCI_BUS_NUM<<16)
+
(PCI_DEV_NUM<<11)
+
(PCI_FUN_NUM<<8);
Outportl
(DATA_ADDR
+
0x20,
IO_SC);
SMBUS_BASE
=
Inportl
(IO_DA)
&
0xfffffff0;
4.2
SMBus_ReadByte
(char
DEVID,
char
offset)
Read
the
value
of
OFFSET
from
SMBus
device
DEVID.
Outportb
(LOWORD
(SMBUS_BASE),
0xFE);
Outportb
(LOWORD
(SMBUS_BASE)
+
0x04,
DEVID
+
1);
//out
Base
+
04,
(DEVID
+
1)
Outportb
(LOWORD
(SMBUS_BASE)
+
0x03,
OFFSET);
//out
Base
+
03,
OFFSET
Outportb
(LOWORD
(SMBUS_BASE)
+
0x02,
0x48);
//out
Base
+
02,
48H
mdelay
(20);
//delay
20ms
to
let
data
ready
while
((Inportl
(SMBUS_BASE)
&
0x01)
!=
0);
//wait
SMBus
ready
SMB
_DATA
=
Inportb
(LOWORD
(SMBUS_BASE)
+
0x05);
//input
Base
+
05
4.3
SMBus_WriteByte
(char
DEVID,
char
offset,
char
DATA)
Write
DATA
to
OFFSET
on
SMBus
device
DEVID.
Outportb
(LOWORD
(SMBUS_BASE),
0xFE);
Outportb
(LOWORD
(SMBUS_BASE)
+
0x04,
DEVID);
//out
Base
+
04,
(DEVID)
Outportb
(LOWORD
(SMBUS_BASE)
+
0x03,
OFFSET);
//out
Base
+
03,
OFFSET
Outportb
(LOWORD
(SMBUS_BASE)
+
0x05,
DATA);
//out
Base
+
05,
DATA
Outportb
(LOWORD
(SMBUS_BASE)
+
0x02,
0x48);
//out
Base
+
02,
48H
mdelay
(20);
//wait
20ms
Содержание 939-9A79-002
Страница 1: ...i MS 9A79 Industrial Data Machine...
Страница 8: ......
Страница 11: ...1 3 MS 9A79 System Overview h h System I O Controls 1 7 8 1 2 3 4 5 14 9 10 11 12 13 16 6 1 1 15...
Страница 22: ...1 14 Overview System Dimensions...
Страница 23: ...1 15 MS 9A79 Mounting Brackets...
Страница 24: ...1 16 Overview...
Страница 31: ...2 7 MS 9A79 6 Connect the antenna cables...
Страница 37: ...2 13 MS 9A79 8 Fasten the screws to secure the system cover...
Страница 46: ......
Страница 66: ......