번역하십시오

Translate to EnglishÜbersetzen Sie zum Deutsch/GermanΜεταφράστε στα ελληνικά/GreekПереведите к русскому/RussianOversetter til Norsk/NorwegianÖversätta till Svensk/Swedishहिन्दी अनुवाद करने के लिए/Hindi
Tradueix al català/CatalanTulkot uz latviešu/LatvianPreložiť do slovenčiny/SlovakVertaal aan het Nederlands/Dutchترجمة الى العربية/ArabicTraduzca al Español/SpanishTraduisez au Français/French
Traduca ad Italiano/ItalianTraduza ao Português/Portuguese日本語に翻訳しなさい /Japanese한국어에게 번역하십시오/Korean中文翻译/Chinese Simplified中文翻译/Chinese TraditionalПереклад на українську/Ukrainian
유닉스 환경에서 진보된 프로그램, 2판 (에디슨-웨슬리 전문가 계산 시리즈)의 심상
리눅스 알갱이 발달 (제 3 판)의 심상
운영 체계 개념의 심상
인조 인간 무선 애플리케이션 개발의 심상

리눅스 HPET 지원

IA-PC HPET (높은 정밀도 사건 타이머)는 이 십년간의 앞 부분에 있는 인텔 그리고 마이크로소프트에 의해 공동으로 개발된 명세이다. 최신 버전은 2004년 10월 날짜가 기입된다. 그것은 목적이에 다는 것을 진술했다

