[ECOS] context for creating interrupts on edb7312

Gary Thomas gary@mlbassoc.com
Fri Nov 21 17:28:00 GMT 2003


On Fri, 2003-11-21 at 10:22, Gary Thomas wrote:
> On Fri, 2003-11-21 at 09:32, Aaron Case wrote:
> > > >
> > > > Im looking for something along the lines of #define
> > > hal_interrupts_enable
> > > > cyg_interrupt_enable().
> > >
> > > Actually, there is no explicit call like this (anymore).  Interrupts
> > > will get enabled when the scheduler "starts" the first thread (minimally
> > > the 'idle' thread).  Thread contexts are initialized with interrupts
> > > enabled and this just sort of falls out with the washing :-)
> > >
> > > --
> > > Gary Thomas <gary@mlbassoc.com>
> > > MLB Associates
> > >
> > >
> > 
> > Gary,
> > 
> > Thanks for the prompt answer. I was speaking more in the context of linking
> > and compiling the image.
> > 
> > I see that a call to enable interrupts is not necessary when threads are
> > initialized.
> > 
> > I also see the cyg_interrupt_enable in the map file, which jumps to the
> > hal_interrupts_enable( from vector.S but not in the map file) code in the
> > application.
> 
> I'm not sure I understand what you mean by this (in the map file?), but 
> if a function isn't used (cyg_interrupt_enable() is not used by the 
> kernel except for a single test), then even if that function is defined
> it doesn't end up in the resulting application.
> 
> IMO there is absolutely no need to ever call cyg_interrupt_enable(), 
> except for the kernel test which tests it.
> 
> If you need to manipulate the interrupt state (and there are very few
> cases even for this), this is a better approach:
> 
>    cyg_uint32 state;
>    HAL_DISABLE_INTERRUPTS(state);   // Disables interrupts
>      ...
>    HAL_RESTORE_INTERRUPTS(state);   // Restore interrupts 

Or, even better when writing device drivers:

   cyg_drv_isr_lock();
     ...
   cyg_drv_isr_unlock();

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


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



More information about the Ecos-discuss mailing list