public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] cyg_alarm_initilize
@ 2006-04-03 14:11 vasantha.rajan
  2006-04-04 10:11 ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: vasantha.rajan @ 2006-04-03 14:11 UTC (permalink / raw)
  To: ecos-discuss

I have some problem in cyg_alarn_initialize() API.

 Our code contains nearly 20 threads sheduled to run. In one particular
 thread we have cyg_alarm_initilize() api as give below,
 cyg_alarm_initialize(handle_alarmTbcn,cyg_current_time() + 10 , 0 );(ie my
 alarm triggers fo every 100ms)

 In my CDL i have my CYGNUM_HAL_RTC_NUMERATOR value as 1000000000 and
 CYGNUM_HAL_RTC_DENOMINATOR value as 100.

 My problem is the code strucks at some point, I think there is some problem
 with alarm api and kernel timer.plz help me...........

 we use arm excalibur board and ecos 2.0 version.

 Thanks
 vasanth


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] cyg_alarm_initilize
  2006-04-03 14:11 [ECOS] cyg_alarm_initilize vasantha.rajan
@ 2006-04-04 10:11 ` Andrew Lunn
  2006-04-05  4:24   ` vasantha.rajan
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2006-04-04 10:11 UTC (permalink / raw)
  To: vasantha.rajan; +Cc: ecos-discuss

On Mon, Apr 03, 2006 at 07:40:48PM +0530, vasantha.rajan wrote:
> I have some problem in cyg_alarn_initialize() API.
> 
>  Our code contains nearly 20 threads sheduled to run. In one particular
>  thread we have cyg_alarm_initilize() api as give below,
>  cyg_alarm_initialize(handle_alarmTbcn,cyg_current_time() + 10 , 0 );(ie my
>  alarm triggers fo every 100ms)
> 
>  In my CDL i have my CYGNUM_HAL_RTC_NUMERATOR value as 1000000000 and
>  CYGNUM_HAL_RTC_DENOMINATOR value as 100.
> 
>  My problem is the code strucks at some point, I think there is some problem
>  with alarm api and kernel timer.

The timer code is very mature. The problem is more likely to be in
your code. Try enabling CYGPKG_INFRA_DEBUG.

        Andrew

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] cyg_alarm_initilize
  2006-04-04 10:11 ` Andrew Lunn
@ 2006-04-05  4:24   ` vasantha.rajan
  2006-04-05 14:12     ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: vasantha.rajan @ 2006-04-05  4:24 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: ecos-discuss

On Tuesday 04 April 2006 15:40, you wrote:

Hi Andrew,

Thanks for  ur reply.But I have simple code on alarm, I will give it below.

#define PRIORITY   10
#define WORK_PRIORITY	    11
#define STACKSIZE  1024
  
unsigned char stack[ STACKSIZE ];
unsigned char work_stacks[STACKSIZE];
cyg_handle_t  handle,work_handles;
cyg_thread    thread,work_threads;


cyg_flag_t flag;
cyg_flag_value_t value,pattern;
cyg_flag_mode_t mode;

 cyg_handle_t counter_hdl; 
 cyg_handle_t sys_clk; 
 cyg_handle_t alarm_hdl; 
 cyg_alarm_t alarm_handler; 
 cyg_alarm alarm_obj; 

  cyg_mutex_t cliblock;
  
void alarm_handler( cyg_handle_t alarm_handle, cyg_addrword_t data )  
{ 
	
	value = 1;
	cyg_flag_setbits(&flag,pattern);
	
}  


void work(cyg_addrword_t data)
{
		
	while(1)
	{
		cyg_mutex_lock(&cliblock);
		printf("In worker thread\n");
		cyg_mutex_unlock(&cliblock);
	}		
}

  
void counter_thread(cyg_addrword_t data)
{
	while(1)
	{
     		
	value = 0xfffffffe;
	pattern = 1;
	mode=CYG_FLAG_WAITMODE_OR ;
	cyg_flag_maskbits(&flag,value);

	cyg_alarm_initialize( alarm_hdl, 10 + cyg_current_time() , 0 ); 

	value=cyg_flag_wait(&flag,pattern,mode);	

	}
}  
  
  
void cyg_user_start()
{ 
  	sys_clk = cyg_real_time_clock();
    cyg_clock_to_counter( sys_clk, &counter_hdl ); 
	cyg_alarm_create( counter_hdl, alarm_handler, (cyg_addrword_t)&index1, 
&alarm_hdl, &alarm_obj );	 
	
	cyg_mutex_init(&cliblock);
	
	cyg_thread_create(10, &counter_thread, 0 ,"counter_thread", stack, STACKSIZE, 
&handle, &thread);
	cyg_thread_resume(handle);
	
	cyg_thread_create(11, &work , 0, "work",work_stacks, STACKSIZE,
                          &(work_handles),&(work_threads));
	cyg_thread_resume(work_handles);
	 
}

when I run this code the printf in worker's thread got struck at one 
ponit...Why???? Plz reply.and how can I make the code to run continiously.???

Thanks
Vasanth
	 




> On Mon, Apr 03, 2006 at 07:40:48PM +0530, vasantha.rajan wrote:
> > I have some problem in cyg_alarn_initialize() API.
> >
> >  Our code contains nearly 20 threads sheduled to run. In one particular
> >  thread we have cyg_alarm_initilize() api as give below,
> >  cyg_alarm_initialize(handle_alarmTbcn,cyg_current_time() + 10 , 0 );(ie
> > my alarm triggers fo every 100ms)
> >
> >  In my CDL i have my CYGNUM_HAL_RTC_NUMERATOR value as 1000000000 and
> >  CYGNUM_HAL_RTC_DENOMINATOR value as 100.
> >
> >  My problem is the code strucks at some point, I think there is some
> > problem with alarm api and kernel timer.
>
> The timer code is very mature. The problem is more likely to be in
> your code. Try enabling CYGPKG_INFRA_DEBUG.
>
>         Andrew



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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] cyg_alarm_initilize
  2006-04-05  4:24   ` vasantha.rajan
@ 2006-04-05 14:12     ` Andrew Lunn
  2006-04-05 14:19       ` Gary Thomas
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2006-04-05 14:12 UTC (permalink / raw)
  To: vasantha.rajan; +Cc: ecos-discuss

On Wed, Apr 05, 2006 at 09:53:40AM +0530, vasantha.rajan wrote:
> On Tuesday 04 April 2006 15:40, you wrote:
> 
> Hi Andrew,
> 
> Thanks for  ur reply.But I have simple code on alarm, I will give it below.

Did you do as i asked? Enabled CYGPKG_INFRA_DEBUG?

For me this code throws an assertion failed at startup. Once i fixed
that it has been running for 10 minutes without a problem.

        Andrew

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] cyg_alarm_initilize
  2006-04-05 14:12     ` Andrew Lunn
@ 2006-04-05 14:19       ` Gary Thomas
  2006-04-05 14:22         ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Gary Thomas @ 2006-04-05 14:19 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: vasantha.rajan, eCos Discussion

On Wed, 2006-04-05 at 16:12 +0200, Andrew Lunn wrote:
> On Wed, Apr 05, 2006 at 09:53:40AM +0530, vasantha.rajan wrote:
> > On Tuesday 04 April 2006 15:40, you wrote:
> > 
> > Hi Andrew,
> > 
> > Thanks for  ur reply.But I have simple code on alarm, I will give it below.
> 
> Did you do as i asked? Enabled CYGPKG_INFRA_DEBUG?
> 
> For me this code throws an assertion failed at startup. Once i fixed
> that it has been running for 10 minutes without a problem.

What did you have to fix?  

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] cyg_alarm_initilize
  2006-04-05 14:19       ` Gary Thomas
@ 2006-04-05 14:22         ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2006-04-05 14:22 UTC (permalink / raw)
  To: Gary Thomas; +Cc: vasantha.rajan, eCos Discussion

On Wed, Apr 05, 2006 at 08:19:06AM -0600, Gary Thomas wrote:
> On Wed, 2006-04-05 at 16:12 +0200, Andrew Lunn wrote:
> > On Wed, Apr 05, 2006 at 09:53:40AM +0530, vasantha.rajan wrote:
> > > On Tuesday 04 April 2006 15:40, you wrote:
> > > 
> > > Hi Andrew,
> > > 
> > > Thanks for  ur reply.But I have simple code on alarm, I will give it below.
> > 
> > Did you do as i asked? Enabled CYGPKG_INFRA_DEBUG?
> > 
> > For me this code throws an assertion failed at startup. Once i fixed
> > that it has been running for 10 minutes without a problem.
> 
> What did you have to fix?  

If i say that he will not learn what CYGPKG_INFRA_DEBUG does and how
you can debug eCos applications.

        Andrew        

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-04-05 14:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-03 14:11 [ECOS] cyg_alarm_initilize vasantha.rajan
2006-04-04 10:11 ` Andrew Lunn
2006-04-05  4:24   ` vasantha.rajan
2006-04-05 14:12     ` Andrew Lunn
2006-04-05 14:19       ` Gary Thomas
2006-04-05 14:22         ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).