管理提醒: 本帖被 xoom 执行加亮操作(2011-05-14)
复制代码- 6410的向量中断模式给我们带来很多方便,我们可以不再使用软件来安排我的中断向量表
- 这次试验完全试验了在内存中跑的中断程序
- 1、初始化代码可以很简短:
- INCLUDE s3c6410.inc
- INCLUDE image_cfg.inc
- INCLUDE MemParam_mDDR.inc
- IMPORT _main ; C entrypoint for Steppingstone loader.
-
- ;------------------------------------------------------------------------------
- ;
- ; Memory Start Entry
- ;
- ; 内存里直接启动时入口
- ;
- ;------------------------------------------------------------------------------
- PRESERVE8 //因为我用的是rvds4,这句必不可少
- AREA Init, CODE, READONLY
- global MemStart
- ENTRY
- MemStart
- mrc p15,0,r0,c1,c0,0
- orr r0,r0,#(1<<24)
- mcr p15,0,r0,c1,c0,0
-
- b _main
- end
- 2、main.C:
- #include "utils.h"
- #include "s3c6410_addr.h"
- #include "interrupt.h"
- void key_init(void)
- {
- rGPNCON = rGPNCON & ~(0xff << 0) | (0xaa << 0);//eint
- rEINT0CON0 = rEINT0CON0 | (0x22 << 0);//both edge
- rEINT0MASK = rEINT0MASK & ~(0xf);
- }
- void key_isr(void) __irq
- {
-
- if(rEINT0PEND & 0x1)
- Uart_Printf("EINT0 is occurred\n");
- else if(rEINT0PEND & 0x2)
- Uart_Printf("EINT1 is occurred\n");
- else if(rEINT0PEND & 0x4)
- Uart_Printf("EINT2 is occurred\n");
- else if(rEINT0PEND & 0x8)
- Uart_Printf("EINT3 is occurred\n");
-
- //Uart_Printf("key interrupt occurred\n");
- rEINT0PEND &= ~(16);//以下两句我不是很明白,但毕竟它工作了
- INTC_ClearVectAddr();
- }
- void _main(void)
- {
- Uart_Init();
- Port_Init();
- key_init();
- INTC_Init();
- INTC_SetIntISR(0, key_isr);
- INTC_Enable(0);
- while(1);
- }
- 我用的tiny6410,光盘里面用说到用jlink来调试的开发文档附带了源代码,把头文件加上去就可以了
- ro_base:0x50000000 //代码基址
- fisrt =startup.o(Init) //程序入口
- 继续研究用key来控制等的亮暗,童鞋们也给点力吧,我很多不明白,需要大家的指点
|
[ 此帖被venkee.com在2011-06-21 23:11重新编辑 ]