public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] driver init and timer enable
@ 2000-07-21  1:53 KASHIWAYA Haruki
  2000-07-28  6:58 ` Bart Veer
  0 siblings, 1 reply; 3+ messages in thread
From: KASHIWAYA Haruki @ 2000-07-21  1:53 UTC (permalink / raw)
  To: ecos-discuss

Hi There,

I have some questions about driver initialization.

Q1:
When I try to use cyg_thread_delay() in driver initialization,
the function donot work correctly because all interrupts are
disabled until it is enabled in sched.cxx:

232:    // Let the interrupts go
233:    Cyg_Interrupt::enable_interrupts();


I know cyg_thread_delay() is primarily for *thread* use,
but I guess it is better if eCos provide the delay function
for driver use.


Q2:
All driver's init function is called from cyg_io_init() in sysio.c,
it seems there is no way to specify the calling order of each init function.
I guess the order is decided by DEVTAB entry in linker.
Forwhy if each driver is in association and if it need an order,
it must to specify the order of initialization.

Maybe I misunderstood something but any suggestion would be appreciated.

--
KASHIWAYA Haruki
Red Hat K.K.

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

* Re: [ECOS] driver init and timer enable
  2000-07-21  1:53 [ECOS] driver init and timer enable KASHIWAYA Haruki
@ 2000-07-28  6:58 ` Bart Veer
  2000-07-31 18:55   ` KASHIWAYA Haruki
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Veer @ 2000-07-28  6:58 UTC (permalink / raw)
  To: kashiwaya; +Cc: ecos-discuss

>>>>> "Kashiwaya" == KASHIWAYA Haruki <kashiwaya@redhat.com> writes:

    Kashiwaya> Hi There,
    Kashiwaya> I have some questions about driver initialization.

    Kashiwaya> Q1:
    Kashiwaya> When I try to use cyg_thread_delay() in driver initialization,
    Kashiwaya> the function donot work correctly because all interrupts are
    Kashiwaya> disabled until it is enabled in sched.cxx:

    Kashiwaya> 232:    // Let the interrupts go
    Kashiwaya> 233:    Cyg_Interrupt::enable_interrupts();


    Kashiwaya> I know cyg_thread_delay() is primarily for *thread*
    Kashiwaya> use, but I guess it is better if eCos provide the delay
    Kashiwaya> function for driver use.

Driver initialization should normally happen with interrupts disabled,
so cannot rely on clock interrupts.

If a device driver needs to wait for a little bit while hardware
settles down, this would normally involve a busy loop based on a
bogomips rating. The rating can be calculated at run-time early on in
the startup. Alternatively it could be determined by other means and
set by the user via a configuration option - the latter approach saves
some code. There are issues such as whether or not various caches are
enabled.

Unfortunately so far we have managed to do without generic bogomips
support, so it has not been implemented yet.

    Kashiwaya> Q2:
    Kashiwaya> All driver's init function is called from cyg_io_init()
    Kashiwaya> in sysio.c, it seems there is no way to specify the
    Kashiwaya> calling order of each init function. I guess the order
    Kashiwaya> is decided by DEVTAB entry in linker. Forwhy if each
    Kashiwaya> driver is in association and if it need an order, it
    Kashiwaya> must to specify the order of initialization.

    Kashiwaya> Maybe I misunderstood something but any suggestion
    Kashiwaya> would be appreciated.

Ordering the device drivers can be achieved by having appropriately
numbered sections, and then using a SORT directive in the linker
script. I believe that with the current sources, putting one device
driver into section .devtab.0 and another into section .devtab.1, you
can control the initialization order. Some work is in progress to
generalise this, so that we can add new entities like the device table
without having to modify all the linker scripts.

Bart Veer // eCos net maintainer

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

* Re: [ECOS] driver init and timer enable
  2000-07-28  6:58 ` Bart Veer
@ 2000-07-31 18:55   ` KASHIWAYA Haruki
  0 siblings, 0 replies; 3+ messages in thread
From: KASHIWAYA Haruki @ 2000-07-31 18:55 UTC (permalink / raw)
  To: bartv; +Cc: ecos-discuss

Hi Bart,
I totally understood the current implement of those feature.

Thank you!

Bart Veer wrote:
> >>>>> "Kashiwaya" == KASHIWAYA Haruki <kashiwaya@redhat.com> writes:
> 
>     Kashiwaya> Hi There,
>     Kashiwaya> I have some questions about driver initialization.
> 
>     Kashiwaya> Q1:
>     Kashiwaya> When I try to use cyg_thread_delay() in driver initialization,
>     Kashiwaya> the function donot work correctly because all interrupts are
>     Kashiwaya> disabled until it is enabled in sched.cxx:
> 
>     Kashiwaya> 232:    // Let the interrupts go
>     Kashiwaya> 233:    Cyg_Interrupt::enable_interrupts();
> 
> 
>     Kashiwaya> I know cyg_thread_delay() is primarily for *thread*
>     Kashiwaya> use, but I guess it is better if eCos provide the delay
>     Kashiwaya> function for driver use.
> 
> Driver initialization should normally happen with interrupts disabled,
> so cannot rely on clock interrupts.
> 
> If a device driver needs to wait for a little bit while hardware
> settles down, this would normally involve a busy loop based on a
> bogomips rating. The rating can be calculated at run-time early on in
> the startup. Alternatively it could be determined by other means and
> set by the user via a configuration option - the latter approach saves
> some code. There are issues such as whether or not various caches are
> enabled.
> 
> Unfortunately so far we have managed to do without generic bogomips
> support, so it has not been implemented yet.
> 
>     Kashiwaya> Q2:
>     Kashiwaya> All driver's init function is called from cyg_io_init()
>     Kashiwaya> in sysio.c, it seems there is no way to specify the
>     Kashiwaya> calling order of each init function. I guess the order
>     Kashiwaya> is decided by DEVTAB entry in linker. Forwhy if each
>     Kashiwaya> driver is in association and if it need an order, it
>     Kashiwaya> must to specify the order of initialization.
> 
>     Kashiwaya> Maybe I misunderstood something but any suggestion
>     Kashiwaya> would be appreciated.
> 
> Ordering the device drivers can be achieved by having appropriately
> numbered sections, and then using a SORT directive in the linker
> script. I believe that with the current sources, putting one device
> driver into section .devtab.0 and another into section .devtab.1, you
> can control the initialization order. Some work is in progress to
> generalise this, so that we can add new entities like the device table
> without having to modify all the linker scripts.
> 
> Bart Veer // eCos net maintainer
> 



--
KASHIWAYA Haruki
Red Hat K.K.

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

end of thread, other threads:[~2000-07-31 18:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-21  1:53 [ECOS] driver init and timer enable KASHIWAYA Haruki
2000-07-28  6:58 ` Bart Veer
2000-07-31 18:55   ` KASHIWAYA Haruki

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