summaryrefslogtreecommitdiffstats
path: root/md/notes/kernel/irq_handler.md
blob: a4ce3cdd768ac9f0e0353d18703d2cfa8a89d2fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
title:IRQ handler
keywords:kernel,linux,irq

# IRQ handler

Lets extend hello world driver. 

## Starting point

__Makefile__
```Makefile
obj-m += procfs_entry.o

KDIR ?= /lib/modules/$(shell uname -r)/build

all:
	make -C $(KDIR) M=$(PWD) modules

clean:
	make -C $(KDIR) M=$(PWD) clean
```

__procfs_entry.c__
```c
#include <linux/module.h>  /* Needed by all modules */
#include <linux/kernel.h>

int procfs_entry_init( void )
{
	printk(KERN_DEBUG "Hello Procfs!\n");
	return 0;
}

void procfs_entry_exit( void )
{
	printk(KERN_DEBUG "Exit Procfs!\n");
}

module_init( procfs_entry_init );
module_exit( procfs_entry_exit );

MODULE_LICENSE("GPL");
```



## List of procfs functions used

| Function name | Note |
|---|---|
| proc_mkdir | Create procfs directory |
| proc_create | Create procfs file |
| proc_remove | Remove procfs entry |

## Final result



## Links