hardware interface issues?

Dan Ingalls Dan.Ingalls at disney.com
Thu Aug 5 07:26:13 UTC 1999


>What does it take to write a device interface in Squeak? How does
>one talk to a serial port or a communications bus? I am not a hardware
>engineer, but I am curious as to what it would take.

John-Reed -

To answer your question by example, I suggest you look at how the serial port and midi dirvers were added to Squeak.  There are three levels:

Platform-dependent Level
See InterpreterSupportCode class >> macSerialAndMIDIPortFile.  This is the actual C code that implements the interfaces for these two drivers for the Macintosh.

VM Level (Platform-independent primitives)
See the methods in class Interpreter in the categories, 'serial port primitives' and 'midi primitives'.  These define the code for primitives 238-241 and 521-529 respectively (see Interpreter class >> initializePrimitiveTable).

Image Level
The corresponding code in the image can be immediately identified by the following two browse commands (execute them in a recent Squeak):
	Smalltalk browseAllSelect: [:m | m primitive between: 238 and: 241].
	Smalltalk browseAllSelect: [:m | m primitive between: 521 and: 529].
Each of these will open a browser on the primitive methods, from which it is easy to examine the various senders of each.

There is a more modular way to add drivers using named primitives, but the above should give you a realistic sense of what is involved.

Hope this helps

	- Dan





More information about the Squeak-dev mailing list