The Case for an Analog Hardware Abstraction Layer
<< Back to the Capstone Index.
This too is incomplete; I'll update eventually. :-)
TODO:
- Motivate the need for a HAL
- Discuss the proposal (below)
- Add the class-based discussion with Drew (via AIM)
- Add JAVA class proposal
- Toolkit Driver Architecture
Axes of Consideration
- Substrate - silicon, foam, jell-o
- Hardware version - EAC, uEAC, simulator
- Communication medium - Ethernet, serial, virtual
Existing HAL
Copied from an email to Drew.
I've got a few minutes, so I thought I'd conjecture about the proposed HAL for JEAC. I have a simple five-layer interface for my toolkit under source control for a different project: http://home.ryanvarick.com/svn/eac-toolkit/trunk/hardware.pm
The comments in there may be useful if you want to look through it. Here's the gist of things:
At the bottom layer is channel communication (serial, Ethernet).
Above that, basic sentence interaction (sending sentences and reading their responses). Successful commands should return the sentence, errors return the FxxxxxZ (or whatever it is). Reading a value involves the DxxxxxxZ sentence, I think. LLAs might be a special case -- returning their values instead of the original sentence... I don't remember.
Above that, we can begin to define useful abstractions, read_ and write_dac, to differentiate between sentence modes. At this level, we can get away from sentences altogether.
Now that we're at the level of individual connections (called DACs), we can define distinct commands -- read, source, sink, etc.
Finally, we have a meta-level, for things like read_sheet, etc.
Here's how my code defines thigns:
# Abstraction diagram: # # LEVEL FUNCTION NAME LAYER INFORMATION # ===== ============= ================= # # (5) reset_board some useful meta functions # (5) get_gradient # (5) report_lla # (5) report_chain # # (4) read_voltage, write_source command abstraction layer # (4) read_lla_input, write_sink # (4) read_lla_output, write_lla [*] # # (3) read_dac, write_dac basic hardware command layer # # (2) init_hardware # (2) write_command hardware communication layer # # (1) open/close_socket, # open/close_serial port communication channel layer #