renamed and led test
This commit is contained in:
23
README.md
23
README.md
@ -33,4 +33,27 @@ apt install build-essential raspberrypi-kernel-headers git
|
||||
```
|
||||
|
||||
|
||||
## Test LEDs:
|
||||
|
||||
|
||||
GPIO26 is red, GPIO21 is blue:
|
||||
|
||||
Blue on:
|
||||
```
|
||||
pinctrl set 21 op dh
|
||||
```
|
||||
|
||||
Blue off:
|
||||
```
|
||||
pinctrl set 21 op dl
|
||||
```
|
||||
|
||||
Red on:
|
||||
```
|
||||
pinctrl set 26 op dh
|
||||
```
|
||||
|
||||
Red off:
|
||||
```
|
||||
pinctrl set 26 op dl
|
||||
```
|
||||
|
@ -1,4 +1,4 @@
|
||||
obj-m += hello.o
|
||||
obj-m += counter.o
|
||||
|
||||
KDIR := /lib/modules/$(shell uname -r)/build
|
||||
PWD := $(shell pwd)
|
||||
|
21
driver/counter.c
Normal file
21
driver/counter.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
static int __init counter_init(void) {
|
||||
pr_info("counter: LKM loaded.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit counter_exit(void) {
|
||||
pr_info("counter: LKM unloaded.\n");
|
||||
}
|
||||
|
||||
module_init(counter_init);
|
||||
module_exit(counter_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Wolfgang Hottgenroth <wolfgang.hottgenroth@icloud.com>");
|
||||
MODULE_DESCRIPTION("LKM for MainsCnt counter module");
|
||||
MODULE_VERSION("0.1");
|
||||
|
@ -1,21 +0,0 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
static int __init hello_init(void) {
|
||||
pr_info("hello: Modul wurde geladen.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit hello_exit(void) {
|
||||
pr_info("hello: Modul wurde entladen.\n");
|
||||
}
|
||||
|
||||
module_init(hello_init);
|
||||
module_exit(hello_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Du");
|
||||
MODULE_DESCRIPTION("Minimales Kernelmodul-Beispiel");
|
||||
MODULE_VERSION("0.1");
|
||||
|
Reference in New Issue
Block a user