IA PC를 위해 `de facto' timer 기계설비로 지금 사용되는 유산 8254 풀그릴 간격 타이머를 및 실시간 시계 정기적인 개입중단 세대 기능을 처음에 보충하고 결국 대체하십시오.

HPET 건축술은 운영 체계에 의해 이용될 수 있는 타이머의 세트를 정의한다. 타이머 구획은 단 하나 카운터의 조합 32까지 비교 측정기 및 성냥 기록기이다. 비교 측정기는 자유로운 운영하는 단조음 위로 카운터의 가치에 대하여 성냥 기록기의 내용을 비교한다. 위로 카운터의 산출이 성냥 기록기에 있는 가치를 같게 할 때 개입중단은 생성된다. 비교 측정기의 각각은 개입중단을 출력할 수 있다. 최대 8개의 타이머 구획은 256의 타이머 토탈을 위해 지원된다. 각 타이머 구획에는 다른 시간을 재는 속성이 있을 수 있다. 특정한 실시는 이 타이머의 단지 부분 집합을 포함할지도 모른다. 최저 3개의 타이머는 요구된다.

명세는 HPET 건축술의 뒤에 오는 구역 도표를 포함한다.

기계설비 구역 도표

몇몇은의 타이머 정기적인 개입중단을 생성하는 가능하게 될지도 모른다. 타이머가 정기적이기 위하여 놓이는 경우에, 이 타이머를 위한 그것의 기간은 성냥이 생길 때마다 개입중단을 생성하기 위하여 다음에 계산하는에 성냥 기록기, 따라서 추가된다. 위로 카운터는 보통 넓게 64 조금이다 그러나 32 비트 실시는 명세에 의해 허용되고 64 비트 위로 카운터는 또한 32 비트 형태에서 몰 수 있다. 위로 카운터는 최소 10 MHz에 달린다. 매우 더 빠른 지 어느 것이 더 오래된 RTC (실시간 시계)는 매우 더 높은 해결책에 이렇게 정기적인 개입중단을 일으키고다. 이 타이머와 관련되었던 기록기는 기억 장소 공간에 지도로 나타난다.

HPET에 의하여 기억 지도로 나타나는 기록기 공간의 위치를 운영 체계를 알리는 BIOS 용도 ACPI (진보된 윤곽과 힘 공용영역) 기능. 인텔 DX48BT2 (AKA BoneTrail) 어미판에서 분해한 ACPI HPET 테이블의 보기는 여기 있다.

$ cat /sys/firmware/acpi/tables/HPET > /var/tmp/hpet.out
$ iasl -d /var/tmp/hpet.out
$ cat /var/tmp/hpet.dsl
/*
 * Intel ACPI Component Architecture
 * AML Disassembler version 20090123
 *
 * Disassembly of /var/tmp/hpet.out, Sun Jul  5 19:34:47 2009
 *
 * ACPI Data Table [HPET]
 *
 * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue
 */

[000h 000  4]                    Signature : "HPET"    /* High Precision Event Timer table */
[004h 004  4]                 Table Length : 00000038
[008h 008  1]                     Revision : 01
[009h 009  1]                     Checksum : CE
[00Ah 010  6]                       Oem ID : "INTEL "
[010h 016  8]                 Oem Table ID : "DX48BT2 "
[018h 024  4]                 Oem Revision : 0000076E
[01Ch 028  4]              Asl Compiler ID : "MSFT"
[020h 032  4]        Asl Compiler Revision : 01000013

[024h 036  4]            Hardware Block ID : 8086A301

[028h 040 12]         Timer Block Register : 
[028h 040  1]                     Space ID : 00 (SystemMemory)
[029h 041  1]                    Bit Width : 00
[02Ah 042  1]                   Bit Offset : 00
[02Bh 043  1]                 Access Width : 00
[02Ch 044  8]                      Address : 00000000FED00000

[034h 052  1]              Sequence Number : 00
[035h 053  2]          Minimum Clock Ticks : 0001
[037h 055  1]        Flags (decoded below) : 00
                              Page Protect : 0
                           4K Page Protect : 0
                          64K Page Protect : 0
Raw Table Data

  0000: 48 50 45 54 38 00 00 00 01 CE 49 4E 54 45 4C 20  HPET8.....INTEL
  0010: 44 58 34 38 42 54 32 20 6E 07 00 00 4D 53 46 54  DX48BT2 n...MSFT
  0020: 13 00 00 01 01 A3 86 80 00 00 00 00 00 00 D0 FE  ................
  0030: 00 00 00 00 00 01 00 00                          ........
$


(AML disassember에 의해 Hardware이라고 Block 칭하는) 사건 시간 구획에 있는 개인적인 조금의 상세한 고장을 위한 HPET v1.0a 명세의 페이지를 보십시오 30. 운영 체계를 독력으로 나가기 위하여 단지 1개의 사건 타이머 구획만 HPET 테이블에서 기술될 다는 것을 유의하십시오. 이것은 여기 사실 있다. 비 유산 플래트홈을 위해, HPET에서 기술된 사건 타이머 구획은 8254/RTC 정기적인 개입중단 논리를 대체하기 위하여 기능을 제공하는 것이다.

다른 사건 시간 구획은 ACPI namespace에서 기술된다. 분해한 ACPI DSDT 테이블에서 관련된 단면도는 여기 있다.

            Device (HPET)
            {
                Name (_HID, EisaId ("PNP0103"))
                Name (_CRS, ResourceTemplate ()
                {
                    Memory32Fixed (ReadOnly,
                        0xFED00000,         // Address Base
                        0x00004000,         // Address Length
                        )
                })
                Method (_STA, 0, NotSerialized)
                {
                    If (HPEE)
                    {
                        Return (0x0F)
                    }
                    Else
                    {
                        Return (Zero)
                    }
                }
            }


HPET를 위한 할당한 PNPID (PNP0103)를 주의하십시오. 아무 _UID도 지정되지 않기 때문에 다른 HPET 타이머 구획이 다는 것을 의미한다.

이 특정한 어미판이 중절모 11.의 밑에 위로 구두를 신길 때 outputted HPET 관련된 메시지의 명부는 여기 있다.

$ dmesg | grep -i HPET
ACPI: HPET CFBF2000, 0038 (r1 INTEL  DX48BT2       76E MSFT  1000013)
ACPI: HPET id: 0x8086a301 base: 0xfed00000
hpet clockevent registered
HPET: 4 timers in total, 0 timers will be used for per-cpu timer
hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0, 0
hpet0: 4 comparators, 64-bit 14.318180 MHz counter
rtc0: alarms up to one month, 114 bytes nvram, hpet irqs
$


첫번째 선은 ACPI HPET 테이블이 읽힐 때 outputted. 두번째 선은 ACPI HPET 테이블이… /arch/x86/kernel/acpi/boot.c.에 의해 기억으로 지도로 나타날 때 outputted. 다음 선은 HPET 유산 개입중단이 시작되골 HPET가 세계적인 시계로 등록될 때 outputted. 뒤에 오는 선은 적어도 1개의 타이머는 userspace (/dev/hpet.)를 위해 보류한ㄴ다는 것을 보증하기 위하여 알갱이가 검사할 때 outputted 산출의 다음 2개의 선은 HPET 장치 구동기에서 온다 (… /drivers/char/hpet.c.) 2개의 타이머는 개입중단을 할당하고 2개는 보여주는.

HPET와 관련되는 때 /proc/time_list에서 산출의 관련 부분은 여기 있다:

Tick Device: mode:     1
Broadcast device
Clock Event Device: hpet
 max_delta_ns:   149983005959
 min_delta_ns:   5000
 mult:           61496114
 shift:          32
 mode:           3
 next_event:     9223372036854775807 nsecs
 set_next_event: hpet_legacy_next_event
 set_mode:       hpet_legacy_set_mode
 event_handler:  tick_handle_oneshot_broadcast
tick_broadcast_mask: 00000000
tick_broadcast_oneshot_mask: 00000000


/proc/sys/dev/hpet/proc/driver/rtc에서 산출은 여기 있다:

$ cat /proc/sys/dev/hpet/max-user-freq
64
$ cat /proc/driver/rtc
rtc_time	: 06:34:31
rtc_date	: 2009-07-06
alrm_time	: **:24:40
alrm_date	: ****-**-**
alarm_IRQ	: no
alrm_pending	: no
24hr		: yes
periodic_IRQ	: no
update_IRQ	: no
HPET_emulated	: yes
DST_enable	: no
periodic_freq	: 1024
batt_status	: okay

HPET 운전사 (/dev/hpet)에는 실시간 시계 운전사에 유사한 API가 있다. HPET 장치의 어떤 수든지 지원할 수 있는 특성 장치이다. 알갱이 API에는 운전사에서 수출된 3개의 공용영역이 있다:

hpet_register( struct hpet_task *tp, int periodic )
hpet_unregister( struct hpet_task *tp )
hpet_control( struct hpet_task *tp, unsigned int cmd, unsigned long arg )


HPET에 userspace 공용영역은 우두머리 /usr/include/linux/hpet.h에서 정의된다. 지원된 가동의 현재 세트는:

#define HPET_IE_ON      _IO('h', 0x01)                        /* interrupt on */
#define HPET_IE_OFF     _IO('h', 0x02)                        /* interrupt off */
#define HPET_INFO       _IOR('h', 0x03, struct hpet_info)     /* get information */
#define HPET_EPI        _IO('h', 0x04)                        /* enable periodic */
#define HPET_DPI        _IO('h', 0x05)                        /* disable periodic */
#define HPET_IRQFREQ    _IOW('h', 0x6, unsigned long)         /* set frequency */


뒤에 오는 보기는 간행한 HPET에 접근하고기 위하여 2 그리고 99 시간 사이 초 간단한 정기적인 신호 다루개 hpet_alarm를 부르기 위하여 공용영역을 이용하는 방법을 보여준다.

#include <stdio.h>
#include <stdlib.h;>
#include <fcntl.h>
#include <time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/time.h>
#include <linux/hpet.h>
#include <stdint.h>
#include <sys/ioctl.h>
#include <signal.h>

static uint16_t hpet_sigio_count;
static uint64_t secs;

static void
hpet_alarm(int val)
{
   struct timespec t;
   clock_gettime(CLOCK_REALTIME, &t);

   if (!secs)  secs = t.tv_sec;

   fprintf(stderr, "hpet_alarm called. iteration: %2d  secs: %ld  nsecs: %ld \n",
                    hpet_sigio_count, (t.tv_sec - secs) , t.tv_sec * 100000 + t.tv_nsec );

   hpet_sigio_count++;
}

int
main(int argc, const char **argv)
{
    struct sigaction old, new;
    struct hpet_info info;
    int              frequency;
    int              iterations;
    int              retval = 0;
    int              fd;
    int              r, i, value;

    if (argc != 3) {
        fprintf(stderr, "Usage: %s frequency(1-64) iterations(10-99)\n", argv[0]);
        return -1;
    }

    frequency = atoi(argv[1]);
    iterations = atoi(argv[2]);

    if (frequency > 64 || frequency < 1 ) {
        fprintf(stderr, "ERROR: Invalid value for frequency\n");
        return -1;
    }

    if (iterations < 10 || iterations > 99 ) {
        fprintf(stderr, "ERROR: Invalid value for iterations\n");
        return -1;
    }

    hpet_sigio_count = 0;

    sigemptyset(&new.sa_mask);
    new.sa_flags = 0;
    new.sa_handler = hpet_alarm;

    sigaction(SIGIO, NULL, &old);
    sigaction(SIGIO, &new, NULL);

    fd = open("/dev/hpet", O_RDONLY);
    if (fd < 0) {
        fprintf(stderr, "ERROR: Failed to open /dev/hpet\n");
        return -1;
    }

    if ((fcntl(fd, F_SETOWN, getpid()) == 1) ||
        ((value = fcntl(fd, F_GETFL)) == 1) ||
        (fcntl(fd, F_SETFL, value | O_ASYNC) == 1)) {
        fprintf(stderr, "ERROR: fcntl failed\n");
        retval = 1;
        goto fail;
    }

    if (ioctl(fd, HPET_IRQFREQ, frequency) < 0) {
        fprintf(stderr, "ERROR: Could not set /dev/hpet to have a %2dHz timer\n", frequency);
        retval = 2;
        goto fail;
    }

    if (ioctl(fd, HPET_INFO, &info) < 0) {
        fprintf(stderr, "ERROR: failed to get info\n");
        retval = 3;
        goto fail;
    }

    fprintf(stdout, "\nhi_ireqfreq: 0x%lx  hi_flags: %0x%lx  hi_hpet: 0x%x  hi_timer: 0x%x\n\n",
            info.hi_ireqfreq,  info.hi_flags, info.hi_hpet, info.hi_timer);

    r = ioctl(fd, HPET_EPI, 0);
    if (info.hi_flags && (r < 0)) {
        fprintf(stderr, "ERROR:  HPET_EPI failed\n");
        retval = 4;
        goto fail;
    }

    if (ioctl(fd, HPET_IE_ON, 0) < 0) {
        fprintf(stderr, "ERROR: HPET_IE_ON failed\n");
        retval = 5;
        goto fail;
    }

    /* wait for specified number of signal interrupts */
    for (i = 0; i < iterations; i++) {
        (void) pause();
    }

    if (ioctl(fd, HPET_IE_OFF, 0) < 0) {
        fprintf(stderr, "ERROR: HPET_IE_OFF failed\n");
        retval = 6;
    }

fail:
    sigaction(SIGIO, &old, NULL);

    if (fd > 0)
        close(fd);

    return retval;
}


32의 주파수로 빌어질 때 이 보기 및 64의 반복 조사에서 산출은 여기 있다.

$ sudo ./hpet_example 32 64

hi_ireqfreq: 0x20  hi_flags: 00  hi_hpet: 0x2  hi_timer: 0x4a1cb9c8

hpet_alarm called. iteration:  0  secs: 0  nsecs: 124683205055050
hpet_alarm called. iteration:  1  secs: 0  nsecs: 124683236313149
hpet_alarm called. iteration:  2  secs: 0  nsecs: 124683267566342
hpet_alarm called. iteration:  3  secs: 0  nsecs: 124683298821905
hpet_alarm called. iteration:  4  secs: 0  nsecs: 124683330077493
hpet_alarm called. iteration:  5  secs: 0  nsecs: 124683361341893
hpet_alarm called. iteration:  6  secs: 0  nsecs: 124683392590764
hpet_alarm called. iteration:  7  secs: 0  nsecs: 124683423849157
hpet_alarm called. iteration:  8  secs: 0  nsecs: 124683455101917
hpet_alarm called. iteration:  9  secs: 0  nsecs: 124683486357683
hpet_alarm called. iteration: 10  secs: 0  nsecs: 124683517617931
hpet_alarm called. iteration: 11  secs: 0  nsecs: 124683548872198
hpet_alarm called. iteration: 12  secs: 1  nsecs: 124682580229541
hpet_alarm called. iteration: 13  secs: 1  nsecs: 124682611481235
hpet_alarm called. iteration: 14  secs: 1  nsecs: 124682642740016
hpet_alarm called. iteration: 15  secs: 1  nsecs: 124682673992697
hpet_alarm called. iteration: 16  secs: 1  nsecs: 124682705247479
hpet_alarm called. iteration: 17  secs: 1  nsecs: 124682736504664
hpet_alarm called. iteration: 18  secs: 1  nsecs: 124682767758840
hpet_alarm called. iteration: 19  secs: 1  nsecs: 124682799014280
hpet_alarm called. iteration: 20  secs: 1  nsecs: 124682830270129
hpet_alarm called. iteration: 21  secs: 1  nsecs: 124682861530334
hpet_alarm called. iteration: 22  secs: 1  nsecs: 124682892784577
hpet_alarm called. iteration: 23  secs: 1  nsecs: 124682924038220
hpet_alarm called. iteration: 24  secs: 1  nsecs: 124682955294110
hpet_alarm called. iteration: 25  secs: 1  nsecs: 124682986550572
hpet_alarm called. iteration: 26  secs: 1  nsecs: 124683017805756
hpet_alarm called. iteration: 27  secs: 1  nsecs: 124683049061117
hpet_alarm called. iteration: 28  secs: 1  nsecs: 124683080318331
hpet_alarm called. iteration: 29  secs: 1  nsecs: 124683111576954
hpet_alarm called. iteration: 30  secs: 1  nsecs: 124683142828988
hpet_alarm called. iteration: 31  secs: 1  nsecs: 124683174083954
hpet_alarm called. iteration: 32  secs: 1  nsecs: 124683205337967
hpet_alarm called. iteration: 33  secs: 1  nsecs: 124683236593144
hpet_alarm called. iteration: 34  secs: 1  nsecs: 124683267851530
hpet_alarm called. iteration: 35  secs: 1  nsecs: 124683299104054
hpet_alarm called. iteration: 36  secs: 1  nsecs: 124683330358748
hpet_alarm called. iteration: 37  secs: 1  nsecs: 124683361617445
hpet_alarm called. iteration: 38  secs: 1  nsecs: 124683392870249
hpet_alarm called. iteration: 39  secs: 1  nsecs: 124683424124489
hpet_alarm called. iteration: 40  secs: 1  nsecs: 124683455379717
hpet_alarm called. iteration: 41  secs: 1  nsecs: 124683486634424
hpet_alarm called. iteration: 42  secs: 1  nsecs: 124683517889149
hpet_alarm called. iteration: 43  secs: 1  nsecs: 124683549144315
hpet_alarm called. iteration: 44  secs: 2  nsecs: 124682580500695
hpet_alarm called. iteration: 45  secs: 2  nsecs: 124682611761325
hpet_alarm called. iteration: 46  secs: 2  nsecs: 124682643011863
hpet_alarm called. iteration: 47  secs: 2  nsecs: 124682674265864
hpet_alarm called. iteration: 48  secs: 2  nsecs: 124682705521034
hpet_alarm called. iteration: 49  secs: 2  nsecs: 124682736776049
hpet_alarm called. iteration: 50  secs: 2  nsecs: 124682768030654
hpet_alarm called. iteration: 51  secs: 2  nsecs: 124682799285398
hpet_alarm called. iteration: 52  secs: 2  nsecs: 124682830544701
hpet_alarm called. iteration: 53  secs: 2  nsecs: 124682861797319
hpet_alarm called. iteration: 54  secs: 2  nsecs: 124682893051578
hpet_alarm called. iteration: 55  secs: 2  nsecs: 124682924306748
hpet_alarm called. iteration: 56  secs: 2  nsecs: 124682955562132
hpet_alarm called. iteration: 57  secs: 2  nsecs: 124682986823545
hpet_alarm called. iteration: 58  secs: 2  nsecs: 124683018073636
hpet_alarm called. iteration: 59  secs: 2  nsecs: 124683049327560
hpet_alarm called. iteration: 60  secs: 2  nsecs: 124683080586707
hpet_alarm called. iteration: 61  secs: 2  nsecs: 124683111841132
hpet_alarm called. iteration: 62  secs: 2  nsecs: 124683143095147
hpet_alarm called. iteration: 63  secs: 2  nsecs: 124683174349985
hpet_alarm called. iteration: 64  secs: 2  nsecs: 124683205607103
$


그래서, 나는 당신이 가버릴 수와 HPET 공용영역을 가진 실험 너자신 지금 있어야 합니다 그래야 나가 충분한 정보를 당신에게 제공했다고 생각한다.

그런데, 모든지 않은 VMware 제품 지원 아닙니다 HPET. 지금 ESX는 손님 운영 체계에 사실상 HPET를 제공하지 않으며 가상 기계에 있는 타이머 편류 때문에 HPET를 전부 무능하게 하는 것이 어떠한 경우에는 필요할지도 모른다. 정보 더를 위해 VMware TimeKeeping를 보십시오.

P.S.I는 2.6.29.5를 - 191 알갱이 달리는 인텔 DX48BT2 어미판에 위 보기를 시험했다.
 

코멘트는 닫힌다.