HPET API

HPET API English page

このページは HPET driver が提供する API をまとめたページです。map ページに似た書式を使います。man page の書式に次の修正・追加をしています。

機能一覧

HPET ドライバには次の機能が備わっています。

より詳細な情報は HPET 仕様書 を見て下さい。

Device path

多くの Linux ディストリビューション では HPET ドライバを有効化して構築されています。/dev/hpet ノードが用意されています。/dev/hpet ノードはキャラクタ・デバイス・ノードで major=10, minor=228 という番号が付いています。"misc device" の一つです。

device を開く

HPET を使うには /dev/hpet を O_RDONLY モードで開きます。未使用の HPET timer が有れば、一つの timer を開いたファイル・ディスクリプタに割り当てます。timer は HPET 回路ブロックに複数ある timer のうちの一つです。ioctl() システム・コールでファイル・ディスクリプタに割り当てられた timer を操作します。

Header files

user space (Linux アプリケーション) から HPET device を使うには次のヘッダファイルを取り込んで下さい。

#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>

poll() を使うには次のヘッダファイルを取り込んで下さい。

#include <poll.h>

select() を使うには次のヘッダファイルを取り込んで下さい。

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

signal() を使うには次のヘッダファイルを取り込んで下さい。

#include <signal.h>

mmap() を使うには次のヘッダファイルを取り込んで下さい。

#include <sys/mman.h>

システム・コール エラーを使うには次のヘッダファイルを取り込んで下さい。

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

HPET ドライバの ioctl API

ここでは HPET ドライバの ioctl() API を示します。HPET ドライバは次に示す ioctl() API を提供しています。

ioctl 要求番号説明
HPET_INFOtimer の情報を取得します
int ioctl(int fd, HPET_INFO, /* out */ struct hpet_info *info);
HPET_IRQFREQ割り込み周期を周波数(Hz)で設定します
int ioctl(int fd, HPET_IRQFREQ, unsigned long frequency);
HPET_EPIハードウエアによる周期割り込み機能を使うようにします
int ioctl(int fd, HPET_EPI);
HPET_DPIハードウエアによる周期割り込み機能を使わないようにします
(ソフトウエアによって周期割り込みを起こします)
int ioctl(int fd, HPET_DPI);
HPET_IE_ONtimer からの割り込みを許可します
int ioctl(int fd, HPET_IE_ON);
HPET_IE_OFFtimer からの割り込みを禁止します
int ioctl(int fd, HPET_IE_OFF);

このページでは HPET ドライバ固有の仕様を示します。ioctl() システム・コールの基本的な仕様については man 2 ioctl を参照して下さい。

HPET_INFO - timer の情報を取得します

HPET_IRQFREQ - 割り込み周期を周波数(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 and Memory Mapping API related to HPET

In this section shows File System and Memory Mapping API related to HPET driver. When using open(), close(), read(), mmap(), munmap(), fcntl(), and these alternate functions to access HPET, these API have HPET specific behaviour. 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

mmap HPET register on memory address space

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 - 送ろうとするシグナル番号を取得する

F_SETSIG - 送ろうとするシグナル番号を設定する


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