这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » 关于vector.c的问题

共8条 1/1 1 跳转至

关于vector.c的问题

助工
2011-06-17 15:23:55     打赏

/* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */
/* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */
/* ELIGIBILITY FOR ANY PURPOSES.                                             */
/*            (C) Fujitsu Microelectronics (Shanghai) Co., LTD.              */
/*---------------------------------------------------------------------------
  VECTORS.C
  - Interrupt level (priority) setting
  - Interrupt vector definition
  29.09.04  1.00   HWe    V30L29
-----------------------------------------------------------------------------*/

#include "mb95200.h"
/*---------------------------------------------------------------------------
   InitIrqLevels()

   This function  pre-sets all interrupt control registers. It can be used
   to set all interrupt priorities in static applications. If this file
   contains assignments to dedicated resources, verify  that the
   appropriate controller is used.

   NOTE: value 0xFF disables the interrupt and value 0 sets highest priority.
   NOTE: For all resource interrupts exists 3 Interrupt level registers (ILRx).
         Each register sets the level for 4 different resources (IRQx).
   NOTE: This list is prepared for the 8FX-emulation chip MB95FV100 'Horn'.
         Not all resources will be supported by all 8FX-devices
-----------------------------------------------------------------------------*/

void InitIrqLevels(void)
{
    ILR0 = 0xFF;      //  IRQ0:  external interrupt ch0 | ch4
                      //  IRQ1:  external interrupt ch1 | ch5
                      //  IRQ2:  external interrupt ch2 | ch6
                      //  IRQ3:  external interrupt ch3 | ch7

    ILR1 = 0xFF;      //  IRQ4:  UART/SIO ch0
                      //  IRQ5:  8/16-bit timer ch0 (lower)
                      //  IRQ6:  8/16-bit timer ch0 (upper)
                      //  IRQ7:  LIN-UART (reception)

    ILR2 = 0xFF;      //  IRQ8:  LIN-UART (transmission)
                      //  IRQ9:  8/16-bit PPG ch1 (lower) | UART/SIO ch1
                      //  IRQ10: 8/16-bit PPG ch1 (upper) | I2C ch1
                      //  IRQ11: 16-bit reload timer ch0

    ILR3 = 0xFF;      //  IRQ12: 8/16-bit PPG ch0 (upper)
                      //  IRQ13: 8/16-bit PPG ch0 (lower)
                      //  IRQ14: 8/16-bit timer ch1 (upper)
                      //  IRQ15: 16-bit PPG ch0 + ch2
                         
    ILR4 = 0xFF;      //  IRQ16: 16-bit reload timer ch1 | I2C ch0
                      //  IRQ17: 16-bit PPG ch1
                      //  IRQ18: 10-biat A/D-converter
                      //  IRQ19: Timebase timer
                         
    ILR5 = 0xFF;      //  IRQ20: Watch timer / counter
                      //  IRQ21: external interrupt ch 8-11 <<<--- Level 01
                      //  IRQ22: 8/16-bit timer ch1 (lower) | external interrupt ch 12-15
                      //  IRQ23: Flash | Custom ch1                          
}

/*---------------------------------------------------------------------------
   Prototypes
  
   Add your own prototypes here. Each vector definition needs is proto-
   type. Either do it here or include a header file containing them.
-----------------------------------------------------------------------------*/

__interrupt void DefaultIRQHandler (void);

/*---------------------------------------------------------------------------
   Vector definiton

   Use following statements to define vectors.
   All resource related vectors are predefined.
   Remaining software interrupts can be added hereas well.
-----------------------------------------------------------------------------*/

#pragma intvect DefaultIRQHandler 0   //  IRQ0:  external interrupt ch4
#pragma intvect DefaultIRQHandler 1   //  IRQ1:  external interrupt ch5
#pragma intvect DefaultIRQHandler 2   //  IRQ2:  external interrupt ch2 | ch6
#pragma intvect DefaultIRQHandler 3   //  IRQ3:  external interrupt ch3 | ch7
                                     
#pragma intvect DefaultIRQHandler 4   //  IRQ4:  UART/SIO ch0
#pragma intvect DefaultIRQHandler 5   //  IRQ5:  8/16-bit timer ch0 (lower)
#pragma intvect DefaultIRQHandler 6   //  IRQ6:  8/16-bit timer ch0 (upper)
#pragma intvect DefaultIRQHandler 7   //  IRQ7:  LIN-UART (reception)
                                     
#pragma intvect DefaultIRQHandler 8   //  IRQ8:  LIN-UART (transmission)      
#pragma intvect DefaultIRQHandler 9   //  IRQ9:  8/16-bit PPG ch1 (lower) | UART/SIO ch1
#pragma intvect DefaultIRQHandler 10  //  IRQ10: 8/16-bit PPG ch1 (upper) | I2C ch1
#pragma intvect DefaultIRQHandler 11  //  IRQ11: 16-bit reload timer ch0
                                     
#pragma intvect DefaultIRQHandler 12  //  IRQ12: 8/16-bit PPG ch0 (upper)
#pragma intvect DefaultIRQHandler 13  //  IRQ13: 8/16-bit PPG ch0 (lower)
#pragma intvect DefaultIRQHandler 14  //  IRQ14: 8/16-bit timer ch1 (upper)
#pragma intvect DefaultIRQHandler 15  //  IRQ15: 16-bit PPG ch0 + ch2
                                         
#pragma intvect DefaultIRQHandler 16  //  IRQ16: 16-bit reload timer ch1 | I2C ch0
#pragma intvect DefaultIRQHandler 17  //  IRQ17: 16-bit PPG ch1
#pragma intvect DefaultIRQHandler 18  //  IRQ18: 10-biat A/D-converter
#pragma intvect DefaultIRQHandler 19  //  IRQ19: Timebase timer
                                         
#pragma intvect DefaultIRQHandler 20  //  IRQ20: Watch timer / counter
#pragma intvect DefaultIRQHandler 21  //  IRQ21: external interrupt ch 8-11
#pragma intvect DefaultIRQHandler 22  //  IRQ22: 8/16-bit timer ch1 (lower)
#pragma intvect DefaultIRQHandler 23  //  IRQ23: Flash | Custom ch1   


__interrupt
void DefaultIRQHandler (void)
{
    __DI();             // disable interrupts(我想知道这句的定义在哪里?)
    while(1)
        __wait_nop();   // halt system
}




关键词: 关于     vector.c     问题     interrupt         

专家
2011-06-17 15:49:50     打赏
2楼
这个是碰到未知的错误是会产生一个未知中断,DI()就是关闭了现有的中断!

助工
2011-06-17 15:56:46     打赏
3楼

说实话不是太明白!我想知道它在什么地方定义的,还有它是怎么实现关闭所有中断的!谢谢!


专家
2011-06-17 16:15:36     打赏
4楼
它是扩充的C源代码,输出的汇编是:
AND  CCR, #191
功能说明:清零中断允许标志,从而禁止中断

下面的话你还会看见:__EI();
功能说明:置位中断允许标志,从而使能中断
输出汇编:
OR   CCR,#64

助工
2011-06-17 16:40:35     打赏
5楼
我怎么没找到了,你能告诉我在哪里吗?我自己看一下!谢谢!

专家
2011-06-17 16:57:31     打赏
6楼
你找不到的!你能看见的话是你进入仿真的时候就能看见汇编代码!!

它是富士通的C语言的一种扩充,你看不见的!!你了解就行了!!

助工
2011-06-17 17:05:32     打赏
7楼
好的,知道了。谢谢!

助工
2011-06-22 15:29:36     打赏
8楼
搜索看看富士通的手册之类的,有些类似于伪指令之类的是开发系统默认的,好像softune的帮助文档里也提到,不过英文的

共8条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]