public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Interrupts ? oops !
@ 2003-09-01  7:15 Matthieu.GIRARDIN
  2003-09-02  2:17 ` Jonathan Larmour
  0 siblings, 1 reply; 2+ messages in thread
From: Matthieu.GIRARDIN @ 2003-09-01  7:15 UTC (permalink / raw)
  To: ecos-discuss

Oooups Sorry !
I forgot to include my code source in the previous e-mail.

____________________________________

Hello world !

A question from a newbie on the eCos interrupts system :

You can see just under a very little source code in order to test eCos
interrupts on my Linux (Synthetic Target).
1) Is it correct ? I believe and it compiled without any problem.
2) Can I launch next an interrupt to the eCos process under Linux with a
"kill -s 1 ecos_pid" whee ecos_pid is the pid of this process eCos ?
3) Can I use any signal Linux for this application ? What are the eCos
vectors ?

Thanks a lot by advance.
It's my first try on interrupts, so please explain me and sorry if it's to
simple for you ;-) !
Thanks !

Matthieu

____________________________________

My source :

#include <cyg/kernel/kapi.h>
#include <stdio.h>

#define NTHREADS 2
#define STACKSIZE 4096

static cyg_uint32 intr_flag;
static cyg_handle_t thread[NTHREADS];
static cyg_thread thread_obj[NTHREADS];
static char stack[NTHREADS][STACKSIZE];
cyg_thread_entry_t reception;
static cyg_interrupt intr;

cyg_uint32 isr(cyg_vector_t vector, cyg_addrword_t data)
{
  cyg_bool_t dsr_required = 0;
  intr_flag = 1;
  return dsr_required ? CYG_ISR_CALL_DSR : CYG_ISR_HANDLED;
}

void cyg_user_start(void)
{
  cyg_handle_t handle;
  intr_flag = 0;

  cyg_interrupt_create(1, 0, 124, isr, NULL, &handle, &intr);
  cyg_interrupt_attach(handle);

  cyg_thread_create(4, reception, (cyg_addrword_t) 0, "thread 0", (void *)
stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
  
  cyg_thread_resume(thread[1]);
}

void reception(cyg_addrword_t data)
{	
  cyg_scheduler_lock();
  printf("\nT2 is waiting ...\n");
  cyg_scheduler_unlock(); 

  while(intr_flag != 1){cyg_thread_delay(100);}

  cyg_scheduler_lock();
  printf("\nT2 OK !!!\n");
  cyg_scheduler_unlock(); 
}


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

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

* Re: [ECOS] Interrupts ? oops !
  2003-09-01  7:15 [ECOS] Interrupts ? oops ! Matthieu.GIRARDIN
@ 2003-09-02  2:17 ` Jonathan Larmour
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Larmour @ 2003-09-02  2:17 UTC (permalink / raw)
  To: Matthieu.GIRARDIN; +Cc: ecos-discuss

Matthieu.GIRARDIN@fr.thalesgroup.com wrote:
> Oooups Sorry !
> I forgot to include my code source in the previous e-mail.
> 
> ____________________________________
> 
> Hello world !
> 
> A question from a newbie on the eCos interrupts system :
> 
> You can see just under a very little source code in order to test eCos
> interrupts on my Linux (Synthetic Target).
> 1) Is it correct ? I believe and it compiled without any problem.
> 2) Can I launch next an interrupt to the eCos process under Linux with a
> "kill -s 1 ecos_pid" whee ecos_pid is the pid of this process eCos ?
> 3) Can I use any signal Linux for this application ? What are the eCos
> vectors ?

I think you'll get a better understanding from reading 
hal/synth/arch/current/src/synth_intr.c. SIGHUP (signal #1) is blocked 
there. There isn't meant to be a way to receive signals like that. But you 
could manually unblock SIGHUP using cyg_hal_sys_sigprocmask I guess.

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine


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

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

end of thread, other threads:[~2003-09-02  2:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-01  7:15 [ECOS] Interrupts ? oops ! Matthieu.GIRARDIN
2003-09-02  2:17 ` Jonathan Larmour

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).