1. Field of the Invention
The present invention relates to communication apparatus and more particularly relates to infrared communication apparatus designed to free up the local processor of computers or peripherals, for example either or both of a personal computer or a printer employing a local processor.
2. Description of Related Art
The Infrared Data Association (IRDA) was established to standardize communications between mobile devices. A family of specifications was developed by which computers and peripheral could be interconnected via a half duplex serial infrared physical link. IRDA's Serial Infrared Link Access Protocol (IRLAP) specifies the low-level data link layer protocol on which other protocols are based. IRLAP is an adaptation of existing'byte-based, synchronous serial protocols (HDLC and SDLC) to an asynchronous format. This asynchronous adaptation was chosen because of the established universal asynchronous receiver/transmitter (UART) chip sets used in personal computers worldwide. These serial devices can communicate by means of infrared (IR) pulses simply by the addition of an infrared modulator/demodulator (modem).
The IRLAP protocol uses the concept of a frame for asynchronous communications. In order to meet IRDA compliance, each frame must be constructed and passed a byte at a time to the UART for transmittal. Construction of a frame comprises four primary tasks:
1. The addition of beginning flag(s) (BOF's), marking the start of a frame. PA1 2. The special encoding of certain data bytes that otherwise would appear to be flags. This is known as transparency. A byte-stuffing technique is used in which data bytes that have the same value as a control or flag byte are replaced by special two-byte sequences. PA1 3. The addition of a 16-bit frame check sequence. This is calculated using the cyclic redundancy check (CRC.sup.1) to ensure data integrity. FNT .sup.1 A process or character used to check the integrity of a block of data. A CRC character is generated at the transmission end. It's value depends on the hexadecimal value of the number of 1's in data block, which the transmitting device calculates and appends to the data block. At the receiving end, if the calculation does not match an error message is sent back to the transmitter and the data is requested to be resent. PA1 4. The appending of an end of frame flag (EOF), marking the end of a frame. Upon reception of a frame, the receiving station must reconstruct the frame, ensure data integrity, and then pass the data to the higher layer protocols.
Since the byte transmit time for the UART is large when compared to the cycle times of personal computer microprocessors, it is very beneficial for the processor to handle transmission and reception in the background while the processor performs other tasks. This can be accomplished in one of two ways, The first is on an interrupt basis: the UART interrupts the processor when it can accept another byte or has a received byte available. The processor processes the byte and returns to its tasks. The second, and better method, is to employ direct memory access (DMA). The processor sets up a buffer in memory and either transmits the buffer or receives bytes into the buffer by means of a dedicated DMA controller. The UART signals the DMA controller when it has space or a byte available. DMA uses no processor power and only requires bus bandwidth to complete the task. It is possible, though difficult, for a transmitting station to build the entire frame in memory and send it to the UART via DMA. The same is not true for a receiving station. Because it is impossible to determine the exact length of a frame without parsing it (there is no fixed frame length or frame length included in the frame header in the IRLAP), there is no way to determine when an entire frame has been received if using DMA. The only solution is to poll the receive buffer, which eliminates the advantages DMA offers because it requires processor time.
In practice, the best solution currently available is to transmit and receive frame bytes based on interrupts. Flag insertion and transparency are handled within the interrupt routine, and frame check sequences are calculated as the bytes are transmitted and received. For the most part, this solution is acceptable for high-powered personal computers.
The solution is unacceptable, however, for lower cost peripherals, for example process bound laser printers. Infrared communication was chosen primarily for its low cost. For adapters to maintain such pricing, they must rely on lesser-powered microprocessors which may be easily overwhelmed by the enormous amount of IRLAP overhead. Even higher powered peripherals may not have the bandwidth available to properly service the infrared link layer. The processor must waste cycles handling frame construction and parsing, and has no DMA to assist in moving data bytes off the port. A better means of handling data link layer information is required.