⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frm.c

📁 硬件的cpu是arm920i2c总线和camera之间的连接驱动在嵌入式linux操作系统下编写
💻 C
字号:
#include <linux/kernel.h>#include <linux/module.h>#include <linux/compatmac.h>#include <linux/hdreg.h>#include <linux/vmalloc.h>#include <linux/fs.h>#include <linux/module.h>#include <linux/blkpg.h>#include <asm/irq.h>#include <asm/arch/hardware.h>#include <asm/arch/irqs.h>extern int sensorFrameCount;#define TIMER2_IRQ	58#ifndef U32typedef unsigned long U32;#endif#define MX1_TMR2_VA_VASE	(IO_ADDRESS(0x203000))#define _reg_TMR_TCTL2     (*((volatile U32 *)(MX1_TMR2_VA_VASE+0x00)))#define _reg_TMR_TPRER2    (*((volatile U32 *)(MX1_TMR2_VA_VASE+0x04)))#define _reg_TMR_TCMP2     (*((volatile U32 *)(MX1_TMR2_VA_VASE+0x08)))#define _reg_TMR_TSTAT2    (*((volatile U32 *)(MX1_TMR2_VA_VASE+0x14)))static void timer2_intr_handler(int irq, void *dev_id, struct pt_regs *regs){//	static int count=0;		if (_reg_TMR_TSTAT2)   	_reg_TMR_TSTAT2 = 0;    // clear interrupt		printk("Frame rate: %d\n", sensorFrameCount);	sensorFrameCount = 0;	   	//	printk("%d\n", count++);}int init_module(){	if (request_irq(TIMER2_IRQ, timer2_intr_handler, SA_INTERRUPT, "timer2", NULL))		printk("request_irq for timer2 failed !\n");	else		printk("request_irq for timer2 suceed :-)\n");   _reg_TMR_TPRER2 = 0;    	// divide by 1   _reg_TMR_TCMP2 = 32768;   	// 1 Hz for 32768 Hz souce   _reg_TMR_TCTL2 = 0x19;  	// compare intr, 32K source, enable timer		return 0;}void cleanup_module(){		free_irq(TIMER2_IRQ, NULL);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -