libpruio
0.2
Input/Output driver for digital/analog lines on Beagleboard hardware
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
dts_universal.bas
Go to the documentation of this file.
1
/'* \file dts_universal.bas
2
\brief Tool to create, compile and install an universal device tree overlay for libpruio for run-time pinmuxing.
3
4
This is a helper tool for an universal device tree overlay. Adapt this
5
FB source code, compile it and run the executable. This will create a
6
device tree overlay source file in the current directory, and, if you
7
execute the binary with root privileges, this overlay gets compiled and
8
installed in /lib/firmware.
9
10
The universal overlay provides pinmuxing capability at run-time. Root
11
privileges are required to achieve this. It claims all header pins and
12
prepares configurations for all modes. By default the free header pins
13
on a Beaglebone Black are declared. Customizing can be done to include
14
more pins (ie. the HDMI pins when not used) or to reduce the number of
15
pins (ie. when they interfere with other capes).
16
17
- To include a pins group uncomment the matching `PIN_DEL(...)` line, or
18
19
- to drop a pin add a code line like `M(P8_08) = ""` right below the
20
`PIN_DEL(...)` lines.
21
22
When done,
23
24
-# compile the tool by `fbc -w all dts_universal.bas`, and
25
26
-# execute the binary with root privileges by `sudo ./dts_universal`
27
28
to install the compiled overlay in /lib/firmware. The overlay source
29
remains in the current folder (file libpruio-0A00.dts). Load the
30
overlay by
31
32
~~~{.sh}
33
sudo su
34
echo libpruio > /sys/devices/bone_capemgr.*/slots
35
exit
36
~~~
37
38
(Or execute the `echo ...` command in your boot sequence. Or use
39
capemgr to load the overlay. See \ref SecPreconditions for further
40
information.)
41
42
Licence: GPLv3
43
44
Copyright 2014 by Thomas{ dOt ]Freiherr[ At ]gmx[ DoT }net
45
46
47
Compile by:
48
49
fbc -w all dts_universal.bas
50
51
\since 0.2
52
'/
53
54
55
#INCLUDE ONCE
"
pruiotools.bas
"
56
57
'''''''''''''''''''''''''''''''''''''''''''''''''''''''' adapt this code
58
59
'* The file name.
60
#DEFINE
FILE_NAME
"libpruio"
61
'* The version.
62
#DEFINE
VERS_NAME
"00A0"
63
'* The folder to place the compiled overlay binary.
64
#DEFINE
PATH_NAME
"/lib/firmware"
65
66
' quick & dirty: first create settings for all pins ...
67
#INCLUDE ONCE
"
P8.bi
"
68
#INCLUDE ONCE
"
P9.bi
"
69
' ... then delete unwanted
70
PIN_DEL(HDMI_Pins)
71
PIN_DEL(EMMC2_Pins)
72
PIN_DEL(I2C1_Pins)
73
PIN_DEL(I2C2_Pins)
74
PIN_DEL(MCASP0_Pins)
75
76
''''''''''''''''''''''''''''''''''''''''''''''''''''''' end of adaptions
77
78
79
VAR
fnam
=
FILE_NAME
&
"-"
&
VERS_NAME
, _
'*< The file name (without path / suffix)
80
fnr
=
FREEFILE
'*< The file number.
81
IF OPEN
(
fnam
&
".dts"
FOR OUTPUT
AS
fnr
)
THEN
82
'IF OPEN CONS(FOR OUTPUT AS #fnr) THEN
83
'?"failed openig console"
84
?
"failed writing file: "
&
fnam
&
".dts"
85
ELSE
86
PRINT
#fnr, ALL_START;
87
88
FOR
i
AS LONG
= 0
TO UBOUND
(
M
)
89
VAR
x
=
IIF
(
LEN
(
M
(
i
)),
nameBall
(
i
), 0)
'*< The header pin name.
90
IF
x
THEN PRINT
#fnr, ENTRY_EXCL(*
x
);
91
NEXT
92
93
PRINT
#fnr, FRAG0_START;
94
95
FOR
i
AS LONG
= 0
TO UBOUND
(
M
)
96
IF LEN
(
M
(
i
))
THEN PRINT
#fnr, f0entry(
i
);
97
NEXT
98
99
PRINT
#fnr, FRAG0_END;
100
PRINT
#fnr, FRAG1_START;
101
102
FOR
i
AS LONG
= 0
TO UBOUND
(
M
)
103
IF LEN
(
M
(
i
))
THEN PRINT
#fnr, f1entry(
i
);
104
NEXT
105
106
PRINT
#fnr, FRAG1_END;
107
PRINT
#fnr, ALL_END;
108
CLOSE
#fnr
109
110
SHELL
(
"dtc -@ -I dts -O dtb -o "
& PATH_NAME &
"/"
&
fnam
&
".dtbo "
&
fnam
&
".dts"
)
111
END IF
112
src
config
dts_universal.bas
Generated on Sun Oct 26 2014 16:53:02 for libpruio by
1.8.6