1 |
/* Copyright (c) 2002, Marek Michalkiewicz |
/* Copyright (c) 2002,2005 Marek Michalkiewicz |
2 |
All rights reserved. |
All rights reserved. |
3 |
|
|
4 |
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
33 |
#ifndef _AVR_SIGNAL_H_ |
#ifndef _AVR_SIGNAL_H_ |
34 |
#define _AVR_SIGNAL_H_ |
#define _AVR_SIGNAL_H_ |
35 |
|
|
36 |
/** \name Macros for writing interrupt handler functions */ |
#warning "This header file is obsolete. Use <avr/interrupt.h>." |
|
|
|
|
/*@{*/ |
|
|
|
|
|
/** \def SIGNAL(signame) |
|
|
\ingroup avr_interrupts |
|
|
|
|
|
\code#include <avr/signal.h>\endcode |
|
|
|
|
|
Introduces an interrupt handler function that runs with global interrupts |
|
|
initially disabled. */ |
|
|
|
|
|
#ifdef __cplusplus |
|
|
#define SIGNAL(signame) \ |
|
|
extern "C" void signame(void); \ |
|
|
void signame (void) __attribute__ ((signal)); \ |
|
|
void signame (void) |
|
|
#else |
|
|
#define SIGNAL(signame) \ |
|
|
void signame (void) __attribute__ ((signal)); \ |
|
|
void signame (void) |
|
|
#endif |
|
|
|
|
|
/** \def INTERRUPT(signame) |
|
|
\ingroup avr_interrupts |
|
|
|
|
|
\code#include <avr/signal.h>\endcode |
|
|
|
|
|
\deprecated |
|
|
|
|
|
Introduces an interrupt handler function that runs with global interrupts |
|
|
initially enabled. This allows interrupt handlers to be interrupted. |
|
|
|
|
|
As this macro has been used by too many unsuspecting people in the |
|
|
past, it has been deprecated, and will be removed in a future |
|
|
version of the library. Users who want to legitimately re-enable |
|
|
interrupts in their interrupt handlers as quickly as possible are |
|
|
encouraged to explicitly declare their handlers as described |
|
|
\ref attr_interrupt "above". |
|
|
*/ |
|
|
|
|
|
#ifdef __cplusplus |
|
|
#define INTERRUPT(signame) \ |
|
|
extern "C" void signame(void); \ |
|
|
void signame (void) __attribute__ ((interrupt)); \ |
|
|
void signame (void) |
|
|
#else |
|
|
#define INTERRUPT(signame) \ |
|
|
void signame (void) __attribute__ ((interrupt)); \ |
|
|
void signame (void) |
|
|
#endif |
|
|
|
|
|
/** \def EMPTY_INTERRUPT(signame) |
|
|
\ingroup avr_interrupts |
|
|
|
|
|
\code#include <avr/signal.h>\endcode |
|
|
|
|
|
Defines an empty interrupt handler function. This will not generate |
|
|
any prolog or epilog code and will only return from the ISR. Do not |
|
|
define a function body as this will define it for you. |
|
|
Example: |
|
|
\code EMPTY_INTERRUPT(SIG_ADC);\endcode */ |
|
|
|
|
|
#ifdef __cplusplus |
|
|
#define EMPTY_INTERRUPT(signame) \ |
|
|
extern "C" void signame(void); \ |
|
|
void signame (void) __attribute__ ((naked)); \ |
|
|
void signame (void) { __asm__ __volatile__ ("reti" ::); } |
|
|
#else |
|
|
#define EMPTY_INTERRUPT(signame) \ |
|
|
void signame (void) __attribute__ ((naked)); \ |
|
|
void signame (void) { __asm__ __volatile__ ("reti" ::); } |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
/*@}*/ |
|
37 |
|
|
38 |
#endif /* _AVR_SIGNAL_H_ */ |
#endif /* _AVR_SIGNAL_H_ */ |