|
|
DataMuseum.dkPresents historical artifacts from the history of: RC4000/8000/9000 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about RC4000/8000/9000 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 3840 (0xf00)
Types: TextFile
Names: »tssdok«
└─⟦a41ae585a⟧ Bits:30001842 SW-save af projekt 1000, Alarm-system
└─⟦72244f0ef⟧
└─⟦this⟧ »tssdok«
process tssuper ( tss_sem: semaphore );
const
(* options *)
maxmno = 2**4; (* 4 bits for messagenumber *)
maxnc = 2**12; (* 12 bits for nc,ts *)
prival (0..15):= 1,1,2,3,3,1,1,1,1,2,1,2,2,1,1,1;
maxprio = 3; (* max ( prival ) *)
fromtss = 10??; (* u3 for messages to netc *)
adrerror= 1*maxmno+1; (* op = (1.1) *)
errorhan= ?? (* dc-errorhandler microadr *)
at_limit= 256; (* routing by microadr *)
vc_limit= 8; (* routing by microadr *)
var
ts_macro : integer:= 0; (* dc-nc-ts *)
dc_running : boolean := false; (* controls log *)
msg_ready : integer := 0; (* controls wait on input_sem *)
procedure book ( kind: module; ticks: integer);
(* booking of a module_timeout at timeout *);
begin
end;
procedure update ( kind: module );
(* update tick_counter for a module at time_out *);
begin
end;
procedure module_time_out ( msg: reference; var result: integer);
(* for each different microadr do *)
begin
broadcast ( who, tsdown, receiver );
book ( kind, -1) again
end;
\f
procedure downwards ( msg: reference );
begin (* messages from net *)
if rec_maco <> ts_macro then
begin (* not for me *)
adrerror;
result:= empty
end else
begin (* macro ok *)
if xmt_dc <> owndc and dc_running then log ( msg);
if opcode member in config then start_lam ( msg );
route ( rec_micro, ath, vch, tss);
result:= ok
end;
end;
procedure upwards ( msg: reference ; var result: integer );
begin (* message from a handler *)
msg^.xmt_macro:= ts_macro;
if dc_running then log ( msg );
if rec_macro = ts_macro then route ( micro, tss, ath, vch )
else rec:= netc;
result:= ok
end;
procedure tss_function ( msg: reference ; var result: integer );
begin (* handle messages for the tss-supervisor *)
case functiongroup of
6: new_at ( msg);
7: new_vc ( msg);
9: newlam ( msg);
11: var_update ( msg);
12: watch ( msg)
otherwise (* do nothing *)
end; (* case *)
return ( msg );
end;
\f
begin (* main program *)
start ( timeout );
start ( bum );
start ( netcon); book ( netc, -1); send ( netc, read);
start ( athan ); book ( ath, -1); send ( ath, read);
start ( vchan ); book ( vch, -1); send ( vch, read);
book ( traffic, -1);
book ( ncs, -1);
repeat (* forever *)
while open ( tss_sem ) or ( msg_ready=0 ) do
begin (* take all messages and distribute to internal sem *)
wait ( msg, tss_sem); (* effective wait only if idle is true *)
if msg^.u3<> tim then send ( msg^.u3, read); (* distribute read-buffer *)
if msg^.opcode = lytte then return ( msg ) else
begin
idle:= false;
group:= msg^.opcode/maxmno; (* functiongroup decides priority *)
signal ( msg, mysem(prival(group)))
end
end;
(* find highest used priority *)
for p:= 1 to maxprio do
if open ( mysem(p)) then prio:= p;
wait ( msg, mysem(prio));
msg_ready:= msg_ready - 1;
case msg^.u3 of
fromtimer: module_timeout ( msg, result );
from_net: downwards ( msg, result );
otherwise upwards ( msg, result );
end;
case result of
dummy: ;
empty: return ( msg);
tss: tss_function ( msg );
vch: signal ( msg, vch_sem);
ath: signal ( msg, ath_sem);
netc: begin
signal ( msg, netc_sem);
update ( traffic)
end
end (* case *)
until forever
end .
▶EOF◀