intc.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
  2. /*This file is prepared for Doxygen automatic documentation generation.*/
  3. /*! \file *********************************************************************
  4. *
  5. * \brief INTC driver for AVR32 UC3.
  6. *
  7. * AVR32 Interrupt Controller driver module.
  8. *
  9. * - Compiler: IAR EWAVR32 and GNU GCC for AVR32
  10. * - Supported devices: All AVR32 devices with an INTC module can be used.
  11. * - AppNote:
  12. *
  13. * \author Atmel Corporation: http://www.atmel.com \n
  14. * Support and FAQ: http://support.atmel.no/
  15. *
  16. ******************************************************************************/
  17. /* Copyright (c) 2009 Atmel Corporation. All rights reserved.
  18. *
  19. * Redistribution and use in source and binary forms, with or without
  20. * modification, are permitted provided that the following conditions are met:
  21. *
  22. * 1. Redistributions of source code must retain the above copyright notice, this
  23. * list of conditions and the following disclaimer.
  24. *
  25. * 2. Redistributions in binary form must reproduce the above copyright notice,
  26. * this list of conditions and the following disclaimer in the documentation
  27. * and/or other materials provided with the distribution.
  28. *
  29. * 3. The name of Atmel may not be used to endorse or promote products derived
  30. * from this software without specific prior written permission.
  31. *
  32. * 4. This software may only be redistributed and used in connection with an Atmel
  33. * AVR product.
  34. *
  35. * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
  36. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  37. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
  38. * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
  39. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  40. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  41. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  42. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  43. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  44. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
  45. *
  46. */
  47. #ifndef _INTC_H_
  48. #define _INTC_H_
  49. #include "compiler.h"
  50. //! Maximal number of interrupt request lines per group.
  51. #define AVR32_INTC_MAX_NUM_IRQS_PER_GRP 32
  52. //! Number of interrupt priority levels.
  53. #define AVR32_INTC_NUM_INT_LEVELS (1 << AVR32_INTC_IPR_INTLEVEL_SIZE)
  54. #ifdef __AVR32_ABI_COMPILER__ // Automatically defined when compiling for AVR32, not when assembling.
  55. //! Pointer to interrupt handler.
  56. #if (defined __GNUC__)
  57. typedef void (*__int_handler)(void);
  58. #elif (defined __ICCAVR32__)
  59. typedef void (__interrupt *__int_handler)(void);
  60. #endif
  61. /*! \brief Initializes the hardware interrupt controller driver.
  62. *
  63. * \note Taken and adapted from Newlib.
  64. */
  65. extern void INTC_init_interrupts(void);
  66. /*! \brief Registers an interrupt handler.
  67. *
  68. * \param handler Interrupt handler to register.
  69. * \param irq IRQ of the interrupt handler to register.
  70. * \param int_level Interrupt priority level to assign to the group of this IRQ.
  71. *
  72. * \warning The interrupt handler must manage the `rete' instruction, what can
  73. * be done thanks to pure assembly, inline assembly or the
  74. * `__attribute__((__interrupt__))' C function attribute.
  75. *
  76. * \warning If several interrupt handlers of a same group are registered with
  77. * different priority levels, only the latest priority level set will
  78. * be effective.
  79. *
  80. * \note Taken and adapted from Newlib.
  81. */
  82. extern void INTC_register_interrupt(__int_handler handler, unsigned int irq, unsigned int int_level);
  83. #endif // __AVR32_ABI_COMPILER__
  84. #endif // _INTC_H_