-- Test Center Showcase -- D) ** "TEST FRAME" SOURCE CODE FOR BIT-ERROR-RATE TEST: The source codes to effect such efficient Test Frame implementation is listed as follows: When the station is playing the secondary role in Normal Response Mode (NRM) and an incoming frame is received, one normally checks the following: a) the CRC is correct b) the C/R bit is set c) the connection address is intended for this station If the incoming frame passes all these, one then examines the Control field and takes the appropriate action accordingly. This can be implemented as a chain of "if (...) {...}", "else if (...) {...}", ..., "else {...}". To implement the test frame option, one needs to add the following code to that chain: .............................................. else if (frame_buffer[1] == 0xF3) /* test frame + P bit received */ { frame_buffer[0] &= 0xFE; /* clear the C/R bit */ transmit (frame_buffer, incoming_size); /* bounce it back with C/R bit cleared */ } .............................................. The procedure "transmit(...)" calculates the CRC and sends the frame out. The very first bit in the frame buffer (i.e., the C/R bit) is changed, thus the outgoing CRC will be totally different from that of the incoming frame. ---------------------------------------------- The Test Frame is already an optional feature in both IrLAP 1.0 and IrLAP 1.1. For example the IrLAP 1.1 State Chart for Secondary Role State Machine, NRM(S) in Section 6.12.4.1, under: Current State = RECV Event = Recv u:test:cmd:P There are two alternative Actions. Alternative 1 is: Wait-Minimum-Turnaround-Delay send u:test:rsp:F Start-WD-timer And alternative 2 is: Wait-Minimum-Turnaround-Delay Send s:rr:rsp:Vr:F Start-WD-timer After either alternative Actions are taken, Next State = RECV We suggest to use alternative 1 instead of alternative 2. That is, respond with u:test:rsp:F, and not s:rr:rsp:Vr:F. |