[En-Nut-Discussion] Preview Fix 060626

Michael Jones Michael.e.Jones at web.de
Tue Jun 27 14:12:33 CEST 2006


Hi Harald,

Added the suggested changes.

I'll post my finding once my test results are conclusive.

Just one question: what does the "imr &= ~INT_RX_OVRN" do?

Cu,
Michael


-----Original Message-----
From: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] On Behalf Of Harald Kipp
Sent: Tuesday, June 27, 2006 1:31 PM
To: Ethernut User Chat (English)
Subject: RE: [En-Nut-Discussion] Preview Fix 060626

Michael,

At 13:00 27.06.2006 +0200, you wrote:

>Therefore, as far as I am concerned the driver is not the problem.

Adding one line to static void NicInterrupt(void *arg) in
arch/avr/dev/lanc111.c

     if (isr & INT_RX_OVRN) {
         imr &= ~INT_RX_OVRN; <------------ This line
         nic_outlb(NIC_ACK, INT_RX_OVRN);
         //nic_outlb(NIC_MMUCR, MMU_TOP);
     }

Replacing

     while (td) {
         qhp = (NUTTHREADINFO **)(td->td_queue);
         if (qhp) {
             cnt = 0;
             for (;;) {
                 NutEnterCritical();
                 cnt += td->td_qpec;
                 td->td_qpec = 0;
                 tqp = *qhp;
                 NutExitCritical();
                 if (cnt == 0 || tqp == SIGNALED) {
                     break;
                 }
                 NutEventPostAsync((HANDLE *)qhp);
                 cnt--;
             }
         }
         td = td->td_next;
     }

by

     while (td) {
         NutEnterCritical();
         cnt = td->td_qpec;
         NutExitCritical();
         if (cnt) {
             qhp = (NUTTHREADINFO **)(td->td_queue);
             NutEnterCritical();
             td->td_qpec--;
             tqp = *qhp;
             NutExitCritical();
             if (tqp != SIGNALED) {
                 NutEventPostAsync((HANDLE *)qhp);
             }
         }
         td = td->td_next;
     }

reduces the context switch. The idea behind this is, that only the
top of the queue needs to be activated.

This is contrary to the demand of alternating threads of the same
priority. However, in this special case it is acceptable.

Harald


_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion





More information about the En-Nut-Discussion mailing list