亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? intc.c

?? FreeRTOS is a portable, open source, mini Real Time Kernel - a free to download and royalty free RTO
?? C
字號:
/*This file is prepared for Doxygen automatic documentation generation.*/
/*! \file *********************************************************************
 *
 * \brief INTC driver for AVR32 UC3.
 *
 * AVR32 Interrupt Controller driver module.
 *
 * - Compiler:           IAR EWAVR32 and GNU GCC for AVR32
 * - Supported devices:  All AVR32 devices with an INTC module can be used.
 * - AppNote:
 *
 * \author               Atmel Corporation: http://www.atmel.com \n
 *                       Support and FAQ: http://support.atmel.no/
 *
 ******************************************************************************/

/* Copyright (c) 2007, Atmel Corporation All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * 3. The name of ATMEL may not be used to endorse or promote products derived
 * from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
 * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */


#include <avr32/io.h>
#include "compiler.h"
#include "preprocessor.h"
#include "intc.h"


//! Values to store in the interrupt priority registers for the various interrupt priority levels.
extern const unsigned int ipr_val[AVR32_INTC_NUM_INT_LEVELS];

//! Creates a table of interrupt line handlers per interrupt group in order to optimize RAM space.
//! Each line handler table contains a set of pointers to interrupt handlers.
#if __GNUC__
#define DECL_INT_LINE_HANDLER_TABLE(GRP, unused) \
static volatile __int_handler _int_line_handler_table_##GRP[Max(AVR32_INTC_NUM_IRQS_PER_GRP##GRP, 1)];
#elif __ICCAVR32__
#define DECL_INT_LINE_HANDLER_TABLE(GRP, unused) \
static volatile __no_init __int_handler _int_line_handler_table_##GRP[Max(AVR32_INTC_NUM_IRQS_PER_GRP##GRP, 1)];
#endif
MREPEAT(AVR32_INTC_NUM_INT_GRPS, DECL_INT_LINE_HANDLER_TABLE, ~);
#undef DECL_INT_LINE_HANDLER_TABLE

