Skip to content

Instantly share code, notes, and snippets.

Created August 21, 2015 03:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/62055ccfbb2e18428a9c to your computer and use it in GitHub Desktop.
Save anonymous/62055ccfbb2e18428a9c to your computer and use it in GitHub Desktop.
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/kdev_t.h>
#include <linux/cdev.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/ipu.h>
#include <mach/io.h>
#include <asm/uaccess.h>
#include <mach/gpio.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
MODULE_LICENSE("Dual BSD/GPL");
void xxx_do_tasklet(unsigned long);
DECLARE_TASKLET(xxx_tasklet,xxx_do_tasklet, 0);
void xxx_do_tasklet(unsigned long i){
printk("I2\n");
}
irqreturn_t xxx_interrupt(int irq, void *dev_id){
printk("I1\n");
tasklet_schedule(&xxx_tasklet);
return 0;
}
static int hello_init(void){
int result;
int *PAD16_MUX,*GPIO3_ICR2,*GPIO3_IMR;
printk("T1\n");
PAD16_MUX = ioremap_nocache(0x020e00a0,4);
GPIO3_ICR2 = ioremap_nocache(0x020a4010,4);
GPIO3_IMR = ioremap_nocache(0x020a4014,4);
writel(0x00000005,PAD16_MUX );
writel(0x00000300,GPIO3_ICR2);
writel(0x00100000,GPIO3_IMR );
result = request_irq(103,xxx_interrupt,IRQF_DISABLED,"xxx","NULL");
printk("T2 = %x\n",result);
return 0;
}
static void hello_exit(void) {
printk(KERN_ALERT"Goodbye, Hello world\n");
}
module_init(hello_init);
module_exit(hello_exit);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment