Homepage

  • Projekte
  • Shop
  • Forum
Erweiterte Suche
  • Schnellzugriff
    • Unbeantwortete Themen
    • Aktive Themen
    • Suche
  • FAQ
  • Anmelden
  • Registrieren
  • Foren-Übersicht
  • Suche

3Com interrupts

Projekt aus Elektor 2007
Antworten
  • Druckansicht
Erweiterte Suche
3 Beiträge • Seite 1 von 1
Spider

3Com interrupts

  • Zitieren

Beitrag von Spider » 19.01.2006, 17:39:48

I tryed to use 3c509b ISA card. Work fine but with out interrupts :(
May be you know how to enable interrupts in 3Com?

I find in datasheet next info:
set_read_zero_mask(0xFF); //P40 (6-8)
set_interrupt_mask(0xFF);
this must enable ALL interrupts from 3Com. But now work. My Network
card have IRQ9 (IRQ9 pin of ISA slot connected to INT0 pin of ATMega).

I hava add next lines to program source:

Networkcard_INT_Set();
Networkcard_INT_Enable();

SIGNAL(SIG_INTERRUPT0)
{
//Globale Interrupts Ausschalten
// cli ();
printf ("interrupt\n");
// sei ();
}

If I connect INT0 pin of ATMega to VCC program receive this interrupt.

Will 3Com work with interrupts?
Nach oben

Vilada

  • Zitieren

Beitrag von Vilada » 17.08.2006, 15:21:02

Great information
Nach oben

Werner B.

Hint for code modifications to use RX complete interrupt

  • Zitieren

Beitrag von Werner B. » 28.08.2006, 23:08:04

You need also to enable the coresponing interrupt on the ATmega.

Her is a snippet from my ATmega128 code

Add a global receive flag

Code: Alles auswählen

static volatile uint8_t packetIsWaiting = 0;
Just before returning from the init function add somthing linke this...

Code: Alles auswählen

      cli();
#if (NIC_INT < INT4)    // INTn generates an interrupt request
       DDRD  &= ~(1<<NIC_INT);  // input
       PORTD |=  (1<<NIC_INT);  // pullup on
       EICRA &= ~((1<<ISC_NICINT_1)|(1<<ISC_NICINT_0));
#else
       DDRE  &= ~(1<<NIC_INT);  // input
       PORTE |=  (1<<NIC_INT);  // pullup on
       EICRB |= ((1<<ISC_NICINT_0)|(1<<ISC_NICINT_0));
#endif
       EIMSK |= (1<<NIC_INT);      // Enable interrupt

       set_interrupt_mask(0x10);   // enable rx-complete interrupt
       sei();
The interrupt service routine

Code: Alles auswählen

void SIG_3c5x9NIC( void ) __attribute__ ( ( signal ) );
// #-#
void SIG_3c5x9NIC( void )
{
   uint8_t v = inportb31x( STATUS );      // Status

   if((v & (uint8_t)0x01)) // this nic rx complete
   {
        set_interrupt_mask(0);         // disable rx-complete interrupt
        EIMSK &= ~(1<<NIC_INT);  // disable interrupt
        ack_interrupt(0x01);
        if(v & (uint8_t)0x10)             // RX complete
        {
            packetIsWaiting++;
        }
        set_interrupt_mask(0x10);   // enable rx-complete interrupt
        EIMSK |= (1<<NIC_INT);     // Enable NIC interrupt
   }
}
And the packet poll function

Code: Alles auswählen

...
     EIMSK &= ~(1<<NIC_INT);       // Disable NIC interrupt
    if(packetIsWaiting == 0) {
        EIMSK |= (1<<NIC_INT);       // Enable NIC interrupt
        return;
    }
    packetIsWaiting--;
    // Reading the data from the NIC is a critical section that must not 
    // be interrupted/interleaved by another activity with the NIC.
    // This is why the NICs interrupt needs to be disabled during 
    //  ANY foreground interaction with the NIC
    // SURROUND ANY PUBLIC FUNCTION THAT INTERACTIONS WITH THE NIC
    // BY A DISABLE/ENABEL INTERRUPT
   ...
   Read the packet from the NIC and discard top packet
   ...
   // Enable RX complete interrupt
    rx_discard_top_packet(  );      // packet done !

    cli();
    {
       EIMSK |= (1<<NIC_INT);       // Enable interrupt
       set_interrupt_mask(0x10);    // enable rx-complete interrupt
    }
    sei();
}
To make the this more useful for you here are some of the defines i reference in the above code snippets

Code: Alles auswählen

#define NIC_INT       (INT6)
#if (__AVR_LIBC_VERSION__ < 10400UL)
#define SIG_3c5x9NIC  SIG_INTERRUPT6
#else
#define SIG_3c5x9NIC  INT6_vect
#endif

#define ISC_NICINT_1  (ISC61)
#define ISC_NICINT_0  (ISC60)
I hope this willhelp you

Werner
Nach oben

Antworten
  • Druckansicht

3 Beiträge • Seite 1 von 1

Zurück zu „AVR WebServer (alte Version)“



  • Foren-Übersicht
  • Alle Zeiten sind UTC+02:00
  • Alle Cookies löschen

Powered by phpBB® Forum Software © phpBB Limited

Deutsche Übersetzung durch phpBB.de

Datenschutz | Nutzungsbedingungen

 

 

sitemap  |    |  datenschutz   |  impressum