ThinkCore W311/321/341 Linux User’s Manual Programmer’s Guide

6-3

Buzzer
The device node is located at /dev/console. The W311/321/341 support Linux standard buzzer
control, with the W311/321/341’s 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 buzzer’s behavior is determined by the argument arg. The “high word” part
of arg gives the length of time the buzzer will sound, and the “low word” part gives the
frequency.
The buzzer’s on / off behavior is controlled by software. If you call the “ioctl” function, you
MUST set the frequency at 100 Hz. If you use a different frequency, the system could crash.
WDT (Watch Dog Timer)
1. Introduction
The WDT works like a watch dog 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 ack time from a minimum of 50 ms ec to a maximum of 60 seconds.
2. How the WDT works
The sWatchDog is disabled when the system boots up. The user application can also enable
ack. When the user does not ack, it will let the system reboot.
Kernel boot
…..
….
User application running and enable user ack
….
….
3. 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
Open the file handle to control the sWatchDog. If you want to do something you must first to
this. And keep the file handle to do other.
Input
None
Output
The return value is file handle. If has some error, it will return < 0 value.
You can get error from errno().