hpet_example†

HPET (High Precision Event Timer) ドライバ /drivers/char/hpet.c の動作を理解するために、実際に動かすアプリケーション・プログラム filehpet_example.tar.gz を使います。このプログラムは /Documentation/timers/hpet_example.c を修正して作成してあります。/Documentation/timers/hpet.txt で hpet_example.c について概要が書かれています。情報量は多く有りません。ioctl() API の仕様詳細は書かれていません。

HPET API†

HPET driver provides following features.

HPET driver's ioctl API†

In this section shows HPET driver ioctl() API. HPET driver provides following ioctl() API.

ioctl request numberdescription
HPET_INFOGet Information
int ioctl(int fd, HPET_INFO, /* out */ struct hpet_info *info);
HPET_IRQFREQSet Interrupt Frequency in Hz
int ioctl(int fd, HPET_IRQFREQ, unsigned long frequency);
HPET_EPIEnable hardware periodic interrupt
int ioctl(int fd, HPET_EPI);
HPET_DPIDisable hardware periodic interrupt
int ioctl(int fd, HPET_DPI);
HPET_IE_ONInterrupt On
int ioctl(int fd, HPET_IE_ON);
HPET_IE_OFFInterrupt Off
int ioctl(int fd, HPET_IE_OFF);

Here shows HPET driver specific behaviors. To see basic file system ioctl() behaviors refer to man 2 ioctl.

To use HPET device from user context (Linux Application), include header files as follows.

#define _GNU_SOURCE
#include <features.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/hpet.h>

If you wish to use poll(), include optional header file as follows.

#include <poll.h>

If you wish to use select(), include optional header files as follows.

#include <sys/time.h>
#include <sys/select.h>

If you wish to use signal(), include optional header file as follows.

#include <signal.h>

If you wish to handle error, include optional header files as follows.

#include <string.h> /* strerror() */
#include <errno.h>  /* errno, Exxx macros. */

HPET_INFO - Get Information†

HPET_IRQFREQ - Set Interrupt Frequency in Hz†

HPET_EPI - Enable hardware periodic interrupt†

HPET_DPI - Disable hardware periodic interrupt†

HPET_IE_ON - Interrupt On†

HPET_IE_OFF - Interrupt Off†

File System API related to HPET†

In this section shows File System API related to HPET driver. And these API have HPET specific behavior. Here shows HPET specific behavior. To see file system specific basic behavior and details, refer to system call man pages. man 2 fcntl shows about sending signal from file descriptor in detail.

open HPET timer†

close HPET timer†

read and clear interrupted count†

F_GETOWN - Get file descriptor owner†

F_GETOWN_EX - Get file descriptor owner with extended feature†

F_SETOWN - Set file descriptor owner†

F_SETOWN_EX - Set file descriptor owner with extended feature†

F_GETFL - Get file status flags†

F_SETFL - Set file status flags†

F_GETSIG - Get signal number will be sent†

F_SETSIG - Set signal number will be sent†


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS