Re: Problem using thread ??



The interrupt is initialized like this:

pTimerReg = MapRegister(TIMER_BASE);
pTimerReg->omcr5 = OMCRX_C | OMCRX_P | OMCRX_S | OMCRX_R |
OMCRX_CRES_1mS;//match control regsiter
pTimerReg->osmr5 = cDureeITPrimaire; // 10 ms
pTimerReg->oier |= OIER_E5; //interrupt enable E4
pTimerReg->oscr5 = 0x0000; //init à 0


// Create an Event to wait on
g_TimerEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &TimerIrq, sizeof(DWORD),
&g_Timerintr, sizeof(DWORD), NULL);

// Link our Event with the SYSINTR
test = InterruptInitialize(g_Timerintr, g_TimerEvent, NULL, 0);

ThreadIT = CreateThread(NULL, 0, Interrupt10ms, GlobalHwnd,
CREATE_SUSPENDED, NULL);
CeSetThreadPriority(ThreadIT, 50);
ResumeThread(ThreadIT);//pr démarrer la tache //



And the Boucle in the thread interrupt is like this:

DWORD WINAPI Interrupt10ms (LPVOID pParam)
{

while(1)
{

WaitForSingleObject(g_TimerEvent, /*INFINITE*/10000); //Attente :
Time_Out:1sec


if((pTimerReg->ossr & OSSR_M5) == OSSR_M5) //verifie que l'it provienne
bien du bon timer
{
pTimerReg->ossr |= OSSR_M5;

TraiteIT10ms();//-->traitement IT

InterruptDone(g_Timerintr);
}

if(QuitThread) break;

}

ExitThread(WM_QUIT);

return 0;


}

The source of the interrupt is a timer interrupt. I use OS5 timer to
generate an interrupt.

Thanks to help me.

Fred



"Bruce Eitman [eMVP]" <beitman.nospam@xxxxxxxxxxxxxxxxxxxxxx> a écrit dans
le message de news: %23wwaCpEhIHA.5900@xxxxxxxxxxxxxxxxxxxxxxx
How do you define interrupt? What is the source of the interrupt?

--
Bruce Eitman (eMVP)
Senior Engineer
beitman AT applieddata DOT net

Applied Data Systems
www.applieddata.net
An ISO 9001:2000 Registered Company
Microsoft WEP Gold-level Member

"fred_d" <duchassin@xxxxxxxxx> wrote in message
news:fr8jil$2n3$1@xxxxxxxxxxxxxxxxxxxxx
Hello everybody,

I'm asking for help because i have problem with thread programming!

My application is runing under windows Ce 5. I use evc++ to make my
application.

In fact, my program is composed of 2 threads:
- One main thread which is the core of my application. Everythingh is
done in this thread. --> MAIN thread with priority NORMAL
-A thread which occurs every 10 ms. Every 10 ms, a timer interrupt occurs
and I control if a key is pressed. (if a key is pressed, i only validate
a flag and in the main thread, i do the action desired by this flag). -->
INTERRUPT thread with priority : 50 (high priority).

So you understand that the thread INTERRUPT wich occurs every 10 ms is
very important.

My problem is the following:
If in the main thread i have a boucle (a do...while for example) which
used a lot of CPU time (this thread has a normal priority).
At this time, I never go to the thread INTERRUPT whereas this thread has
a high priority !!! (sometimes i go in this thread 10 or 20 seconds later
!!!)

I don't knwo why !! I just would like to have a periodic interrupt...


Thanks to help me please.

Fred





.



Relevant Pages

  • Re: Fast Timer
    ... I am trying to write an application that receives data off a USB device at ... is there a way I can tie into the USB 1ms interrupt and write ... My concern with this method is what priority is this timer ... How do I set the priority for this timer event (or callback ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Problem using thread ??
    ... high priority? ... beitman AT applieddata DOT net ... But I think it cames from the interrupt configuration. ... causes a high priority thread in one of your drivers to run? ...
    (microsoft.public.windowsce.embedded.vc)
  • Re[4]: Modem + Network in Xircom cards, and maybe others
    ... I think understand that problem is related to GIANT driver ... it needs to have high enough priority. ... other hardware or software interrupt handler. ... How did their priorities get to be in the middle of SWI ...
    (freebsd-current)
  • Re: [PATCH v3 3/6] vbus: add a "vbus-proxy" bus model for vbus_driver objects
    ... But from what I understand VMM bypass means avoiding the call to the VMM entirely by exposing hardware registers directly to the guest. ... I use "priority" generally..there may be other non-priority based ... if priority is so important then I'd recommend exposing it via a virtual interrupt controller. ... You'll still have to exit if the host takes a low priority interrupt, schedule the irq thread according to its priority, and return to the guest. ...
    (Linux-Kernel)
  • Re: Problem using thread ??
    ... Okay, that confims that you are actually using an interrupt, I was ... is it possible that the low priority thread is doing something causes ... beitman AT applieddata DOT net ... The source of the interrupt is a timer interrupt. ...
    (microsoft.public.windowsce.embedded.vc)

Loading