SIR Coding
This topic discusses how IrDA miniport drivers or their infrared NICs code frames for transmission at Serial IrDA (SIR) link speeds. The SIR specification defines a short-range infrared asynchronous serial transmission mode with one start bit, eight data bits, and one stop bit. The maximum data rate is 115.2Kbps (half duplex). This SIR coding scheme is called Return-to-Zero-Inverted (RZI). The primary benefit of coding frames for SIR speeds is that existing serial hardware can be used very cheaply. The low cost of using serial hardware is one of the reasons for the widespread availability of infrared SIR devices.
The BOF flag for SIR speeds is defined as 0xC0. The EOF value is defined as 0xC1. To avoid ambiguity in a frame that contains BOF and EOF, an escape sequence is defined for values of 0xC0 and 0xC1 that occur in other parts of the frame. The escape character is defined as 0x7D.
For each byte that the transmitter encounters that is the same as a BOF, EOF, or the escape character, the transmitter performs the following steps:
Inserts a control-escape byte (0x7D) preceding such a byte.
Complements bit five of each byte that is the same as the BOF, EOF, or escape character. That is, performs an exclusive OR operation on such a byte with 0x20.
The IrDA miniport driver must compute the FCS member for the frame before the driver inserts any control escape bytes.
Before the FCS computation, the receiving station also examines the entire frame contents between the BOF and EOF values. The receiving station performs the following steps on each escape byte encountered:
Discards the escape byte.
Complements bit five of the byte following the escape byte.
The IrDA miniport driver calculates the FCS sequence for the frame using the address (A), control (C), and information (I) members. For SIR link speeds, the IrDA miniport driver typically calculates the CRC value rather than the driver's hardware. An algorithm for calculating the 16-bit CRC is available in publications Infrared Data Association Serial Infrared Physical Layer Link Specification and The Internet Working Group Request For Comments (RFC) 1171 available from IrDA.
For SIR link speeds, the IrDA miniport driver can also code a reject sequence in a packet. This reject sequence informs the infrared transceiver that receives such a packet to reject the packet. The reject sequence is 0x7D 0xC1.