-#include <kern/event.h>
-
-
-#if (ARCH & ARCH_EMUL)
-
- int Emul_IsBuzzerOn(void);
- void Emul_BuzzerOn(void);
- void Emul_BuzzerOff(void);
- void Emul_BuzzerInit(void);
-
- #define IS_BUZZER_ON (Emul_IsBuzzerOn())
- #define BUZZER_ON (Emul_BuzzerOn())
- #define BUZZER_OFF (Emul_BuzzerOff())
- #define BUZZER_INIT (Emul_BuzzerInit())
-
-#elif defined(__AVR__)
-
- #define IS_BUZZER_ON (PORTG & BV(PORTG0))
-
- /*!
- * Buzzer manipulation macros
- *
- * \note Some PORTG functions are being used from
- * interrupt code, so we must be careful to
- * avoid race conditions.
- */
- #define BUZZER_ON \
- do { \
- cpuflags_t _flags; \
- DISABLE_IRQSAVE(_flags); \
- PORTG |= BV(PORTG0); \
- ENABLE_IRQRESTORE(_flags); \
- } while (0)
-
- #define BUZZER_OFF \
- do { \
- cpuflags_t _flags; \
- DISABLE_IRQSAVE(_flags); \
- PORTG &= ~BV(PORTG0); \
- ENABLE_IRQRESTORE(_flags); \
- } while (0)
-
- #define BUZZER_INIT \
- do { \
- cpuflags_t _flags; \
- DISABLE_IRQSAVE(_flags); \
- PORTG &= ~BV(PORTG0); \
- DDRG |= BV(PORTG0); \
- ENABLE_IRQRESTORE(_flags); \
- } while (0)
-
-#elif defined(__IAR_SYSTEMS_ICC) || defined(__IAR_SYSTEMS_ICC__) /* 80C196 */
-
- #define IS_BUZZER_ON (cpld->Buzzer & 1)
- #define BUZZER_ON (cpld->Buzzer = 1)
- #define BUZZER_OFF (cpld->Buzzer = 0)
- #define BUZZER_INIT (cpld->Buzzer = 0)
-
-#endif /* ARCH, __AVR__, __IAR_SYSTEM_ICC */