Moxa W406-T-LX [62/74] Rtc real time clock

Moxa W406-CE [62/74] Rtc real time clock
W315A/325A Linux User's Manual Programmer's Guide
6-3
RTC (Real Time Clock)
The RTC device node is located at /dev/rtc. The W315A/325A supports Linux standard simple RTC control.
You must
include <linux/rtc.h
>
.
1. Function: RTC_RD_TIME
int ioctl(fd, RTC_RD_TIME, struct rtc_time *time);
Description: read time information from RTC. It will return the value on argument 3.
2. Function: RTC_SET_TIME
int ioctl(fd, RTC_SET_TIME, struct rtc_time *time);
Description: set RTC time. Argument 3 will be passed to RTC.
Buzzer
The buzzer device node is located at /dev/console. The W315A/325A supports Linux standard buzzer control,
with the W315A/325As buzzer running at a fixed frequency of 100 Hz. You must
include <sys/kd.h
>
.
Function: KDMKTONE
ioctl(fd, KDMKTONE, unsigned int arg);
Description: The buzzers behavior is determined by the argument arg. The high wordpart of arg gives the
length of time the buzzer will sound, and the low wordpart gives the frequency.
The buzzers on/off behavior is controlled by software. If you call the ioctlfunction, you MUST set the
frequency at 100 Hz. If you use a different frequency, the system could crash.
WDT (Watch Dog Timer)
Introduction
The WDT works like a watchdog function. You can enable it or disable it. When the user enables WDT but the
application does not acknowledge it, the system will reboot. You can set the acknowledgement time from a
minimum of 50 msec up to a maximum of 60 seconds.
How to Enable the WDT
You will need to write your own application to enable the WDT function for the computer. Refer to the
following APIs to write the application.
The user API
The user application must include <moxadevic.h
>
, and link moxalib.a. A makefile example is shown
below:
all:
arm-linux-gcc –o xxxx xxxx.c -lmoxalib
int swtd_open(void)
Description: Opens the file handle to control the WDT. If you want to control the WDT, you must first call
this function and then use the file handle for other tasks.
Arguments: None
Return Value: The file handle; a negative number indicates that an error occurred.

Содержание

Скачать