![ADLINK Technology CM1-86DX2 Скачать руководство пользователя страница 66](http://html.mh-extra.com/html/adlink-technology/cm1-86dx2/cm1-86dx2_technical-manual_2852737066.webp)
60
Using the Module
Watchdog1 Example
#include
<
sys
/
io
.
h
>
#include
<
stdio
.
h
>
int
main
()
{
unsigned int
wdog_time
= (
0x20L
*
0x500L
);
unsigned char
trig
=
0
,
wdog_en
=
0
,
reset_cntr
=
0
;
if
(
iopl
(
3
) !=
0
)
{
printf
(
"IOPL error
\
n"
);
return
1
;
}
//set time counter register: 0xac, 0xab, 0xaa
outb
((
wdog_time
>>
16
) &
0xFF
,
0xac
);
//D23...D16
outb
((
wdog_time
>>
8
) &
0xFF
,
0xab
);
//D15...D8
outb
(
wdog_time
&
0xFF
,
0xaa
);
//D7...D0
//set trigger: 0xa9
trig
=
inb
(
0xa9
);
trig
&=
0x0F
;
trig
|=
0xD0
;
//0xD0 = system reset
outb
(
trig
,
0xa9
);
//enable wdog: 0xa8
wdog_en
=
inb
(
0xa8
);
wdog_en
|=
0x40
;
//bit6 = 1 --> enable WDT1
outb
(
wdog_en
,
0xa8
);
printf
(
"Watchdog active
,
resetting counter
,
Press CTRL
+
C to stop resetting
\
n"
);
//reset timer counter : 0xa8
while
(
1
)
{
reset_cntr
=
inb
(
0xa8
);
reset_cntr
|=
0x40
;
//bit6 = 1 --> reset counter
outb
(
reset_cntr
,
0xa8
);
}
return
0
;
}
Please note that this source code example is provided for a system running Linux. For
other operating systems, it may be necessary to adapt the source code regarding include
files or headers and the syntax of I/O out commands because Linux is using outb(value,
address) instead of outb(address, value).
Содержание CM1-86DX2
Страница 6: ...vi ...
Страница 20: ...14 Getting Started ...
Страница 26: ...20 Module Description LVDS Color Mapping ...
Страница 52: ...46 Using the Module ...
Страница 53: ...Using the Module 47 CM1 86DX2 PCIPnP ...
Страница 54: ...48 Using the Module ...
Страница 56: ...50 Using the Module Chipset screen ...
Страница 57: ...Using the Module 51 CM1 86DX2 ...
Страница 58: ...52 Using the Module ...
Страница 59: ...Using the Module 53 CM1 86DX2 Security screen ...