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: Mail Box Timeout


Hello,

Thanks.

I add the cyg_scheduler_start(), and the system seems to be hanged.
I can't see any redboot messages from console.

Besides, the real-time clock can't tick automatically.
If modfied the alarm initial to be cyg_alarm_initialize(alarm_hdl,
cyg_current_time()+10, 50), the alarm is never executed.

Best regards,


Chuck

----- Original Message -----
From: "Nick Garnett" <nickg@ecoscentric.com>
To: "Chuck Chen" <ycchen@zcom.com.tw>
Cc: "Eric de Jong" <list_ericdejong_10@gmx.net>;
<ecos-discuss@sources.redhat.com>
Sent: Tuesday, July 22, 2003 12:24 AM
Subject: Re: [ECOS] Mail Box Timeout


> "Chuck Chen" <ycchen@zcom.com.tw> writes:
>
> > Hello Eric,
> >
> > Thanks foe your quick feedback.
> > Yes. I pass the absolute timeout to cyg_mbox_timed_get()
> > Howver, the value of cyg_current_time() is always 0 so that the callback
> > functiob od alarm can't be run repeatedly.
> > The alarm code is following.
> >
> > void cyg_start(void)
> > {
> >      cyg_handle_t counter_hdl;
> >      cyg_handle_t sys_clk;
> >      cyg_handle_t alarm_hdl;
> >      cyg_alarm alarm_obj;
> >      unsigned long index;
> >
> >     sys_clk=cyg_real_time_clock();
> >     cyg_clock_to_counter(sys_clk, &counter_hdl);
> >     cyg_alarm_create(counter_hdl, test_callback, (cyg_addrword_t)
&index,
> > &alarm_hdl, &alarm_obj);
> >     cyg_alarm_initialize(alarm_hdl, cyg_current_time(), 50);
> >     .......
> > }
> >
> > void test_callback(cyg_handle_t alarm_handle, cyg_addrword_t data)
> > {
> >     diag_printf("Alarm is active!\n");
> > }
> >
> >
> > Then, the callback function of alarm is executed once only.
> >
>
> cyg_start() is run before the scheduler is started. Because your alarm
> sets its trigger to the current time, it gets called immediately from
> cyg_alarm_initialize(). Further alarms will only happen once the OS is
> actually running. You need to call cyg_scheduler_start() for this to
> happen. Take a look at some of the examples or test programs.
>
> --
> Nick Garnett                    eCos Kernel Architect
> http://www.ecoscentric.com      The eCos and RedBoot experts
>


-- 
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]