[Tinyos-devel] Sharing interfaces below HIL
Vlado Handziski
vlado.handziski at gmail.com
Thu Oct 12 05:20:13 PDT 2006
On 10/11/06, Martin Leopold <leopold at diku.dk> wrote:
>
> Hi All.
> While I'm implementing the lowest layers of my 8051 platform I've been
> browsing the code of the other platforms. What I have come to realize is
> that some of the chips/platforms create their own versions of quite
> similar interfaces (at HPL/HAL levels) - couldn't it be advantageous to
> share some interfaces below the HIL level?
There are several examples in the tinyos core where different
chips/platforms use common interfaces. One prominent example is the common
interface use in the timer HAL. The latest consensus in the core group is to
refer to them as HII (Hardware Independent Interfaces).
Having common interfaces does not however always mean having common
semantics. According to the HAA, up to the HAL level, the use of a HII
should not be at the cost of losing functionality/performance on that
particular hw chip/module. If the hardware is so similar that HII can be
used without such costs, than there is no reason not to use them.
Again this might be one more of those looong discussions that I don't
> know about, but it strikes me as a bit odd that two very similar things
> end up being done differently.
Yes, this has been discussed on several occasions, most recently during the
AdcConfigure debate. Check for example the mail from David at
http://mail.millennium.berkeley.edu/pipermail/tinyos-2.0wg/2006-September/002463.htmlthat
proposes several disambiguation names for the different levels of
hardware independence (semantics) while using a common interface.
Let me take a few examples:
> * I'm now creating a "Led" interface that has simple methods like on/off
> while most other platform seem to export LEDs by using the GeneralIO
> interface.. It seems clear that most platforms could agree on what a Led
> does
I am not sure that I understand what you are aiming at. On almost all tinyos
platforms, LEDs are connected directly to a MCU pin, so GeneralIO is a very
natural way to _implement_ the Leds interface. But on some platforms the
leds is active when a pin is high, on others when it is low, so the Leds
interface implementation in the LedsP is different and can not be readily
shared. So the issue is not only "agreeing on what a Led does". Also, the
current HIL assumes 3 leds, addressed using simple index number. But there
are platforms with more/less leds , others might prefer a color based naming
like in TinyOS 1.x, etc. This platform specific capability/style should be
exported in the form of a HAL so that platform-specific applications can
access the full capabilities of the hardware.
* The atm128 and msp430 chips have identical interrupt interfaces named
> "HplAtm128Interrupt" and "HplMsp430Interrupt"
> * The HplMsp430GeneralIO augments GeneralIO with methods that look very
> much like the interface for IO's that the cc2430 uses
>
> So to me it seems there is at least some potential to share a few
> interfaces even though this would not strictly be a requirement.
In some cases, the chip name prefix is required in order to warn the user
that although the interface signature is the same, the semantics might not
be: number of states that a pin can be (is ~input=output?) , whether an edge
interrupt is triggered on falling/raising edge, required duration of pulse
for level interrupts, etc.
Vlado
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-devel/attachments/20061012/7c6ea34a/attachment.htm
More information about the Tinyos-devel
mailing list