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 の仕様詳細は書かれていません。

ioctl API

HPET driver's API

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>
#include <errno.h>

HPET_IE_ON - Interrupt On

HPET_IE_OFF - Interrupt Off

HPET_INFO - Get Information

HPET_EPI - Enable hardware periodic interrupt

HPET_DPI - Disable hardware periodic interrupt

HPET_IRQFREQ - Set Interrupt Frequency in Hz

File System API related to HPET

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

open HPET timer

close HPET timer

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