On November 28, 2004 04:23 am, Peter Svensson wrote:
> If there are several digium cards with 1kHz interrupts then maybe only one
> of them should be causing interrupts. The other cards could be serviced
> from within that handler. It does sound a bit tricky.

This is what I'm not getting; why it's tricky.

Say you have an ISR with a list of cards to service.  Normally the list has 
only one entry: the entry for its own card.

Now with two cards installed, the module init code would see the second card, 
disable the timer interrupt on the second and add card 2's address to the 
list of cards to service.

Something like (oversimplified I am sure):

Existing way:
init_card(void *card)
{
 enable_timer(card);
}

process_interrupt(void *card)
{
 process(card);
}



new way:

void *cardlist[MAX_CARDS];
static int n_cards = 0;

init_card(void *card)
{
 cardlist[n_cards++] = card;
 if(n_cards == 1)
  disable_timer(card)
 else
  enable_timer(card);
}

process_interrupt(void **cardlist)
{
 int i;
 void *card;

 for(i=0; i<n_cards; i++)
    {
    card = cardlist[i];
    process(card);
    }
}

_______________________________________________
Asterisk-Dev mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-dev
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to