Skip to content

Commit 0cc450d

Browse files
committed
削除されたSPI関連の関数移植のためにCファイルの追加とMakefileの修正。
1 parent 4c54283 commit 0cc450d

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

src/drivers/Makefile.header_from_apt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
MODULE:= rtmouse
1+
MODULE:= rtmouse_mod
2+
DESIRED_MODULE:= rtmouse
23
obj-m:= $(MODULE).o
4+
$(MODULE)-objs := rtmouse.o spi_lib.o
35
clean-files:= *.o *.ko *.mod.[co] *~
46

57
LINUX_SRC_DIR:=/usr/src/linux-headers-$(shell uname -r)
68
VERBOSE:=0
79

8-
rtmouse.ko: rtmouse.c
10+
all:
911
make -C $(LINUX_SRC_DIR) M=$(shell pwd) V=$(VERBOSE) modules
12+
mv $(MODULE).ko $(DESIRED_MODULE).ko
1013

1114
clean:
1215
make -C $(LINUX_SRC_DIR) M=$(shell pwd) V=$(VERBOSE) clean
1316

14-
install: rtmouse.ko
17+
install: $(DESIRED_MODULE).ko
1518
cp ../../50-rtmouse.rules /etc/udev/rules.d/
1619

1720
uninstall:

src/drivers/rtmouse.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
// Raspberry Pi 2 B : 2
5252
// Raspberry Pi 3 B/A+/B+ : 2
5353
// Raspberry Pi 4 B : 4
54-
#define RASPBERRYPI 2
54+
#define RASPBERRYPI 4
5555

5656
MODULE_AUTHOR("RT Corporation");
5757
MODULE_LICENSE("GPL");
@@ -87,6 +87,10 @@ MODULE_DESCRIPTION("Raspberry Pi Mouse device driver");
8787

8888
#define DRIVER_NAME "rtmouse"
8989

90+
/* --- Declare External Functions --- */
91+
extern struct spi_controller *spi_busnum_to_master(int bus_num);
92+
93+
9094
/* --- Device Major and Minor Numbers --- */
9195
#define DEV_MAJOR 0
9296
#define DEV_MINOR 0
@@ -425,7 +429,7 @@ static int motor_motion_pop(t_motor_motion **ret)
425429

426430
if (motor_motion_tail == motor_motion_head) {
427431
return -1;
428-
}
432+
}/home/ubuntu/.ssh
429433

430434
if (next_head >= MAX_MOTORBUFLEN) {
431435
next_head = 0;

src/drivers/spi_lib.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
#include <linux/spi/spi.h>
3+
4+
5+
6+
struct spi_controller *spi_busnum_to_master(int bus_num)
7+
{
8+
// struct device *dev;
9+
struct spi_controller *ctlr = NULL;
10+
11+
// dev = class_find_device(&spi_master_class, NULL, &bus_num,
12+
// __spi_controller_match);
13+
// if (dev)
14+
// ctlr = container_of(dev, struct spi_controller, dev);
15+
// /* reference got in class_find_device */
16+
return ctlr;
17+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy