1843|0

1724

帖子

0

TA的资源

五彩晶圆(初级)

楼主
 

DSP C6000 中断中断程序解析 [复制链接]

/************************************main.c文件:********************************/


void main() 

            
           CSL_init();//CSL函数初始化 
 
           Htimer = TIMER_open(TIMER_DEV0,TIMER_OPEN_RESET);//打开定时器 0,返回定
时器句柄 
           TimerEventId = TIMER_getEventId(Htimer);//取得定时事件 ID 
           TIMER_config(Htimer,&Mtimer_configA);      //配置定时器 
 
           Hgpio  = GPIO_open(GPIO_DEV0,GPIO_OPEN_RESET);//打开 IO 
           GPIO_config(Hgpio,&Mgpio_config);//配置 IO 
 
           IRQ_setVecs(vectors);//重新设置中断向量, 
           IRQ_globalEnable();   //全局中断使能 
           IRQ_nmiEnable();  
           IRQ_map(TimerEventId,14);//把定时中断重新映射到 14 
           IRQ_reset(TimerEventId); 
           IRQ_enable(TimerEventId); // 
 
           TIMER_start(Htimer);           //定时开始 
 
    while(1);//死循环 
 
           TIMER_close(Htimer); 
           GPIO_close(Hgpio);


/********************************************************************** 
*  中断服务程序 
**********************************************************************/ 
interrupt void c_int14(void)//中断服务程序 

    if(flag==0) 
    { 
                GPIO_pinWrite(Hgpio,GPIO_PIN3,flag);  
                flag=1; 
           } 
           else 
           { 
                GPIO_pinWrite(Hgpio,GPIO_PIN3,1); //点灯 
                flag=0; 
           } 
}

/************************************Vectors.asm文件:********************************/


*------------------------------------------------------------------------------ 
* Global symbols defined here and exported out of this file 
*------------------------------------------------------------------------------ 
    .global _vectors//全局标号,可以在别处使用. 
    .global _c_int00 
    .global _vector1 
    .global _vector2 
    .global _vector3 
    .global _vector4 
    .global _vector5 
    .global _vector6 
    .global _vector7 
    .global _vector8 
    .global _vector9           
    .global _vector10   
    .global _vector11     
    .global _vector12   
    .global _vector13     
    .global _c_int14  ; Hookup the c_int14 ISR in main() 
    .global _vector15 
 
*------------------------------------------------------------------------------ 
* Global symbols referenced in this file but defined somewhere else.   
* Remember that your interrupt service routines need to be referenced here. 
*------------------------------------------------------------------------------ 
    .ref _c_int00//相当于 extern,在这里引用,在别处定义


*------------------------------------------------------------------------------ 
* This is a macro that instantiates one entry in the interrupt service table. 
*------------------------------------------------------------------------------ 
VEC_ENTRY .macro addr//定义中断向量入口地址 
 
    STW   B0,*--B15;保存B0 内容,中断产生后执行的第一条指令 
    MVKL  addr,B0; 
      MVKH  addr,B0;//把地址装入 B0 
    B     B0;跳转至 B0 中存储的地址 
    LDW   *B15++,B0;恢复B0内容; 由于C6000流水线的原因,跳转后仍然可以执行多条指                  
令 
    NOP   2 
    NOP    
    NOP    
    .endm 
 
 
*------------------------------------------------------------------------------ 
* This is a dummy interrupt service routine used to initialize the IST. 
*------------------------------------------------------------------------------ 
_vec_dummy:未定义中断服务程序 
  B     B3;其他没有定义的中断跳转至 B3 存储的地址 
  NOP  5 
 
*------------------------------------------------------------------------------ 
* This is the actual interrupt service table (IST). It is properly aligned and 
* is located in the subsection .text:vecs. This means if you don't explicitly 
* specify this section in your linker command file, it will default and link 
* into the .text section. Remember to set the ISTP register to point to this 
* table. 
*------------------------------------------------------------------------------ 
.sect ".text:vecs";定义段 
.align 1024;1024 字节对边界对齐 
 
_vectors: 
_vector0:    VEC_ENTRY _c_int00      ;RESET  跳转到_c_int00 ,_c_int00是 c语言程序的入口 
_vector1:    VEC_ENTRY _vec_dummy  ;NMI 
_vector2:    VEC_ENTRY _vec_dummy  ;RSVD 
_vector3:    VEC_ENTRY _vec_dummy ;  所有未定义中断均跳转到同一地址 
_vector4:    VEC_ENTRY _vec_dummy 
_vector5:    VEC_ENTRY _vec_dummy 
_vector6:    VEC_ENTRY _vec_dummy 
_vector7:    VEC_ENTRY _vec_dummy

_vector8:    VEC_ENTRY _vec_dummy 
_vector9:    VEC_ENTRY _vec_dummy 
_vector10:  VEC_ENTRY _vec_dummy 
_vector11:  VEC_ENTRY _vec_dummy 
_vector12:  VEC_ENTRY _vec_dummy 
_vector13:  VEC_ENTRY _vec_dummy 
_vector14:  VEC_ENTRY _c_int14  ; Hookup the c_int14 ISR in main()  定时中断中断向量 
_vector15:  VEC_ENTRY _vec_dummy 
 
*--------------------------------------------

点赞 关注
 

回复
举报
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条
立即报名 | 2025 瑞萨电子工业以太网技术日即将开启!
3月-4月 深圳、广州、北京、苏州、西安、上海 走进全国6城
2025瑞萨电子工业以太网技术巡回沙龙聚焦工业4.0核心需求,为工程师与企业决策者提供实时通信技术最佳解决方案。
预报从速,好礼等您拿~

查看 »

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

 
机器人开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表