avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] interrupt enable functions


From: Joerg Wunsch
Subject: [avr-libc-dev] interrupt enable functions
Date: Thu, 8 Aug 2002 00:09:28 +0200
User-agent: Mutt/1.2.5i

As Theodore A. Roth wrote:

> +/** \ingroup avr_interrupts
> +
> +    \code#include <interrupt.h>\endcode
> +
> +    This function gives access to the \c gimsk register (or \c eimsk register
> +    if using an AVR Mega device). Although this function is essentially the
> +    same as using the outb() function, it does adapt slightly to the type of
> +    device being used. */
> +
>  extern inline void enable_external_int (unsigned char ints)
>  {
>  #ifdef EIMSK
> @@ -45,6 +77,15 @@
>  #endif
>  #endif
>  }
> +
> +/** \ingroup avr_interrupts
> +
> +    \code#include <interrupt.h>\endcode
> +
> +     This function modifies the \c timsk register using the outb() function.
> +     The value you pass via \c ints is device specific.
> +
> +    [FIXME: example might be useful here.] */

While i've fixed Ted's FIXME item above, how do others feel about these
functions?  I don't value them much because they always clobber the
respective interrupt enable register completely, so when working with
more than one of each respective interrupt source (timer vs. external),
one has to manually keep track about which interrupt sources are
currently enabled.

IMHO, we should deprecate those interfaces, and write a real "enable/
disable one interrupt source" interface instead, like

timer_enable_int(int bit)
{
        TIMSK |= BV(bit);
}

timer_disable_int(int bit)
{
        TIMSK &= ~BV(bit);
}

Opinions?
-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]