-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
127 lines (100 loc) · 2.67 KB
/
Makefile
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#
# General setup
#
PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
SRC_DIR = src
INC_DIR = include
MODNAME = cdmx
MOD_UNITS := $(SRC_DIR)/cdmx.o $(SRC_DIR)/enttec.o $(SRC_DIR)/uart.o
obj-m += $(MODNAME).o
$(MODNAME)-objs := $(MOD_UNITS)
ccflags-y += -I$(PROJECT_ROOT)/include
#
# if have kernel with CONFIG_DYNAMIC_DEBUG_CORE
# or CONFIG_DYNAMIC_DEBUG enabled, next line is must-have.
#
# Without DYNDBG suport, messages will be lost, then
# comment out the line to use printk.
#
#ccflags-y += -DDYNAMIC_DEBUG_MODULE -DDEBUG
#
# With USE_SIMPLE_DYNDBG (module, file, line, time) fields
# are generated on-the-fly using dyndbg='+mflt' parameter.
# Otherwise they are hard-coded to message text.
#
#ccflags-y += -DUSE_SIMPLE_DYNDBG
# Line Discipline ID
CDMX_LD = 28
# UART tty that performs actual i/o
TEST_DEVICE = /dev/ttyAMA0
# Emulation device
TEST_CHRDEV = /dev/cdmx000
# Typical line from kernel manual, nothing changed
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
# Typical line from kernel manual, nothing changed
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
# Remove module
rm:
sudo rmmod $(MODNAME).ko
# Remove forced
rmf:
sudo rmmod -f $(MODNAME).ko
# Remove while OLA stopped
rmo:
sudo service olad stop
sudo rmmod -f $(MODNAME).ko
sudo service olad start
# Insert module with single port and dyndbg
in:
sudo insmod $(MODNAME).ko cdmx_port_count=1 dyndbg="+ptfml"
# Insert module
in4:
sudo insmod $(MODNAME).ko
# Log only kernel and cdmx messages
log:
sudo journalctl -f -o short-monotonic --no-hostname -tkernel -t$(MODNAME)
lo:
sudo journalctl -f -o short-monotonic --no-hostname
# Attach UART to CDMX
at:
sudo ldattach -d $(CDMX_LD) $(TEST_DEVICE)
# detach UART
de:
sudo killall ldattach
# Make-targets aliases
attach: at
detach: de
insert: in
remove: rm
#
# Various testing stuff
#
t3:
cat test/test.3.getparams >$(TEST_CHRDEV)
cat $(TEST_CHRDEV) | hexdump -C
t6:
cat test/test.6.senddmx >$(TEST_CHRDEV)
t6over:
cat test/test.6a.senddmx >$(TEST_CHRDEV)
cat test/test.6c.senddmx >$(TEST_CHRDEV)
t6under:
cat test/test.6a.senddmx >$(TEST_CHRDEV)
cat test/test.6d.senddmx >$(TEST_CHRDEV)
t10:
cat test/test.10.serial >$(TEST_CHRDEV)
cat $(TEST_CHRDEV) | hexdump -C
t77:
cat test/test.77.vendor >$(TEST_CHRDEV)
cat $(TEST_CHRDEV) | hexdump -C
t78:
cat test/test.78.getname >$(TEST_CHRDEV)
cat $(TEST_CHRDEV) | hexdump -C
ls:
sudo ls -lA /sys/devices/virtual/cdmx
sudo ls -lA /sys/class/cdmx
sudo ls -lA /sys/cdmx_p
sudo ls -lA /dev/cdmx*
################################################################################
################################################################################