This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: alarm not triggering


Have you declared "delay_flag" globally?
(Are you sure it's the same variable?)

Have you declared it as volatile?
(Are you sure compiler doesn't optimise it?)

Are you sure alarm timer function runs on higher priority than waiting loop?

-- 
Slawek Piotrowski

----- Original Message ----- 
From: "Mahesh" <mahesh@cranessoftware.com>
To: "ecos" <ecos-discuss@sources.redhat.com>
Sent: Tuesday, September 30, 2003 12:25 PM
Subject: [ECOS] alarm not triggering


> Hi,
>    The code given below is getting stuck in the while loop.
> Plz give solution for it.
>
> Code is
>
> system_clock=cyg_real_time_clock();
> cyg_clock_to_counter(system_clock,&handle_counterTdly);
>         cyg_alarm_create(handle_counterTdly, alarm_Tpdly_func,0,
>                                  &handle_alarmTdly, &alarm_Tdly);
> cyg_alarm_initialize(handle_alarmTdly,cyg_current_time()+Tdly,0);
>         delay_flag=0;
> // reception of Tdly
> while(1)
> {
> if (delay_flag==1)
> {
> cyg_mutex_lock(&cliblock);
> printf("\n delay received \n");
> cyg_mutex_unlock(&cliblock);
> sstate=new;
> break;
> }
>   }
>
>
> //alarm timer function
>
> void alarm_Tdly_func(cyg_handle_t alarmH, cyg_addrword_t data)
> {
> delay_flag=1;
> }
>
>
> _______________________________________________
> This email with any attachments is for the exclusive use of the intended
> recipient/s & may contain confidential & legally privileged information.
> If you are not the intended recipient pls notify the sender immediately
> & delete the email from your system. Any unauthorised use, disclosure,
> printing, dissemination, forwarding or copying of this mail is strictly
> prohibited and unlawful.
> Visit us at : http://www.cranessoftware.com
>
>
>
> -- 
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
>
>



-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]