kdb285: Using The Status Register With Xtreme/104 and DFlex

Title: Using The Status Register With Xtreme/104 and DFlex
Keywords: Status Register, DFlex, Xtreme
Date: August 2, 2002
KDB: KDB-285
Revision: 0.01
Author: MM
Distribution: External

The status port is a collection of all the INT signals from the UARTS. Data bit-0 is INT1, bit-1 is INT2, and so on up to bit-7 which is INT8.

The status port bits should reflect the state of all the INT signals. They are active high. An INT signal for any given port will NOT go inactive until ALL the interrupt “reasons” for that port have been processed. The ISR register (offset 2) must be read before any other register (when servicing an interrupt), or the INT signal will never operate as expected.

When using the INT status port, the sequence of code should be as follows:
Assuming an Intial State when all ports are inactive and the status port reads 0x00.

  1. INTerrupt occurs.
  2. Read Status port (obtain value “S”).
  3. For each bit set in “S” (scanned by whatever algorithm… sequential, or last port first, or most often used first, or whatever…as long as all bits are checked):
    • Read the ISR register of the appropriate port (obtain value “R”).
    • Take action appropriate for the “R” value obtained
  4. Repeat step 2 and 3 until S becomes 0x00.
  5. Exit handler.

Here’s the pseudo-code
do
{
S = status_port;
if (S == 0) // optional, bit is a fast way to exit when S== 0
break;
for (i=0; i<8; i++) // sequential scan
{
if (S & (1 << i))
{
R = ISR_register[i]; // some other code may be appropriate to select the port…pointers etc.
switch (R) // or some other selection method
{
case:
case:
case:
}
}
}
} while (S != 0);

End of KDB-285

Go to Top