DataMuseum.dk

Presents historical artifacts from the history of:

RC4000/8000/9000

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about RC4000/8000/9000

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦eb5b04044⟧ TextFile

    Length: 6912 (0x1b00)
    Types: TextFile
    Names: »tscpsk«

Derivation

└─⟦a41ae585a⟧ Bits:30001842 SW-save af projekt 1000, Alarm-system
    └─⟦72244f0ef⟧ 
        └─⟦this⟧ »tscpsk« 

TextFile

process tsconnector(
semvector: system_vector;
var inputsem, dcsem, lamsem, timeoutsem: semaphore;
lamchannelno: integer;
owntsmacro: macroaddr);
 
(*  function: this module establishes a connection between
              two RC3502 machines in the demonstration model *)

const
tsdatasize=52 (* no of bytes in data part of buffer from tss *);
tsbufsize= 64 (* no of bytes in buffer from tss *);
lambufsize= 259 (* no of bytes in byffer to lamdriver *);

type
statetype= (idle, wd , wrtr, wt, wack);
inputtype= (enq, data, out, here, rnr, nak, ack, rtr, lto, tto, nons);
 
messagetype= (* message to/from tss *)
record
allabel: alarmlabel;
data: array (1..tsdatasize) of byte;
end;
 
tsbuftype= (* message to/from tss *)
record
data: array (1..tsbufsize) of byte;
end;
 
lambuftype= (* message to/from lamdriver *)
record
stxt: char;
bll, opc: byte;
rec, send: alarmnetaddr; (*8 bytes*)
error_no, mess_type: byte;
data: array (1..lambufsize-16) of byte; (*243 bytes*)
etxt: char;
crc1, crc2: byte;
end;

createchtype= (* message format in createchannel operation *)
record
controlinfo, timeout: byte;
end;
 
staterow= array (inputtype) of statetype;
statetabletype= array (statetype) of staterow;
 
actionrow= array (inputtype) of integer;
actiontabletype= array (statetype) of actionrow;
 
const
statetable=
statetabletype(
(*               enq  data out  here rnr  nak  ack  rtr  lto  tto  nons *)
(*idle*)staterow(wd  ,idle,wrtr,idle,idle,idle,idle,idle,idle,idle,idle),
(*wd  *)staterow(wd  ,idle,wd  ,wd  ,wd  ,wd  ,wd  ,wd  ,wd  ,wd  ,wd  ),
(*wrtr*)staterow(wt  ,wrtr,wrtr,wrtr,wt  ,wrtr,wrtr,wack,wrtr,wrtr,wrtr),
(*wt  *)staterow(wd  ,wt  ,wt  ,wt  ,wt  ,wt  ,wt  ,wt  ,wt  ,wrtr,wt  ),
(*wack*)staterow(wack,wack,wack,wack,wack,wack,idle,wack,wack,wack,wack));
 
actiontable=
 actiontabletype(
(*                enq  data out  here rnr  nak  ack  rtr  lto  tto  nons *)
(*idle*)actionrow(  1,  10,   2,  14,  11,  11,  11,  11,   0,  15,  11),
(*wd  *)actionrow(  1,   3,   4,  14,  11,  11,  11,  11,  11,  15,   9),
(*wrtr*)actionrow(  7,  12,   4,  14,   5,  12,  12,   6,  12,  15,  12),
(*wt  *)actionrow(  1,  11,   4,  14,   0,  11,  11,  11,   0,  16,  11),
(*wack*)actionrow( 13,  13,   4,  14,  13,  13,   8,  13,  13,  15,  13));
 
tick1= 1; (* timeoutinterval for dcts *)
tick2= 5; (* timeoutinterval for the other ts *)
 
(* operation codes in protocol between tsconnectors *)
enqop= 0;
dataop= 1;
rtrop= 2;
rnrop= 3;
ackop= 4;
nakop= 5;


var
(*pools*)
dcpool:     pool 2 of messagetype;
lampool:    pool 2 of lambuftype;
updatepool: pool 1 of updates;
timerpool:  pool 1 of timers;
 
(*semaphores*)
listensem,
commandsem,
dcoutsem,
lamoutsem,
outsem,
timeoutanswer: semaphore;

(*references*)
commandref,
dataref,
dcref,
lamref,
listenref,
msg,
tim: reference;
 
(*zones*)
z: zone;
 
(*integers*)
tec,  (* transmission error count *)
outputtec, (* transmission error count for lam output *)
i,
action: integer;
 
(*booleans*)
checklamlisten: boolean; (* in normal case false; becomes true
after recreation of lamchannel caused by output status error *)
 
(*other variables*)
state: statetype;
input: inputtype;

(*forward*)
procedure getinputbuf;
forward;

function decodeinput (var ref: reference): inputtype;
(* decodes the inputtype of the buffer pointed to by "ref" *)
begin end;

procedure getcommand;
(* gets the next commandbuffer. Listen buffers arriving in the
meantime are sent to listensem *)
(* equivalent to getlisten *)
begin end;

function getinput: inputtype;
(* gets the next buffer to handle. The buffer is taken from either
commandsem or outsem depending on the state and the semaphores *)
begin end;

procedure getinputbuf;
(* gets a buffer from the inputsem and sends it to either
commandsem or listensem *)
begin end;

procedure getlisten;
(* waits until a listenbuffer arrives. Other buffertypes arriving
in the meantime are sent to the commandsem *)
begin end;

procedure sendop (opcode: integer);
(* gets and fills in lamoutputbuffer, sends it to lamdriver *)
begin end;

procedure sendtotss;
(* copies listenbuffer from lamdriver onto listenbuffer from tss
and returns tss listenbuffer *)
begin end;

procedure sendtodc;
(* copies listenbuffer from lamdriver onto dcoutputbuffer
and signals it to dc *)
begin end;

procedure to_tss_or_dc;
(* decides where to deliver buffer from lamdriver *)
begin end;

procedure sendlocal;
(* delivers a buffer from one local module (not lamdriver) to another *)
begin end;

(****************************
*                           *
*       main program        *
*                           *
****************************)

 
begin
state:= idle;


(*< create lamchannel >*)
 
(*< initialise output and listen buffers for lamdriver and dc_module >*)

(*< timeout booking >*)

repeat
input:= getinput;
action:= actiontable(state, input);
 
case action of 

0: (*no action *)
signal (commandref, lamsem);

1: (*send rtr*)
begin
sendop (rtrop);
signal (commandref, lamsem);
end;

2: (*send enq*)
begin
sendop (enqop);
dataref:=: commandref;
end;

3: (*send ack to lam and data to tss or dc*)
begin
to_tss_or_dc;
sendop (ackop);
signal (commandref, lamsem);
end;

4: (*output to outsem*)
signal (commandref, outsem);

5: (*send update to timer*)
begin
if owntsmacro= dc_ts (*i.e. this ts has dc_module *)
then timerupdate (msg, tick1)
else timerupdate (msg, tick2);
signal (commandref, lamsem);
end;

6: (*send data*)
begin
sendop (dataop);
signal (commandref, lamsem);
end;

7: (*send rnr and update timer*)
begin
sendop (rnrop);
signal (commandref, lamsem);
if owntsmacro= dc_ts
then timerupdate (msg, tick1)
else timerupdate (msg, tick2)
end;

8: (*no action*)
begin
signal (commandref, lamsem);
return (dataref);
end;

9: (*send nak*)
begin
tec:= tec + 1;
sendop (nakop);
signal (commandref, lamsem);
end;

10: (*send ack*)
begin
tec:= tec + 1;
sendop (ackop);
signal (commandref, lamsem);
end;

11: (*transmission error*)
begin
tec:= tec + 1;
signal (commandref, lamsem);
end;

12: (* transm. error - send enq *)
begin
tec:= tec + 1;
sendop (enqop);
signal (commandref, lamsem);
end;

13: (*transm. error - send data*)
begin
tec:= tec + 1;
sendop (dataop);
signal (commandref, lamsem);
end;
 
14: (*send data to local module*)
sendlocal;
 
15: timerbook (msg, tim, -1, netc_mic_addr);
 
16: (*timerbook and send enq*)
begin
timerbook (msg, tim, -1, netc_mic_addr);
sendop (enqop);
end;
 
end (* case *);
 
state:= statetable (state, input)
until false;
 
end.
▶EOF◀