--- Quote Start ---
Your next-to-last paragraph "My recommendation..." rings very true to me about the separation, but I can't quite picture the interface you describe (probably because I'm a HW guy and when you say "DLL or sockets" you're a little past me). Can you give me a little more, albeit still qualitative, idea of how this works? I mean, are we replacing system console with this "R/w server", or is the serrver talking to system console, and (either way), how?
--- Quote End ---
The implementation depends on how your GUI would work, but here's one option. Lets say you have a GUI developer that wants to write LabView, here's what you tell him.
1) LabView application with;
a) Monitor points, eg. LED states, DIP switch states, etc.
The LabView application connects to a monitor point server that sends a network packet every 0.5s. The contents of the network packet are the LED state, DIP switch state, etc. You would need to define a binary data format for this information, eg. all data is represented as 32-bit big endian integers.
The monitor points are displayed via GUI elements that to the user are effectively read-only, i.e., they are status GUI elements.
b) Control interface, with commands like, write to LEDs (and read to LEDs)
The labview application sends a binary data packet to the server, and that packet has the command type (an enumeration), followed by command arguments. The server responds with another binary packet containing eg., a status response, followed by any response data.
The control interface is displayed with GUI elements that are interactive, eg. push buttons, toggle switches, check buttons, etc.
2) System console Tcl server application, or NIOS server application
This is the actual interface to the hardware. You create a couple of server threads; one for the monitor server and another for the control server. The monitor server reads all the board status, packs it into the binary format expected by the clients, and then sends the packet every half second. The control servers waits for a command from a client, performs the action (eg. write to the LEDs register), and then sends a response (eg., status ok).
If this server was implemented using System console, the server parts would use Tcl's standard networking functions, the command implementations would use the Altera-specific commands to access the hardware, and then standard Tcl to respond to the labview application. Actually, I recall in Welch's Tcl book, an example where the client just sends Tcl command strings, and the Tcl server simple interprets those strings, eg., lets say your server implements the function 'led_write <value>' using Altera-specific JTAG commands. The LabView client can send a Tcl command string, eg. 'led_write 0x55', and the server can process that command, and then send back an empty string to the client as an acknowledge. In this case, the client-to-server communications for the control server uses ASCII (Tcl commands), not binary.
A fake version of the server can easily be created. The fake server can have an LED register state, fake monitor points generation, etc. You can have a monitor point indicating whether the simulator or real hardware is being accessed.
----
Why split things up like this?
For a start, it makes the software development, maintenance, and testing a lot easier. There is some complexity, in that you have to figure out networking and come up with a network communications protocol, but that knowledge is re-useable across all projects.
It also makes large system designs tractable. For example, I have a system with ~100 signal processing boards (containing ~1000 FPGAs), producing several thousand monitor points, eg. voltages, currents, temperatures, etc. You would not want to have to interactively ask for each monitor point, due to the communications overhead. Having each board send all monitor information every 0.5s makes for a much cleaner system design.
Some of this stuff is discussed in documents here:
http://www.ovro.caltech.edu/~dwh/correlator/cobra_docs.html (
http://www.ovro.caltech.edu/%7edwh/correlator/cobra_docs.html)
Cheers,
Dave