Go to previous topic
Go to next topic
Last Post 08 Jun 2004 03:23 PM by  taron@redwizard.de
Problems catching a Timer interrupt
 2 Replies
Author Messages
taron@redwizard.de
New Member
New Member
Posts:


--
03 Jun 2004 03:53 PM
    My device needs some high precision time measurements. So I tried to setup the onboard Timer3 to interrupt one of my device drivers.

    To enable Timer3 my driver sets Bit 6 and 7 of CONTROL3 to high and it writes the initial value to the LOAD3 register.
    I also set the corresponding Bit (Bit 22) in the Interrupt Controller Enable Set Register (INTENS) to one.
    How I understand should timer3 run periodicly now and throw an interrupt every cycle.

    In order to connect this event to an interrupt service thread in my driver
    I have the following code:
    Quote:

    DWORD dwIntr = 22;
    pds->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

    if (!KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &dwIntr,sizeof( dwIntr ),&pds->sysIntr, sizeof(pds->sysIntr),NULL ))
    {
    DEBUGMSG(ZONE_ERROR, (_T("Init failed: KernelIOControl\r\n")));
    return 0;
    }

    if (!InterruptInitialize(pds->sysIntr, pds->hEvent, NULL, 0))
    {
    DEBUGMSG(ZONE_ERROR, (_T("Init failed: InterruptInitialize\r\n")));
    return 0;
    }
    pds->hThread = CreateThread(NULL,0,&GPIO_IST, pds, 0, NULL);


    This basicly works fine and everything seems to be initialized right.
    But my IST waits forever and no interrupt is catched the at all.

    I am relatively new to Windows CE programming so maybe I am doing an easy mistake.
    I hope maybe one of you can point me in the right direction.

    Thanks for your help

    Bernhard
    icnthyx@hotmail.com
    New Member
    New Member
    Posts:


    --
    07 Jun 2004 11:40 PM
    taron,
    your code looks ok. The main issue here is that Timer3 is used by the performance subsystem of the WinCE kernel/OAL for the perf and timing tools interfaces in WinCE.

    Use Timer 2 - it is not being used.

    Thanks,
    Tech Support
    taron@redwizard.de
    New Member
    New Member
    Posts:


    --
    08 Jun 2004 03:23 PM
    Now its working fine.
    Thanks a lot for this hint.

    Bernhard


    ---