How do transmit and receive parity operate on the CEI-x20 boards?

This simple test program executes internally-wrapped transmissions with various combinations of receive/transmit parity selected. The expected behavior for each test case is described in the comment block preceding each call to 'parity_loopback'.

Parity operation on CEI-x20 devices is straightforward. When odd transmit parity is selected, the value of the parity bit (bit 32) in the transmitted word is set by the hardware so that the parity of the entire 32-bit word becomes odd. That is, if the parity of bits 1-31 is odd (i.e., if there are an odd number of 'one' bits), the parity bit is set to zero. If the parity of bits 1-31 is even, the parity bit is set to one.

Similarly, when even transmit parity is selected, the value of the parity bit in the transmitted word is set by the hardware so that the parity of the entire 32-bit word becomes even.

When odd receiver parity is selected, the value of the parity bit in a received word is set to 0 by the hardware if the parity of bits 1-32 in the incoming word is odd, or 1 if the parity of bits 1-32 in the incoming word is even.

If transmit/receive parity is disabled, the value of the parity bit is passed through, unmodified by the hardware.

Download this example by clicking the link to the attached source file, 'parity.c'.