Linux Step By Steps



The process of detecting individual pnp cards is part of the serial isolation process. Initially, all pnp cards have their csn, (card select number) reset to 0 with the following C psuedo code.

    outp(0x279,2);        // set the address (function) register to configuration control
    outp(0x2A9,4);      // reset all csn's to 0

ALL cards are then told to wakeup and respond to all commands

    outp(0x279,3);          // set the address (function) register to   wakeup
    outp(0x2A9,0);         // select logical board 0, ie ALL cards because all cards have a csn of 0

all cards are then told their common read address

    outp(0x279,0);       // select the 'set read port address'
    outp(0x2A9,some address>>2);  // tell all cards with a csn of zero to send data on this address

    outp(0x279,1);     // all cards are asked to return their serial number on the above address

Each card has a unique, 72 bit, serial number burnt into that card at time of manufacture.

The 72 bits consist of 8 bytes of encoded data, followed by an 8 bit checksum.

For any 'one bit', the card sends AA55 (two bytes) on the read address.
For any 'zero bit', the card sends nothing (tristate), but 'listens' instead.

In this way, all cards are initially responding, only the card with the most 'one bits' will be detected. Other cards, having a zero bit send nothing but detect that the read data bus has 0xAA55 on it. Since they did not do this, another card must have, and they stop responding and go back to sleep.

*In fact, the other cards are only looking at bits 0 and 1 of each byte sent to see if they are 10 and 01 respectively. (Meaning some other card is responding on the bus with a 'one bit' even though, they aren't).

1st Card  1x..........
2nd Card  11x1xx1x
Interface 11010010

The second card in the above example becomes logical card 1 with a csn of 1. The software assigns this value to this card with

    outp(0x279,6);        // set the csn function
    outp(0x2A9,1);      // set this card to csn 1

No other card will be affected, because, by this time, all other cards have gone back to sleep.

The process then repeats itself where all remaining cards (with a csn of zero) are woken up again, another card detected and an incremented value set in the csn.

Psuedo code would look like this

    reset_cards();     //reset all csns to 0.



for (ever)
    wake_up(0);    // all cards with a csn of 0
    if (read(sample_address,72))    set_csn(csn++);
        if (csn>1) break;  // all cards found at a specific read address

Once all cards have been 'isolated', eg their read port address and their csn set. The pnp interface will respond in a traditional manner. Ie the data read from the read port of a card is genuine 8 bit data, rather than pseudo serialised one bit words (0xAA55).