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

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

?? intc.c

?? freertosV4.40 是一種small的嵌入式系統。利于嵌入式開好者入門學習嵌入式操作系統。通過對于源碼的學習可以很好的掌握freertos的運行機制。
?? 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.
#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)];
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网站免费| 国产欧美综合在线观看第十页| 九一九一国产精品| 日韩你懂的电影在线观看| 三级欧美韩日大片在线看| 欧美亚洲精品一区| 亚洲图片自拍偷拍| 欧美亚洲国产bt| 亚洲精品中文在线观看| 9i在线看片成人免费| 中文字幕精品一区| www.性欧美| ...av二区三区久久精品| 不卡影院免费观看| 自拍偷自拍亚洲精品播放| av在线不卡电影| 中文字幕av资源一区| 成人av影院在线| 亚洲欧美激情小说另类| 在线免费亚洲电影| 偷拍自拍另类欧美| 777午夜精品免费视频| 日韩av中文字幕一区二区| 91精品国产入口在线| 日本人妖一区二区| 久久久高清一区二区三区| 国产不卡一区视频| 综合久久久久久| 欧美丝袜自拍制服另类| 午夜婷婷国产麻豆精品| 欧美一区二区视频在线观看2020| 美女脱光内衣内裤视频久久影院| 欧美一区二区精品在线| 国产另类ts人妖一区二区| 国产精品欧美精品| 在线观看欧美精品| 捆绑调教美女网站视频一区| 国产丝袜欧美中文另类| 91浏览器在线视频| 日韩不卡免费视频| 国产精品嫩草99a| 欧美日韩三级在线| 精品一区二区三区在线播放视频| 欧美国产日韩a欧美在线观看| 91在线视频官网| 蜜桃免费网站一区二区三区| 欧美国产日本视频| 欧美日韩国产首页| 国产99久久久国产精品潘金| 亚洲精品第1页| 精品成人一区二区| 在线区一区二视频| 国产成人亚洲综合a∨婷婷| 一区二区久久久久| 久久你懂得1024| 精品1区2区3区| 国产精品99久久久久| 亚洲一级二级三级| 亚洲国产精品二十页| 欧美老女人第四色| 成人av片在线观看| 久久综合综合久久综合| 一区二区三区四区高清精品免费观看| 日韩免费高清av| 色欧美乱欧美15图片| 国产乱码精品一区二区三区av | 色网站国产精品| 日韩国产欧美在线播放| ㊣最新国产の精品bt伙计久久| 日韩一二在线观看| 欧美三级在线看| 99精品欧美一区二区蜜桃免费| 麻豆精品一区二区| 亚洲成人av免费| 亚洲精品一二三区| 国产精品久久毛片| 久久精品视频免费| 在线播放中文字幕一区| 欧美日韩大陆一区二区| 色狠狠综合天天综合综合| 成人午夜短视频| 国产剧情一区在线| 色婷婷综合五月| 国产呦萝稀缺另类资源| 久久国产麻豆精品| 免费精品99久久国产综合精品| 亚洲成人午夜电影| 亚洲午夜久久久久| 一区二区三区在线观看动漫| 亚洲天堂网中文字| 国产精品久久久久一区| 国产亚洲短视频| 久久久午夜精品| 国产欧美一区二区精品性| 国产亚洲精品bt天堂精选| 久久综合久久综合九色| 精品欧美一区二区三区精品久久| 欧美日韩1区2区| 777亚洲妇女| 欧美一区午夜视频在线观看 | 91黄色免费版| 在线看国产一区| 欧美日韩日日骚| 91精品国产综合久久国产大片| 欧美日韩国产精选| 91精品国产欧美一区二区| 精品久久国产97色综合| 久久久精品免费网站| 国产精品电影一区二区| 亚洲欧美二区三区| 天天色综合天天| 精品在线一区二区三区| 国产精品996| 91原创在线视频| 欧美三级在线播放| 精品国产不卡一区二区三区| 国产偷国产偷亚洲高清人白洁 | 99精品久久99久久久久| 99re在线精品| 欧美高清www午色夜在线视频| 91精品久久久久久蜜臀| 2017欧美狠狠色| 亚洲视频资源在线| 视频在线在亚洲| 国产不卡在线一区| 欧美色精品在线视频| 日韩精品一区二区三区在线播放| 久久久精品免费免费| 一区二区三区日韩欧美精品| 丝袜亚洲另类丝袜在线| 国产精品一二三在| 欧美视频一区在线观看| 欧美成人aa大片| 亚洲欧美日韩国产一区二区三区 | 在线播放91灌醉迷j高跟美女 | 亚洲制服丝袜一区| 日韩福利视频导航| 不卡高清视频专区| 欧美成人精品福利| 亚洲精品大片www| 国产激情偷乱视频一区二区三区| 日本高清成人免费播放| 精品国偷自产国产一区| 亚洲欧美日韩综合aⅴ视频| 蜜臀av性久久久久av蜜臀妖精| av综合在线播放| 26uuu亚洲| 视频一区中文字幕国产| av亚洲精华国产精华精华 | 国产精品国产三级国产aⅴ入口| 亚瑟在线精品视频| 99re在线精品| 国产人久久人人人人爽| 高清shemale亚洲人妖| 91精品国产综合久久香蕉麻豆| 国产精品免费久久久久| 寂寞少妇一区二区三区| 欧美日韩不卡一区二区| 亚洲男帅同性gay1069| 丁香婷婷深情五月亚洲| 欧美精品一区在线观看| 日韩av电影天堂| 欧美日韩激情一区二区| 自拍av一区二区三区| 成人动漫在线一区| 中文天堂在线一区| 国产精品伊人色| 精品成a人在线观看| 蜜臀av亚洲一区中文字幕| 欧美日韩大陆在线| 亚洲第一搞黄网站| 欧美三级日韩三级| 亚洲一二三四区| 欧美最新大片在线看| 亚洲综合色区另类av| 色香色香欲天天天影视综合网| 国产精品成人免费| 成人黄色电影在线| 欧美激情在线观看视频免费| 国产一区二区在线影院| 国产亚洲精品福利| caoporn国产一区二区| 中文字幕一区视频| 色综合欧美在线视频区| 亚洲一区二区黄色| 91精品国产综合久久久久久|