7.1.1 Purpose of this Document
This document is addressed to system programmers. It specifies the recommended L3 conventions for communicating with IO drivers as well as for writing and installing them.
Important concepts of L3 are flexibility and extendability. In the field of hardware drivers this means that privileged users may replace and add IO drivers. (The only exception is the backing store (hard disk) driver, which belongs to the kernel itself.) So the protocols specified in this document are not enforcible, but they are strongly recommended to all people implementing driver software.
It is recommended to obey the conventions specified here not only in
hardware drivers but even when designing higher level software (if
possible and senseful).
7.1.2 Related Documents
7.1.3 Method of Description
7.2 The General Driver Protocol
Usually hardware drivers in L3 are realized as a set of
processes. Whether a driver consists of one, two or even more
processes depends on the type of device. The General Driver Protocol
(GDP) defines the communication between drivers and user or system
processes. It is strongly recommended that all drivers use this
protocol. If possible it should be used also by ,,high level drivers''. 7.2.1 Orders and Replies
The method to communicate with drivers is the usual L3 inter process communication. So orders are sent and results are received as messages. This chapter defines the various message types used by the GDP.
An order message always consists of an order code followed by additional parameters. In the same way a reply message starts with a reply code and may be followed by additional parameters. In general the additional parameters are objects of various types (e.g. blocks, strings, characters, bitmaps ...), coordinates (block numbers, screen positions ...) and mode specifiers (colour, font ...). The GDP has the protocol type number 1. So all GDP order codes have the form
The same convention holds for GDP specific reply codes.
7.2.2 Message Codes
In GDP the message code is always the first element of a message. This section defines the codes used for orders, interrogations and displays. The message code contains the addressed subchannel, the message type, the desired function and the type of the involved object:
The driver is free to handle the order in synchronuous way (like an 'in order') or in the early mode. In the second case the driver has to reply immmediately a time delay after which the data is supposed to be available. Following this reply the driver will initiate the data input operation. Some time later it will receive a new early in order concerning to the same object. If the data is available now, the driver has to send the data as reply, otherwise a new supposed time delay.
If the requested data is available within the driver, it has to send the data as reply, otherwise it must send a nil reply (without waiting for data).
Attention: There is no strict relationship between the error ack and the preceding early out operations. All between the last synchronuous operation and the error reply must be regarded as faulty.
Object types are grouped in a hierarchical fashion. The 12-bit object type specifier is structured as follows:
Currently four device classes are known in this list:
This table shows the tree of all actually defined object types with its codings. Codings not contained within this table are reserved for further extensions.
The format (representation) of an object may depend on the message type. So in the detailed object description the format is marked by I, O, R or any combination of them:
If any object format is not given for one of these cases, this object
type cannot be used in this context. 0x000 Nil Object
Format:
This object type specifies ,,no object''. It is used e.g in simple ack or nak replies, which do not include any object.
When used in conjunction with orders or alternate order requests it
has a special meaning (see [here]).
0x001 Time Delay
Format:
This specifies a supposed time period (in milliseconds) after which
the operation should be retried. This reply may come only as a result
to an early in order.
0x010 Error status
Format:
The error status always describes the result of the last operation. It is only valid after executing an order. The error status consists of 8 error bits and an error probability descriptor k:
Error bits:
Error probability:
Remark: GDP requires that each reply message contains the current
error status as an additional object, not specified in the object type
field of the GDP code. So the error status type 0x010 will never be
used within GDP messages. It is listed in this section for sstematic
reasons only.
0x011 Error Report
Format:
Format:
Format:
The 'exec in' function of this object signals the start of a broadcast sequence and 'exec out' function signals the end. Remark: This object is only used for internal communication between the terminal process and its manager.
0x030 System Restart
Format:
Signals a system restart.
Remark: This object is only used for internal communication between the
terminal process and its manager.
0x100 Byte String
Format:
The bytes are part of a sequential stream but do not form a closed object. So a byte string may be broken into smaller pieces or concatenated with other strings by the driver without changing the semantics. If a byte string should be read by an 'exec in', the driver has to wait until at least one byte is received. When using an 'exec early in' it has to respond immediately.
0x101 Datagram
Format:
A datagram is a string of bytes, which forms a closed semantical object. In contrast to byte strings, datagrams must always be handled as undivisible objects. If a datagram should be read by an 'exec in', the driver has to wait until a datagram is received. When using an 'exec early in' it has to respond immediately.
0x110 RS232 Transfer Mode Specifier
Format:
The baud rate is specified in bit per seconds. Parity is coded as
Format:
The line numbering refers to RS232. All 1-bits in line mask bits
AND line value bits specify lines with 1-polarity, all 1-bits in
line mask bits AND NOT line value bits specify lines with
0-polarity. All bits not set in line mask bits are undefined (reading)
or not affected (writing).
0x112 Break Event
Format:
No data representation of break event is needed.
0x113 RS232 Output Flow Control Specifier
Format:
The first two parameters may be used to implement output flow control based on signal lines (CTS, DCD,...). They specify the state of the incoming control lines required for output. The line numbering refers to RS232. All 1-bits in line mask bits AND line value bits specify lines with 1-polarity required, all 1-bits in line mask bits AND NOT line value bits specify lines with 0-polarity required. Otherwise the output will be blocked.
Xon code and xoff code may be used to implement XON/XOFF or similar output flow protocols. An incoming xoff will block the output channel, while the next incoming xon will unblock it. Initially after sending a flow control specifier the channel will be in the xon state. The value 0 is reserved.
xon code = xoff = 0 specifies ,,no xon/xoff protocol''. If an
xon/xoff protocol is switched on, these codes will not be transfered
by the corresponding input channel but only to control the output.
0x114 RS232 Input Flow Control Specifier
Format:
The first two parameters specify the state of the incoming control lines required for input. The line numbering refers to RS232. All 1-bits in line mask bits AND line value bits specify lines with 1-polarity required, all 1-bits in line mask bits AND NOT line value bits specify lines with 0-polarity required. Otherwise incoming data will be ignored. The third parameter specifies the size of the driver's input buffer for incoming bytes. 'buffer limit' specifies a limit for collecting input, i. e., if input received, the driver waits 10 ms, until no more input received or buffer limit is reached. Generally the initial value for buffer limit is buffer half. The last 3 parameters are reserved and must be 0 !
0x200 Block Sequence
Format:
This is the basic data object for all magnetic devices. The length of a block sequence must always be the actual block size (specified in the transfer mode) or a multiple of this value.
0x200 Block Sequence Ptr
Format:
This type of object is used for paging within the kernel and the backing store drivers only.
0x210 Floppy Disk Transfer Mode Specifier
Format:
The sector size is given in bytes.
0x211 Floppy Disk Media Type Specifier
Format:
,,Undefined media'' in an out operation means: Try to determine the
media actually in the floppy disk drive and take it as new media
type. If this succeeds, the answer has to be an ,,ack nil'' and the new
media type can be requested by an in operation. Else (no readable
diskette in the drive) the answer has to be an alternate out request.
0x300 Scan Ascii
Format:
The reply has the following Structure
STRUCT (BYTE ascii, scan, reseved1, reserved2) [scan ascii]
0x301 Key
Format:
The reply has the following Structure
STRUCT (BYTE ascii, scan,
shift state, extended shift state) [key]
0x302 Shift State
Format:
The reply has the following Structure
STRUCT (BYTE shift state, extended shift state,
reseved1, reserved2) [state]
0x303 Make Break
Format:
The reply has the following Structure
STRUCT (BYTE make break code,
reseved1, reserved2, reserved3) [make break]
STRUCT (BYTE ascii, scan,
shift state, extended shift state) [key]
Every make break code is sent, if it is detected. If no valid scan ascii could be derived from this make break code, the scan byte and the asci byte are set to 0xff.
0x304 Hot Key
Format:
Signals, that a hot key occured.
Remark: This object is only used for internal communication between the
terminal process and its manager.
0x305 Diacritical Flag
Format:
Sets a flag in the keyboard manager, which controls the consideration of diacritical chars.
0x400 Alpha8 (Attr, Char String)
Format:
Format:
Format:
Format:
Format:
The specified rectangle is filled by the fill char without changing the attributes.
0x405 Alpha8 (Char,Attr) Scroller
Format:
A positive scroll line value means ,,scroll up'', a negative one ,,scroll down'', zero has no effect. A scroller can be used to fill a rectangular region by specifying 'scroll lines' large enough.
0x406 Alpha8 Update String
Format:
This is a special object which can only be used in the context of the GDP/CSC. It is described in the CSC chapter.
0x407 Attribute Mode
Format:
Sets the background colour for the attributes with bit 7. If mode = 0, then background of the attributes with bit 7 is intensiv, and if mode = 1, it is blinking.
0x450 Beep
Format:
Sounds a beep.
0x451 Click
Format:
Sounds a mouse click.
0x452 Tone
Format:
Turns on the loudspeaker in the given frequency.
0x480 Screen Descriptor
Format:
Video mode and active page are defined. The alphanumeric modes are characterized by 'char width = char height = 1'. The 'mode' can be
Format:
Outputting a screen memory includes a complete refresh of the hardware screen from the screen space. From now on all screen modifications are also made within the screen space (usually an alias space).
0x482 Screen Page
Format:
Format:
By this a process can signal to the driver that it wants to write to the (aliased) screen space. Usually the driver will protect the displayed part of the screen space from writing. In such a case the user process may request direct write access, if its software wants to modify the screen memory by its own. If the driver acknowledges this request, it has removed the write protection from the addressed 4K page for some milliseconds. Afterwards the driver will analyze the changes by itself and update the hardware screen. (This is a nil action, if the screen space is directly mapped to hardware.)
0x484 Screen Palette Descriptor
Format:
This is used to defines colour palettes. Available palettes as well as palette registers are numbered from 0. The overscan register (if available) has the reg no -1.
0x485 Screen Palette Selector
Format:
Selecting the active palette.
0x486 Screen Hardware
Format:
display type:
available modes:
0x487 Screen Plane Selector
Format:
planes (bit 15..8): select plane for read (0..3) planes (bit 7..0) : select planes for write (0..15) IF bit (selected planes for write, n) THEN select plane 'n' FI
Remark: This object is only used for internal communication between
the display manager of the CONSOLE and its driver.
0x488 Screen EGA Palette Selector
Format:
palette selector: (bit 31..16): don't care (bit 15..8 ): register to set 0..15 <=> palette register no 0x 11 <=> overscan register (bit 7..0 ): value to set
Format:
color to set: 0..255 color descriptor : (bit 31..24): don't care (bit 23..16): blue value (0..63) (bit 15..8 ): green value (0..63) (bit 7..0 ): red value (0..63)
Format:
mode: 0..3: read/write dac-register 0: 0.. 63 (n = 192) 1: 64..127 (n = 192) 2: 128..191 (n = 192) 3: 192..255 (n = 192) 4: read/write attribut controller registers, graphik controller registers, sequencer registers; (n = 37)
Remark: This object is only used for internal communication between
the display manager of the CONSOLE and its driver.
0x48b Screen Activate
Format:
Format:
Format:
Cursor number 0 is the alphanumeric cursor, 1 identifies the mouse. The following cursor shapes are defined:
0 no visible cursor n defined by bitmap n (0 < n < 65536) 0x1ttbb line cursor (bottom line = bb, top line = tt)
The following cursor modes are defined:
0 overwriting 1 overwriting, blinking 2 reversing 3 reversing, blinking
Format:
Format:
In or out orders containing the nil object have a special meaning. ,,In nil'' is defined as open, ,,out nil'' as close. ,,Out nil'' is also used as interrogation reply to denote a nonexistent operation.
Most drivers will obey the Link Protocol (see ???) to prevent against unautorized access. The drivers reactions in this context are defined by the following rules:
Remark: In most cases a new partner will require a new open operation.
On the other side the processes calling the driver (e.g. as sysin or sysout partner) should use the following algorithm:
call (partner, gdp order, result, reply) ; WHILE result = prc not existing COR reply = invalid partner REP partner := partner (link no) ; call (partner, gdp order, result, reply) PER
Of course 'partner' should be initialized to 'nilprc'.