PAM Programming Manual
Link-Level Programming Examples
PAM Programming Manual—142482
B-34
Testing the L2S Interface
Testing the L2S Interface
The following program tests all of the preceding code. The application program
establishes a working connection between itself and the L2S interface by opening the
PORT that connects the host system to the target LAN through TLAM.
?PAGE ’PROCEDURE: Test ( Main )’
{------------------------------------------------------------------
PROCEDURE: Test ( Main )
------------------------------------------------------------------}
BEGIN
Initialize;
Open_;
?IF SEND
Delay ( 200 );
?ELSE
cc := SetMode ( L2SAP_file_num, 18, SDU_cnt, -1 );
IF ( cc <> OK_Condition ) THEN
BEGIN
cc := FileInfo ( L2SAP_file_num, file_error );
WriteLn ( Output, ’DF SM Failed - Error: ’, file_error:4 );
AbEnd_;
END;
?ENDIF
start_time := JulianTimeStamp;
FOR loop_cnt := 1 TO number_of_loops DO
BEGIN
current_user_data_size_b := begin_user_data_size_b;
Aggr_SDUs_left :=
( end_user_data_size_B - begin_user_data_size_B + 1 );
REPEAT
WHILE Find_Free_Buffer ( buffer_lst_ndx ) AND
( current_user_data_size_b <= end_user_data_size_b ) DO
BEGIN
test_char := ( current_user_data_size_b MOD 256 );
?IF SEND
Send_ ( buffer_lst_ndx );
?ELSE
Receive_ ( buffer_lst_ndx );
?ENDIF
current_user_data_size_b := ( current_user_data_size_b + 1 );
pending_request_cnt := ( pending_request_cnt + 1 );
END;
IF ( pending_request_cnt > 0 ) THEN
BEGIN
cc := AwaitIOX ( L2SAP_file_num, , , buffer_lst_ndx, 3000 )
IF ( cc <> OK_Condition ) THEN
BEGIN
cc := FileInfo ( L2SAP_file_num, file_error );
WriteLn ( Output, ’AwaitIO error: ’, file_error:4 );
AbEnd_;
END;
?IF NOT SEND
Check_Inbound_Aggr_SDU ( buffer_lst_ndx );