S3C6410 中斷例子程式

2021-06-16 23:49:55 字數 2599 閱讀 4270

eint0con0  external interrupt 0(group0) configuration register 0 

設定 外部中斷的觸發方式(高電平等)

eint0pend  external interrupt 0(group0) pending register  遮蔽前的中斷(誰中斷,相應位置1)

eint0mask  external interrupt 0(group0) mask register   遮蔽(遮蔽誰,相應位置1)

以上兩個是管腳級別(gpio)的pending和mask暫存器;

下邊是中斷控制器的pending和mask暫存器

vic0intenable  interrupt enable register (vic0)   //相當於mask暫存器

vic0irqstatus  irq status register (vic0)  相當與pending暫存器

程式**

main.c 

//led

#define gpkcon  (*(volatile unsigned int *)0x7f008800)

#define gpkdat  (*(volatile unsigned int *)0x7f008808)

//button

#define gpncon (*(volatile unsigned int *)0x7f008830)

#define gpndat  (*(volatile unsigned int *)0x7f008834)

//beep

#define gpfcon  (*(volatile unsigned int *)0x7f0080a0)

#define gpfdat  (*(volatile unsigned int *)0x7f0080a4)

//#define eint0con0  (*(volatile unsigned int *)0x7f008900)

#define eint0mask  (*(volatile unsigned int *)0x7f008920)

#define eint0pend  (*(volatile unsigned int *)0x7f008924)

//interrupt contruller

#define vic0irqstatus  (*(volatile unsigned int *)0x71200000)

#define vic0intenable  (*(volatile unsigned int *)0x71200010)

#define vic0rawintr  (*(volatile unsigned int *)0x71200008)

int led_init(void)

void led_value(int value)

void led_on(void)

void led_off(void)

void delay(void)

void led_blink(void)

void beep_init(void)

void beep_on(void)

void beep_off(void)

void beep(void)

void do_irq()

void irq_handler(void);

void test(void)

int mymain(void)

p = (int *)0x18;

*p = 0xe59ff000;

p = (int *)0x20;

*p = (int)irq_handler;

/*vic0vecaddr0 = beep1;

vic0vecaddr0 = beep2;

*/while(1)

led_value(counter & 0x0f);

counter++;

delay();

//if(gpndat & (1<<0))

// led_on();

//else

// led_off();

}return 0;

}start.s檔案

area int, code, readonly

import mymain

entry 

;sp_irq mode 

mov r0, #0xd2

msr cpsr_cxsf,r0

ldr sp, =0x50200000

;sp_svc mode 

mov r0, #0xd3

msr cpsr_cxsf, r0

ldr sp, =0x50100000

b mymain

import do_irq

export irq_handler 

irq_handler

;push rets to stack

stmfd sp!,   //r0-r12 和lr壓棧保護;

;handler

bl do_irq

;pop stack to regs

ldmfd sp!,

subs pc, lr,#4

end

S3C6410按鍵驅動 中斷方式

本文 cpp view plain copy include include include include include include include include include include include include include 新版核心 include include st...

S3C6410裸機中斷終於搞定了,

使用vic rel noopener noreferrer s3c6410裸機中斷終於搞定了,不需要彙編 使用vic 劍橋石 經過幾天的努力 終於搞定了 s3c6410 裸機中斷 測試使用的是外部中斷0組的 pn0,使用定時器0。之前一直很鬱悶的是網上的一些 s3c6410 使用的中斷都是像 51微...

s3c6410儲存器對映

1.引導映象區 0x0000 0000 0x07ff ffff 2.內部儲存區 1 內部rom 0x0800 0000 0x0bff ffff 2 內部sram 0x0c00 0000 0x0fff ffff 3.靜態儲存區 0x1000 0000 0x3fff ffff 4.動態儲存區 0x400...