PAM Programming Manual

Link-Level Programming Examples
PAM Programming Manual142482
B-12
Testing the L2S Interface
WHILE Find^Free^Buffer ( buffer^lst^ndx ) AND
( current^user^data^size^b <= end^user^data^size^b )
DO
BEGIN
test^char := $UDbl
( current^user^data^size^b ) ’\’ 256;
?IF 1
CALL Send^ ( buffer^lst^ndx );
?ENDIF 1
?IF 2
CALL Receive^ ( buffer^lst^ndx );
?ENDIF 2
current^user^data^size^b := current^user^data^size^b + 1;
pending^req^cnt := pending^req^cnt + 1;
END;
IF pending^req^cnt THEN
BEGIN
CALL AwaitIOX ( L2SAP^file^num, , ,
buffer^lst^ndx, 30000D );
IF <> THEN
BEGIN
CALL FileInfo ( L2SAP^file^num, file^error );
CALL Clear^Report^Buffer; report^buf^ptr ’:=’
[”AwaitIO error: “];
CALL NumOut ( report^buf^ptr[15],
file^error, 10, 4 );
CALL Write^Report^Buf^and^AbEnd;
END;
buffer^lst^ptr[ $Int ( buffer^lst^ndx ) ]
.in^use^flag := False;
buffer^lst^ptr[ $Int ( buffer^lst^ndx ) ]
.test^char := 0;
buffer^lst^ptr[ $Int ( buffer^lst^ndx ) ]
.user^data^size^b := 0;
pending^req^cnt := pending^req^cnt - 1;
Aggr^SDUs^left := Aggr^SDUs^left - 1;
END
END
UNTIL NOT Aggr^SDUs^left; loop^cnt := loop^cnt - 1;
END; -- WHILE loop^cnt
CALL Timestamp ( end^time );
delta^time := SubtractTriple ( end^time, start^time );
total^time[0] := 0;
total^time[1] := $High ( delta^time );
total^time[2] := $Int ( delta^time );
CALL ConTime ( date^time, total^time[0],
total^time[1], total^time[2] );
CALL Close^;
CALL Clear^Report^Buffer;
?IF 1
report^buf^ptr ’:=’ [”Send Complete. “];
?ENDIF 1
?IF 2
report^buf^ptr ’:=’ [”Receive Complete. “];
?ENDIF
report^buf^ptr[18] ’:=’ [”Elapsed time = “];
CALL NumOut ( report^buf^ptr[34], date^time[4], 10, 2 );
report^buf^ptr[36] ’:=’ [” Min “];
CALL NumOut ( report^buf^ptr[41], date^time[5], 10, 2 );
report^buf^ptr[43] ’:=’ [”.”];
CALL NumOut ( report^buf^ptr[44], date^time[6], 10, 2 );