-
Data: 2009-10-19 22:31:45
Temat: Re: printf i wielozadaniowosc (MicroC/OS-II)
Od: "Pszemol" <P...@P...com> szukaj wiadomości tego autora
[ pokaż wszystkie nagłówki ]"Jerry1111" <j...@w...pl.pl.wp> wrote in message
news:ha0ka1$pnp$1@news.onet.pl...
>>> Zaciekawilo mnie (bo ja wiem ze Nios czasem przerywa sobie printfy - mi
>>> to nie przeszkadza) czemu tak sie dzieje. Popatrzylem na zrodla drivera
>>> uart w Nios 9.0 i tam nie ma OSIntExit pod koniec
>>> altera_avalon_uart_rxirq().
>>
>> rxirq() wołane jest z ogólnego handlera przerwania od portu
>> szeregowego gdzie jest sprawdzany status register i wywoływane
>> są poszczególne procedury skoku do txirq lub rxirq().
>
> Tak, ale nigdzie OS nie jest informowany ze aktualnie obslugujemy
> przerwanie... Na poczatku (AFAIR) ma byc OSIntEnter(), a na koncu ma byc
> OSIntExit(). Powinno to byc odpowiednio na poczatku/koncu ogolnego
> przerwania gdzie sprawdza status register - a nic tam nie ma. Jedyne
> odwolania do OSa w tx to flaga ze w txbuf jest miejsce.
Przy okazji innego problemu z innym projektem pod Niosem
wszedłem sobie debuggerem do kodu i co widzę? Ano INT_EXIT():
/*
* alt_irq_handler() is called by the interrupt exception handler in order
to
* process any outstanding interrupts.
*
* It is defined here since (in the case of nios2) it is linked in using
weak
* linkage. This means that if there is never a call to alt_irq_register()
* (above) then this function will not get linked in to the executable. This
is
* acceptable since if no handler is ever registered, then an interrupt can
never
* occur.
*
* If Nios II interrupt vector custom instruction exists, use it to
accelerate
* the dispatch of interrupt handlers. The Nios II interrupt vector custom
* instruction is present if the macro ALT_CI_INTERRUPT_VECTOR defined.
*/
void alt_irq_handler (void) __attribute__ ((section (".exceptions")));
void alt_irq_handler (void)
{
#ifdef ALT_CI_INTERRUPT_VECTOR
alt_32 offset;
char* alt_irq_base = (char*)alt_irq;
#else
alt_u32 active;
alt_u32 mask;
alt_u32 i;
#endif /* ALT_CI_INTERRUPT_VECTOR */
/*
* Notify the operating system that we are at interrupt level.
*/
ALT_OS_INT_ENTER();
#ifdef ALT_CI_INTERRUPT_VECTOR
/*
* Call the interrupt vector custom instruction using the
* ALT_CI_INTERRUPT_VECTOR macro.
* It returns the offset into the vector table of the lowest-valued
pending
* interrupt (corresponds to highest priority) or a negative value if
none.
* The custom instruction assumes that each table entry is eight bytes.
*/
while ((offset = ALT_CI_INTERRUPT_VECTOR) >= 0) {
struct ALT_IRQ_HANDLER* handler_entry =
(struct ALT_IRQ_HANDLER*)(alt_irq_base + offset);
handler_entry->handler(handler_entry->context, offset >> 3);
}
#else
/*
* Obtain from the interrupt controller a bit list of pending interrupts,
* and then process the highest priority interrupt. This process loops,
* loading the active interrupt list on each pass until alt_irq_pending()
* return zero.
*
* The maximum interrupt latency for the highest priority interrupt is
* reduced by finding out which interrupts are pending as late as
possible.
* Consider the case where the high priority interupt is asserted during
* the interrupt entry sequence for a lower priority interrupt to see why
* this is the case.
*/
active = alt_irq_pending ();
do
{
i = 0;
mask = 1;
/*
* Test each bit in turn looking for an active interrupt. Once one is
* found, the interrupt handler asigned by a call to alt_irq_register()
is
* called to clear the interrupt condition.
*/
do
{
if (active & mask)
{
alt_irq[i].handler(alt_irq[i].context, i);
break;
}
mask <<= 1;
i++;
} while (1);
active = alt_irq_pending ();
} while (active);
#endif /* ALT_CI_INTERRUPT_VECTOR */
/*
* Notify the operating system that interrupt processing is complete.
*/
ALT_OS_INT_EXIT();
}
Następne wpisy z tego wątku
- 21.10.09 20:18 Jerry1111
Najnowsze wątki z tej grupy
- Hiszpania bez pradu
- amperomierz w plusie
- 3G-nadal działa
- Historia pewnego miernika kalibratora
- Ustym 4k Pro i wyświetlacz
- Czemu rozwaliło celę?
- Wojna w portfelu
- Jaki trojfazowy licznik tuya lub podobny?
- Problem z dekoderem adresów
- Intel się wyprzedaje: po 10latach pchnęli pakiet kontrolny Altery za 1/4 kwoty zakupu
- Korekcja perspektywy
- Wentylator zabija zasilacze LEDek?
- Re: Kompensacja mocy biernej przy 230VAC
- Totaliztyczny obowiązek naprawy maszyn i urządzeń
- Niby uziom ale nie
Najnowsze wątki
- 2025-04-30 Szczecin => Key Account Manager IT <=
- 2025-04-30 Chiny => Koordynator Produkcji / Przedstawiciel ds. rozwoju produktu <
- 2025-04-30 Wrocław => Konsultant wdrożeniowy Comarch XL (Logistyka, WMS, Produk
- 2025-04-29 Nożownik zaatakował i zabił lekarza
- 2025-04-29 Polecam żarówki Blackout na Blackout z dużym gwintem
- 2025-04-29 Porażka kasty sędziowskiej przed Trybunałem Sprawiedliwości UE
- 2025-04-29 Kombinacja znaków A11 i B33?
- 2025-04-29 Na jakim etapie jest sprawa karna "gaśnicowego" Brauna z grudnia 2023?
- 2025-04-29 TSUE jest "przeciw a nawet za" neosędziami :-)
- 2025-04-29 Wrocław => Konsultant wdrożeniowy (systemy kontrolingowe) <=
- 2025-04-29 China => Production Coordinator / Representant Product Dev <=
- 2025-04-29 Warszawa => Specjalista rekrutacji IT <=
- 2025-04-28 Hiszpania bez pradu
- 2025-04-28 chinska stal
- 2025-04-28 QR kody