新聞中心

EEPW首頁(yè) > 手機(jī)與無(wú)線通信 > 設(shè)計(jì)應(yīng)用 > 基于Web的MCF5249數(shù)據(jù)采集系統(tǒng)的設(shè)計(jì)

基于Web的MCF5249數(shù)據(jù)采集系統(tǒng)的設(shè)計(jì)

作者: 時(shí)間:2011-07-20 來(lái)源:網(wǎng)絡(luò) 收藏

#includelinux/interrupt.h>

#includeasm/irq.h>

#define ADC_IRQ(128+63)//定義中斷號(hào)

#define MBAR2_ADDR 0x8000000

#define AD_CONFIG 0x402

#define AD_VALUE 0x406

/*定義中斷處理函數(shù)*/

void adirq_interrupt(int irq,void *d,struct pt_regs *regs){

在此讀取A/D轉(zhuǎn)換的值并存入隊(duì)列中。

}

/*設(shè)備初始化函數(shù)*/

int adirq_init(){

int result;

unsigned short adc_irq;

adc_irq=ADC_IRQ;

result=request_irq(adc_irq,adirq_interrupt,SA_INTERRUPT,5249_adirq NULL);//注冊(cè)中斷

if(result= = -1)

{printk(“Can't get assigned %d”adc_irq);

return result;}

return 0;

}

中斷服務(wù)程序的添加方法如下:

①編輯uClinux/drivers/char目錄下的mem.c,添加“adirq_init();”;

②編輯此目錄下的Makefile加入“obj-y+=m5249_adirq.o”;

③編譯(make)。



評(píng)論


相關(guān)推薦

技術(shù)專(zhuān)區(qū)

關(guān)閉