|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 3786 (0xeca) Types: TextFile Notes: R1k Text-file segment
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦2bb2966dc⟧ └─⟦this⟧
with io_exceptions; use io_exceptions; with machine_types; use machine_types; with system; with UNCHECKED_CONVERSION; package body local_io_conf is -- Example implementation of local terminal I/O, stub version. -- The serial I/O code from the TDM configuration can be used -- to build an implementation of local_io that communicates with -- a terminal over an RS-232 connection. package serial_support is -- Borrowed from TDM configuration code. NOTE -- if TDM is being -- used, no implementation of local_io may be used that would attempt -- to do I/O over the same serial port on the target that TDM uses. procedure init; -- Does target hardware specific initializations including -- programming the serial I/O ports. procedure put(b: byte); -- Loops until the output port is ready. Then, puts the byte -- to the serial output device. procedure get(b: out byte; got_byte: out boolean); -- Gets a byte if one is available from the serial input device. -- -- NOTE: doesn't loop. Tests if input is available. If available, -- reads input byte and returns TRUE. Otherwise, returns FALSE -- immediately. The routine below that uses this procedure just -- tests 'got_byte' in a tight loop, so a version that waits for -- a character would work as well. The present procedure -- specification is used for compatibility with the TDM -- configuration code. end serial_support; package body serial_support is procedure init is -- Does target hardware specific initializations including programming -- the serial I/O ports. begin null; end; procedure put(b: byte) is -- Loops until the output port is ready. Then, puts the byte to the -- serial output device. begin null; end; procedure get(b: out byte; got_byte: out boolean) is -- Gets a byte if one is avaiable from the serial input device. -- -- NOTE: doesn't loop. Tests if input is available. If available, -- reads input byte and returns TRUE. Otherwise, returns FALSE -- immediately. begin null; end; end serial_support; procedure initialize( device: local_device_handle ) is begin if device = DEV0 then serial_support.init; else raise USE_ERROR; end if; end initialize; procedure shutdown( device: local_device_handle ) is begin null; end shutdown; procedure write_char(char: machine_types.byte) is -- Write a single character, mapping line-feeds begin serial_support.put(char); if char = machine_types.byte(character'pos(ascii.LF)) then serial_support.put(character'pos(ascii.CR)); end if; end write_char; procedure read( device: local_device_handle; addr: system.address; count: in out natural ) is -- any special character processing (e.g. backspace) -- could be done here...this version just reads the next -- character, changing CR into LF c, char: machine_types.byte; for char use at addr; got_char: boolean := FALSE; begin if device = DEV0 then if count > 0 then while not got_char loop serial_support.get(c, got_char); end loop; -- change CR into LF if c = byte(character'pos(ascii.cr)) then c := byte(character'pos(ascii.lf)); end if; -- echo the character write_char(c); char := c; count := 1; else count := 0; end if; else raise USE_ERROR; end if; end read; procedure write( device: local_device_handle; addr: system.address; count: in out natural ) is use machine_types; buf: array(1..count) of machine_types.byte; for buf use at addr; begin if device = DEV0 then for i in buf'range loop write_char(buf(i)); end loop; else raise USE_ERROR; end if; end write; end local_io_conf