HPET API†

Here shows HPET driver API. Using man page like format with some modifications. Following lines shows modifications,

Features†

HPET driver provides following features.

To know more details refer to HPET specification.

Device path†

Most linux distributions enable HPET driver and prepare access node /dev/hpet. /dev/hpet is the character device node associated to major=10, minor=228 one of "misc device".

Open device†

To use HPET device, open /dev/hpet with file mode O_RDONLY. If there is a unused(free) HPET timer, assign a timer to opened file descriptor. A timer is one of timer circuit block in HPET block. HPET driver's ioctl() calls manipulate the timer assigned to file descriptor.

Header files†

To use HPET device from user space (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 use mmap(), include optional header file as follows.

#include <sys/mman.h>

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

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

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.

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 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 - Get signal number will be sent†

F_SETSIG - Set signal number will be sent†


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