Re: Hardware Abstraction
- From: "Michael N. Moran" <mike@xxxxxxxxxxx>
- Date: Tue, 28 Nov 2006 07:16:13 -0500
Vladimir Vassilevsky wrote:
Hello All,
I am looking for a concept for abstracting of a hardware. It is desired that the concept should be convenient, clear, consistent, logical and pretty universal.
I find that when abstracting hardware, like any other abstraction,
it is useful and important to separate the construction/initialization
and mode selection from the abstract interface that is used during
most of the application life cycle.
To use a GPIO pin as an example, a bit-banging application can
generally perform two operations:
setHIGH()
setLOW()
The initialization, that selects mutiplexed function routing,
direction, open-drain operation and other configuration belongs
to another interface that is most likely not abstract.
IMHO, operations which are not available on a particular
piece of hardware should not appear in the abstraction
supported by that hardware. For example, a having the
ability to read the value of a GPIO at the pin or as
a read-back of the register associated with the pin.
Some GPIO implementations have one or the other and
some have both. Thus there are two possible operations:
bool readAtPin()
bool readPinRegister()
A GPIO implementation that supports only one of these
should not have the other available in its interface.
The result is there is no error condition if an application
calls an "unsupported" operation.
All of this falls under the "Interface Segregation Principle"
The result is several very narrow abstract interfaces rather
than a single abstract interface. Though this suggests MI,
composition is generally better suited for the implementation.
sorry about the long post
--
Michael N. Moran (h) 770 516 7918
5009 Old Field Ct. (c) 678 521 5460
Kennesaw, GA, USA 30144 http://mnmoran.org
"So often times it happens, that we live our lives in chains
and we never even know we have the key."
The Eagles, "Already Gone"
The Beatles were wrong: 1 & 1 & 1 is 1
.
- Follow-Ups:
- Re: Hardware Abstraction
- From: Vladimir Vassilevsky
- Re: Hardware Abstraction
- From: Arlet
- Re: Hardware Abstraction
- From: Rocky
- Re: Hardware Abstraction
- References:
- Hardware Abstraction
- From: Vladimir Vassilevsky
- Hardware Abstraction
- Prev by Date: Re: Embedded malloc (was: which object orient language is most suitable for embedded programming?)
- Next by Date: Re: interested in wombats
- Previous by thread: Re: Hardware Abstraction
- Next by thread: Re: Hardware Abstraction
- Index(es):
Relevant Pages
|