//! Table containing for each interrupt group the number of interrupt request
//! lines and a pointer to the table of interrupt line handlers.
static const struct
{
  unsigned int num_irqs;
  volatile __int_handler *_int_line_handler_table;
} _int_handler_table[AVR32_INTC_NUM_INT_GRPS] =
{
#define INSERT_INT_LINE_HANDLER_TABLE(GRP, unused) \
  {AVR32_INTC_NUM_IRQS_PER_GRP##GRP, _int_line_handler_table_##GRP},
  MREPEAT(AVR32_INTC_NUM_INT_GRPS, INSERT_INT_LINE_HANDLER_TABLE, ~)
#undef INSERT_INT_LINE_HANDLER_TABLE
};


/*! \brief Default interrupt handler.
 *
 * \note Taken and adapted from Newlib.
 */
#if __GNUC__
__attribute__((__interrupt__))
#elif __ICCAVR32__
__interrupt
#endif
static void _unhandled_interrupt(void)
{
  // Catch unregistered interrupts.
  while (TRUE);
}


/*! \brief Gets the interrupt handler of the current event at the \a int_lev
 *         interrupt priority level (called from exception.S).
 *
 * \param int_lev Interrupt priority level to handle.
 *
 * \return Interrupt handler to execute.
 *
 * \note Taken and adapted from Newlib.
 */
__int_handler _get_interrupt_handler(unsigned int int_lev)
{
  // ICR3 is mapped first, ICR0 last.
  // Code in exception.S puts int_lev in R12 which is used by AVR32-GCC to pass
  // a single argument to a function.
  unsigned int int_grp = (&AVR32_INTC.icr3)[INT3 - int_lev];
  unsigned int int_req = AVR32_INTC.irr[int_grp];

  // As an interrupt may disappear while it is being fetched by the CPU
  // (spurious interrupt caused by a delayed response from an MCU peripheral to
  // an interrupt flag clear or interrupt disable instruction), check if there
  // are remaining interrupt lines to process.
  // If a spurious interrupt occurs, the status register (SR) contains an
  // execution mode and interrupt level masks corresponding to a level 0
  // interrupt, whatever the interrupt priority level causing the spurious
  // event. This behavior has been chosen because a spurious interrupt has not
  // to be a priority one and because it may not cause any trouble to other
  // interrupts.
  // However, these spurious interrupts place the hardware in an unstable state
  // and could give problems in other/future versions of the CPU, so the
  // software has to be written so that they never occur. The only safe way of
  // achieving this is to always clear or disable peripheral interrupts with the
  // following sequence:
  // 1: Mask the interrupt in the CPU by setting GM (or IxM) in SR.
  // 2: Perform the bus access to the peripheral register that clears or
  //    disables the interrupt.
  // 3: Wait until the interrupt has actually been cleared or disabled by the
  //    peripheral. This is usually performed by reading from a register in the
  //    same peripheral (it DOES NOT have to be the same register that was
  //    accessed in step 2, but it MUST be in the same peripheral), what takes
  //    bus system latencies into account, but peripheral internal latencies
  //    (generally 0 cycle) also have to be considered.
  // 4: Unmask the interrupt in the CPU by clearing GM (or IxM) in SR.
  // Note that steps 1 and 4 are useless inside interrupt handlers as the
  // corresponding interrupt level is automatically masked by IxM (unless IxM is
  // explicitly cleared by the software).
  //
  // Get the right IRQ handler.
  //
  // If several interrupt lines are active in the group, the interrupt line with
  // the highest number is selected. This is to be coherent with the
  // prioritization of interrupt groups performed by the hardware interrupt
  // controller.
  //
  // If no handler has been registered for the pending interrupt,
  // _unhandled_interrupt will be selected thanks to the initialization of
  // _int_line_handler_table_x by INTC_init_interrupts.
  //
  // exception.S will provide the interrupt handler with a clean interrupt stack
  // frame, with nothing more pushed onto the stack. The interrupt handler must
  // manage the `rete' instruction, what can be done thanks to pure assembly,
  // inline assembly or the `__attribute__((__interrupt__))' C function
  // attribute.
  return (int_req) ? _int_handler_table[int_grp]._int_line_handler_table[32 - clz(int_req) - 1] : NULL;
}


void INTC_init_interrupts(void)
{
  unsigned int int_grp, int_req;

  // For all interrupt groups,
  for (int_grp = 0; int_grp < AVR32_INTC_NUM_INT_GRPS; int_grp++)
  {
    // For all interrupt request lines of each group,
    for (int_req = 0; int_req < _int_handler_table[int_grp].num_irqs; int_req++)
    {
      // Assign _unhandled_interrupt as default interrupt handler.
      _int_handler_table[int_grp]._int_line_handler_table[int_req] = &_unhandled_interrupt;
    }

    // Set the interrupt group priority register to its default value.
    // By default, all interrupt groups are linked to the interrupt priority
    // level 0 and to the interrupt vector _int0.
    AVR32_INTC.ipr[int_grp] = ipr_val[INT0];
  }
}


void INTC_register_interrupt(__int_handler handler, unsigned int irq, unsigned int int_lev)
{
  // Determine the group of the IRQ.
  unsigned int int_grp = irq / AVR32_INTC_MAX_NUM_IRQS_PER_GRP;

  // Store in _int_line_handler_table_x the pointer to the interrupt handler, so
  // that _get_interrupt_handler can retrieve it when the interrupt is vectored.
  _int_handler_table[int_grp]._int_line_handler_table[irq % AVR32_INTC_MAX_NUM_IRQS_PER_GRP] = handler;

  // Program the corresponding IPRX register to set the interrupt priority level
  // and the interrupt vector offset that will be fetched by the core interrupt
  // system.
  // NOTE: The _intx functions are intermediate assembly functions between the
  // core interrupt system and the user interrupt handler.
  AVR32_INTC.ipr[int_grp] = ipr_val[int_lev & (AVR32_INTC_IPR0_INTLEV_MASK >> AVR32_INTC_IPR0_INTLEV_OFFSET)];
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美自拍偷拍一区| 日韩美女视频在线| 日韩精品中文字幕一区 | 奇米影视一区二区三区| 国产精品一二二区| 色嗨嗨av一区二区三区| 精品国产乱码久久久久久久 | 亚洲综合色噜噜狠狠| 激情综合网av| 欧美高清性hdvideosex| 国产精品伦一区二区三级视频| 午夜在线成人av| 波多野结衣在线一区| 日韩一区二区三区视频| 亚洲视频一区在线| 国产在线播精品第三| 欧美福利一区二区| 一区二区三区在线观看网站| 国产精品主播直播| 日韩视频免费观看高清完整版在线观看| 中文字幕国产一区| 国产伦理精品不卡| 91精品国产综合久久久久| 自拍偷拍亚洲综合| 成人丝袜高跟foot| 国产偷v国产偷v亚洲高清| 日韩高清一区二区| 欧美日韩免费电影| 亚洲综合精品久久| 色婷婷久久久久swag精品| 国产精品伦一区二区三级视频| 久久国产尿小便嘘嘘| 日韩午夜在线影院| 日韩中文字幕区一区有砖一区| 色哟哟欧美精品| 亚洲女人的天堂| 99久久久久久| 成人欧美一区二区三区白人| 成人精品国产福利| 亚洲欧洲日韩av| 99re在线精品| 亚洲精品国产一区二区精华液| www.欧美.com| 亚洲精品菠萝久久久久久久| 91美女蜜桃在线| 亚洲一区在线播放| 欧美日韩美女一区二区| 日韩国产欧美一区二区三区| 欧美一区二区观看视频| 久久电影网电视剧免费观看| 久久亚洲欧美国产精品乐播| 国产精品一二三区| 中文字幕日韩一区| 色天天综合色天天久久| 亚洲国产你懂的| 日韩一本二本av| 国产成人在线视频网站| 国产精品美女久久久久av爽李琼| jizz一区二区| 午夜日韩在线电影| 久久综合九色欧美综合狠狠| 国产精品一卡二卡| 亚洲精品日日夜夜| 欧美一区二区福利在线| 国产精品1024| 一二三区精品福利视频| 日韩一区二区三区视频在线观看| 国产精品一区二区三区99| 亚洲欧洲精品一区二区三区| 欧美中文字幕久久| 国内精品久久久久影院色| 亚洲国产成人一区二区三区| 欧美视频一区二区三区四区| 久国产精品韩国三级视频| 1024国产精品| 日韩欧美视频在线| 成人av影院在线| 日韩av中文字幕一区二区三区| 国产午夜亚洲精品午夜鲁丝片 | 亚洲成av人片在线| xnxx国产精品| 欧美图片一区二区三区| 国产精华液一区二区三区| 一区二区不卡在线播放 | 秋霞午夜av一区二区三区| 国产日产欧美一区| 欧美三级乱人伦电影| 国产精品一线二线三线精华| 亚洲成av人片一区二区梦乃| 久久久蜜臀国产一区二区| 欧美三级电影精品| 9l国产精品久久久久麻豆| 另类成人小视频在线| 一区二区三区不卡视频在线观看 | 日一区二区三区| 中文字幕av一区二区三区免费看| 欧美一区二区免费视频| 91视频免费观看| 国产麻豆精品95视频| 日韩国产在线一| 亚洲资源中文字幕| 国产精品久久久久久久久图文区| 精品国产一区二区三区不卡| 欧美日免费三级在线| www.av精品| 国产精品69毛片高清亚洲| 美女久久久精品| 亚洲电影一级片| 一区二区激情视频| 亚洲男人天堂av| 1024国产精品| 自拍偷拍亚洲激情| 国产精品不卡在线观看| 国产偷国产偷亚洲高清人白洁| 日韩免费看的电影| 欧美一区二区三区播放老司机| 欧美三级在线播放| 欧美日韩午夜在线视频| 欧美午夜一区二区| 欧美日韩国产美| 欧美日韩aaaaaa| 欧美区视频在线观看| 精品视频资源站| 欧美日韩aaaaa| 在线不卡中文字幕| 欧美一区二区三区四区高清| 91精品福利在线一区二区三区| 欧美二区三区91| 制服丝袜av成人在线看| 欧美一区二区视频在线观看2020| 欧美高清一级片在线| 精品欧美久久久| 国产午夜精品理论片a级大结局| 久久久久国产精品厨房| 国产午夜一区二区三区| 自拍偷拍国产精品| 一区二区三区在线免费| 婷婷综合五月天| 久久疯狂做爰流白浆xx| 国产不卡视频一区二区三区| 大白屁股一区二区视频| 色综合色狠狠综合色| 欧美午夜免费电影| 91精品国产综合久久久久久漫画| 欧美一区二区女人| 国产欧美日韩在线| 亚洲日本在线a| 五月综合激情日本mⅴ| 老司机一区二区| 99久久婷婷国产综合精品| 欧美怡红院视频| 欧美精品一区男女天堂| 综合久久久久久| 日韩精品电影在线观看| 国产精品99久久久久久久女警| 99久久国产综合精品色伊| 欧美日韩日日骚| 久久久国产精品麻豆| 亚洲精品一二三| 狠狠色丁香婷综合久久| 色综合久久久久久久久久久| 欧美一区二区久久| 国产精品国产a| 看电影不卡的网站| 91网上在线视频| 精品国产a毛片| 亚洲专区一二三| 国产麻豆成人传媒免费观看| 欧美日韩一区二区三区高清| 国产日本亚洲高清| 视频一区二区欧美| 91免费观看在线| 337p日本欧洲亚洲大胆精品| 樱桃国产成人精品视频| 国产揄拍国内精品对白| 欧美日韩黄视频| 亚洲欧美中日韩| 国产在线精品一区二区不卡了| 欧美综合天天夜夜久久| 国产精品欧美久久久久无广告 | √…a在线天堂一区| 韩国av一区二区三区| 欧美日韩1234| 亚洲卡通动漫在线| 丁香激情综合五月| xfplay精品久久| 青草国产精品久久久久久| 欧美亚洲动漫制服丝袜| 亚洲国产激情av| 国产成人a级片| 久久夜色精品国产噜噜av| 日韩电影在线一区| 欧美日韩国产精选| 亚洲综合在线观看视频| 97精品久久久午夜一区二区三区 | 日本韩国欧美一区| 国产精品国产成人国产三级| 国产一区二区在线看| 日韩精品一区二区三区四区视频 | 欧美做爰猛烈大尺度电影无法无天|