Which irq files are taken and what is *_mng_*
strauman at SLAC.Stanford.EDU
Mon Sep 22 23:15:36 UTC 2003
Leon Pollak wrote:
> Hello, gurus.
> 1. Looking for something different, I found that the
> and, for example,
> both contain the same named files irq.c, irq.h, irq_init.c with different
> realization of the same named function.
Good point - bad practice. I guess this is for historical reasons. People
'derive' code from an existing BSP using a 'copy/modify' approach (rather than
trying to really use the 'shared' are as explained below).
Unfortunately, as it has happened in the past, bugs are propagated this
way and the same bugs need to be fixed in different places...
> Please, how the link process regulates which set will be taken?
It is not the link process but Makefile VPATH magic. Contrary to what
the name suggests 'libbsp/powerpc/shared' is not really shared among
all PPC BSPs. Only different flavors of the motorola_powerpc BSP use
code from 'shared'. The others (such as mbx8xx) used the 'copy' approach,
i.e. they use their own copy.
The idea of the 'powerpc/shared' code is as follows:
Your BSP provides a directory tree identical to the 'shared' tree,
i.e. you have 'openpic', 'irq', 'startup' etc. directories.
In your, let's say 'irq' directory, you provide a Makefile.am which
defines a VPATH that goes from more specific to more generic locations:
VPATH=@srcdir@:@srcdir at ../../shared/irq:...
Code in the 'shared' location is usually split into 'generic/reusable'
files and more BSP specific (i.e. motorola BSP specific) files.
Take the initialization code, for example (irq_init.c) - it's most
likely BSP specific whereas the interrupt management code itself
(which is defined in 'irq.c') can be used 'as-is' by a new BSP.
You would then simply provide your implementation of 'irq_init.c' and
have no 'irq.c' at all. The makefile would then search the VPATH, find
your irq_init.c and use it. Since you have no 'irq.c', 'make' will continue
searching the VPATH and pick up '../../shared/irq/irq.c'.
Since e.g. mbx8xx is not using 'shared' (although its 'irq.c' & friends
are almost identical), its VPATH doesn't instruct 'make' to search the
'powerpc/shared' subtree for sources and the 'shared' ones will never
be actually compiled.
> 2. I search in the documentation and was not able to find how and when the
> functions like BSP_rtems_irq_mng_XXXX are used. Can you point me to any
> explanation of the principles of this management and its usage?
> Many thanks ahead.
More information about the users