OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [cdl-guide/] [language.interface.html] - Diff between revs 28 and 174

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 28 Rev 174
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- This material may be distributed only subject to the terms      -->
<!-- This material may be distributed only subject to the terms      -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- or later (the latest version is presently available at          -->
<!-- or later (the latest version is presently available at          -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- permission is obtained from the copyright holder.               -->
<!-- permission is obtained from the copyright holder.               -->
<HTML
<HTML
><HEAD
><HEAD
><TITLE
><TITLE
>Interfaces</TITLE
>Interfaces</TITLE
><meta name="MSSmartTagsPreventParsing" content="TRUE">
><meta name="MSSmartTagsPreventParsing" content="TRUE">
<META
<META
NAME="GENERATOR"
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
"><LINK
REL="HOME"
REL="HOME"
TITLE="The eCos Component Writer's Guide"
TITLE="The eCos Component Writer's Guide"
HREF="cdl-guide.html"><LINK
HREF="cdl-guide.html"><LINK
REL="UP"
REL="UP"
TITLE="The CDL Language"
TITLE="The CDL Language"
HREF="language.html"><LINK
HREF="language.html"><LINK
REL="PREVIOUS"
REL="PREVIOUS"
TITLE="Values and Expressions"
TITLE="Values and Expressions"
HREF="language.values.html"><LINK
HREF="language.values.html"><LINK
REL="NEXT"
REL="NEXT"
TITLE="Updating the ecos.db database"
TITLE="Updating the ecos.db database"
HREF="language.database.html"></HEAD
HREF="language.database.html"></HEAD
><BODY
><BODY
CLASS="SECT1"
CLASS="SECT1"
BGCOLOR="#FFFFFF"
BGCOLOR="#FFFFFF"
TEXT="#000000"
TEXT="#000000"
LINK="#0000FF"
LINK="#0000FF"
VLINK="#840084"
VLINK="#840084"
ALINK="#0000FF"
ALINK="#0000FF"
><DIV
><DIV
CLASS="NAVHEADER"
CLASS="NAVHEADER"
><TABLE
><TABLE
SUMMARY="Header navigation table"
SUMMARY="Header navigation table"
WIDTH="100%"
WIDTH="100%"
BORDER="0"
BORDER="0"
CELLPADDING="0"
CELLPADDING="0"
CELLSPACING="0"
CELLSPACING="0"
><TR
><TR
><TH
><TH
COLSPAN="3"
COLSPAN="3"
ALIGN="center"
ALIGN="center"
>The <SPAN
>The <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>eCos</SPAN
>eCos</SPAN
> Component Writer's Guide</TH
> Component Writer's Guide</TH
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="10%"
WIDTH="10%"
ALIGN="left"
ALIGN="left"
VALIGN="bottom"
VALIGN="bottom"
><A
><A
HREF="language.values.html"
HREF="language.values.html"
ACCESSKEY="P"
ACCESSKEY="P"
>Prev</A
>Prev</A
></TD
></TD
><TD
><TD
WIDTH="80%"
WIDTH="80%"
ALIGN="center"
ALIGN="center"
VALIGN="bottom"
VALIGN="bottom"
>Chapter 3. The CDL Language</TD
>Chapter 3. The CDL Language</TD
><TD
><TD
WIDTH="10%"
WIDTH="10%"
ALIGN="right"
ALIGN="right"
VALIGN="bottom"
VALIGN="bottom"
><A
><A
HREF="language.database.html"
HREF="language.database.html"
ACCESSKEY="N"
ACCESSKEY="N"
>Next</A
>Next</A
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><HR
><HR
ALIGN="LEFT"
ALIGN="LEFT"
WIDTH="100%"></DIV
WIDTH="100%"></DIV
><DIV
><DIV
CLASS="SECT1"
CLASS="SECT1"
><H1
><H1
CLASS="SECT1"
CLASS="SECT1"
><A
><A
NAME="LANGUAGE.INTERFACE">Interfaces</H1
NAME="LANGUAGE.INTERFACE">Interfaces</H1
><P
><P
>For many configurability requirements, options provide sufficient
>For many configurability requirements, options provide sufficient
expressive power. However there are times when a higher level of
expressive power. However there are times when a higher level of
abstraction is appropriate. As an example, suppose that some package
abstraction is appropriate. As an example, suppose that some package
relies on the presence of code that implements the standard kernel
relies on the presence of code that implements the standard kernel
scheduling interface. However the requirement is no more stringent
scheduling interface. However the requirement is no more stringent
than this, so the constraint can be satisfied by the mlqueue
than this, so the constraint can be satisfied by the mlqueue
scheduler, the bitmap scheduler, or any additional schedulers that may
scheduler, the bitmap scheduler, or any additional schedulers that may
get implemented in future. A first attempt at expressing the
get implemented in future. A first attempt at expressing the
dependency might be:</P
dependency might be:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires CYGSEM_KERNEL_SCHED_MLQUEUE || CYGSEM_KERNEL_SCHED_BITMAP</PRE
>    requires CYGSEM_KERNEL_SCHED_MLQUEUE || CYGSEM_KERNEL_SCHED_BITMAP</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>This constraint will work with the current release, but it is limited.
>This constraint will work with the current release, but it is limited.
Suppose there is a new release of the kernel which adds another
Suppose there is a new release of the kernel which adds another
scheduler such as a deadline scheduler, or suppose that there is a new
scheduler such as a deadline scheduler, or suppose that there is a new
third party package which adds such a scheduler. The package
third party package which adds such a scheduler. The package
containing the limited constraint would now have to be updated and
containing the limited constraint would now have to be updated and
another release made, with possible knock-on effects.</P
another release made, with possible knock-on effects.</P
><P
><P
><SPAN
><SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> interfaces provide an abstraction mechanism: constraints can be
> interfaces provide an abstraction mechanism: constraints can be
expressed in terms of an abstract concept, for example
expressed in terms of an abstract concept, for example
&#8220;scheduler&#8221;, rather than specific implementations such as
&#8220;scheduler&#8221;, rather than specific implementations such as
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGSEM_KERNEL_SCHED_MLQUEUE</TT
>CYGSEM_KERNEL_SCHED_MLQUEUE</TT
> and
> and
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGSEM_KERNEL_SCHED_BITMAP</TT
>CYGSEM_KERNEL_SCHED_BITMAP</TT
>. Basically an interface
>. Basically an interface
is a calculated configuration option:</P
is a calculated configuration option:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>cdl_interface CYGINT_KERNEL_SCHEDULER {
>cdl_interface CYGINT_KERNEL_SCHEDULER {
    display  "Number of schedulers in this configuration"
    display  "Number of schedulers in this configuration"
    &#8230;
    &#8230;
}</PRE
}</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>The individual schedulers can then implement this interface:</P
>The individual schedulers can then implement this interface:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>cdl_option CYGSEM_KERNEL_SCHED_MLQUEUE {
>cdl_option CYGSEM_KERNEL_SCHED_MLQUEUE {
    display       "Multi-level queue scheduler"
    display       "Multi-level queue scheduler"
    default_value 1
    default_value 1
    implements    CYGINT_KERNEL_SCHEDULER
    implements    CYGINT_KERNEL_SCHEDULER
    &#8230;
    &#8230;
}
}
 
 
cdl_option CYGSEM_KERNEL_SCHED_BITMAP {
cdl_option CYGSEM_KERNEL_SCHED_BITMAP {
    display       "Bitmap scheduler"
    display       "Bitmap scheduler"
    default_value 0
    default_value 0
    implements    CYGINT_KERNEL_SCHEDULER
    implements    CYGINT_KERNEL_SCHEDULER
    &#8230;
    &#8230;
}</PRE
}</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>Future schedulers can also implement this interface. The value of an
>Future schedulers can also implement this interface. The value of an
interface, for the purposes of expression evaluation, is the number of
interface, for the purposes of expression evaluation, is the number of
active and enabled options which implement this interface. Packages
active and enabled options which implement this interface. Packages
which rely on the presence of a scheduler can impose constraints such
which rely on the presence of a scheduler can impose constraints such
as:</P
as:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires CYGINT_KERNEL_SCHEDULER</PRE
>    requires CYGINT_KERNEL_SCHEDULER</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>If none of the schedulers are enabled, or if the kernel package is not
>If none of the schedulers are enabled, or if the kernel package is not
loaded, then <TT
loaded, then <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGINT_KERNEL_SCHEDULER</TT
>CYGINT_KERNEL_SCHEDULER</TT
> will evaluate
> will evaluate
to <TT
to <TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
>. If at least one scheduler is active and
>. If at least one scheduler is active and
enabled then the constraint will be satisfied.</P
enabled then the constraint will be satisfied.</P
><P
><P
>Because interfaces have a calculated value determined by the
>Because interfaces have a calculated value determined by the
implementors, the <SPAN
implementors, the <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>default_value</SPAN
>default_value</SPAN
> and <SPAN
> and <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>calculated</SPAN
>calculated</SPAN
> properties are not
> properties are not
applicable and should not appear in the body of a <TT
applicable and should not appear in the body of a <TT
CLASS="LITERAL"
CLASS="LITERAL"
>cdl_interface</TT
>cdl_interface</TT
>
>
command. Interfaces have the <TT
command. Interfaces have the <TT
CLASS="LITERAL"
CLASS="LITERAL"
>data</TT
>data</TT
> flavor by
> flavor by
default, but the <TT
default, but the <TT
CLASS="LITERAL"
CLASS="LITERAL"
>bool</TT
>bool</TT
> and
> and
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>booldata</TT
>booldata</TT
> flavors may be specified instead. A
> flavors may be specified instead. A
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>bool</TT
>bool</TT
> interface is disabled if there are no active
> interface is disabled if there are no active
and enabled implementors, otherwise it is enabled. A
and enabled implementors, otherwise it is enabled. A
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>booldata</TT
>booldata</TT
> interface is disabled if there are no
> interface is disabled if there are no
active and enabled implementors, otherwise it is enabled and has a
active and enabled implementors, otherwise it is enabled and has a
value corresponding to the number of these implementors. Other
value corresponding to the number of these implementors. Other
properties such as <SPAN
properties such as <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>requires</SPAN
>requires</SPAN
> and <SPAN
> and <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>compile</SPAN
>compile</SPAN
> can be used as normal.</P
> can be used as normal.</P
><P
><P
>Some component writers will not want to use interfaces in this way.
>Some component writers will not want to use interfaces in this way.
The reasoning is that their code will only have been tested with the
The reasoning is that their code will only have been tested with the
existing schedulers, so the <SPAN
existing schedulers, so the <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>requires</SPAN
>requires</SPAN
> constraint needs to be
> constraint needs to be
expressed in terms of those schedulers; it is possible that the
expressed in terms of those schedulers; it is possible that the
component will still work with a new scheduler, but there are no
component will still work with a new scheduler, but there are no
guarantees. Other component writers may take a more optimistic view
guarantees. Other component writers may take a more optimistic view
and assume that their code will work with any scheduler until proven
and assume that their code will work with any scheduler until proven
otherwise. It is up to individual component writers to decide which
otherwise. It is up to individual component writers to decide which
approach is most appropriate in any given case.</P
approach is most appropriate in any given case.</P
><P
><P
>One common use for interfaces is to describe the hardware
>One common use for interfaces is to describe the hardware
functionality provided by a given target. For example the <SPAN
functionality provided by a given target. For example the <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
>
>
scripts for a TCP/IP package might want to know whether or not the
scripts for a TCP/IP package might want to know whether or not the
target hardware has an ethernet interface. Generally it is not
target hardware has an ethernet interface. Generally it is not
necessary for the TCP/IP stack to know exactly which ethernet hardware
necessary for the TCP/IP stack to know exactly which ethernet hardware
is present, since there should be a device driver which implements the
is present, since there should be a device driver which implements the
appropriate functionality. In <SPAN
appropriate functionality. In <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> terms the device drivers should
> terms the device drivers should
implement an interface <TT
implement an interface <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGHWR_NET_DRIVERS</TT
>CYGHWR_NET_DRIVERS</TT
>, and the
>, and the
<SPAN
<SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> scripts for the TCP/IP stack can use this in appropriate
> scripts for the TCP/IP stack can use this in appropriate
expressions. </P
expressions. </P
><DIV
><DIV
CLASS="NOTE"
CLASS="NOTE"
><BLOCKQUOTE
><BLOCKQUOTE
CLASS="NOTE"
CLASS="NOTE"
><P
><P
><B
><B
>Note: </B
>Note: </B
>Using the term <SPAN
>Using the term <SPAN
CLASS="emphasis"
CLASS="emphasis"
><I
><I
CLASS="EMPHASIS"
CLASS="EMPHASIS"
>interface</I
>interface</I
></SPAN
></SPAN
> for this concept is
> for this concept is
sometimes confusing, since the term has various other meanings as
sometimes confusing, since the term has various other meanings as
well. In practice, it is often correct. If there is a configuration
well. In practice, it is often correct. If there is a configuration
option that implements a given <SPAN
option that implements a given <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> interface, then usually this
> interface, then usually this
option will enable some code that provides a particular interface at
option will enable some code that provides a particular interface at
the C or C++ level. For example an ethernet device driver implements
the C or C++ level. For example an ethernet device driver implements
the <SPAN
the <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> interface <TT
> interface <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGHWR_NET_DRIVERS</TT
>CYGHWR_NET_DRIVERS</TT
>, and also
>, and also
implements a set of C functions that can be used by the TCP/IP stack.
implements a set of C functions that can be used by the TCP/IP stack.
Similarly <TT
Similarly <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGSEM_KERNEL_SCHED_MLQUEUE</TT
>CYGSEM_KERNEL_SCHED_MLQUEUE</TT
> implements
> implements
the <SPAN
the <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> interface <TT
> interface <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGINT_KERNEL_SCHEDULER</TT
>CYGINT_KERNEL_SCHEDULER</TT
> and
> and
also provides the appropriate scheduling functions.</P
also provides the appropriate scheduling functions.</P
></BLOCKQUOTE
></BLOCKQUOTE
></DIV
></DIV
></DIV
></DIV
><DIV
><DIV
CLASS="NAVFOOTER"
CLASS="NAVFOOTER"
><HR
><HR
ALIGN="LEFT"
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
SUMMARY="Footer navigation table"
WIDTH="100%"
WIDTH="100%"
BORDER="0"
BORDER="0"
CELLPADDING="0"
CELLPADDING="0"
CELLSPACING="0"
CELLSPACING="0"
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="left"
ALIGN="left"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="language.values.html"
HREF="language.values.html"
ACCESSKEY="P"
ACCESSKEY="P"
>Prev</A
>Prev</A
></TD
></TD
><TD
><TD
WIDTH="34%"
WIDTH="34%"
ALIGN="center"
ALIGN="center"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="cdl-guide.html"
HREF="cdl-guide.html"
ACCESSKEY="H"
ACCESSKEY="H"
>Home</A
>Home</A
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="right"
ALIGN="right"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="language.database.html"
HREF="language.database.html"
ACCESSKEY="N"
ACCESSKEY="N"
>Next</A
>Next</A
></TD
></TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="left"
ALIGN="left"
VALIGN="top"
VALIGN="top"
>Values and Expressions</TD
>Values and Expressions</TD
><TD
><TD
WIDTH="34%"
WIDTH="34%"
ALIGN="center"
ALIGN="center"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="language.html"
HREF="language.html"
ACCESSKEY="U"
ACCESSKEY="U"
>Up</A
>Up</A
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="right"
ALIGN="right"
VALIGN="top"
VALIGN="top"
>Updating the <SPAN
>Updating the <SPAN
CLASS="DATABASE"
CLASS="DATABASE"
>ecos.db</SPAN
>ecos.db</SPAN
> database</TD
> database</TD
></TR
></TR
></TABLE
></TABLE
></DIV
></DIV
></BODY
></BODY
></HTML
></HTML
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.