libpruio
0.2
Input/Output driver for digital/analog lines on Beagleboard hardware
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
dts_custom.bas
Go to the documentation of this file.
1
/'* \file dts_custom.bas
2
\brief Tool to create, compile and install a customized device tree overlay for libpruio.
3
4
This is a helper tool for an customized device tree overlay with fixed
5
pin configurations. Adapt this FB source code, compile it and run the
6
executable. This will create a device tree overlay source file in the
7
current directory, and, if you execute the binary with root privileges,
8
this overlay gets compiled and installed in /lib/firmware.
9
10
The customized overlay provides fixed pinmuxing configurations. The
11
libpruio code can get executed as normal user (no root privileges are
12
required). It claims only the configured header pins.
13
14
- to include a pin add a line like `M(P9_42) = CHR(0 + _I_)` (which
15
configures pin 42 at header P9 in mode 0 as input pin)
16
17
When done,
18
19
-# Compile the tool by `fbc -w all dts_custom.bas`.
20
21
-# Execute the binary without root privileges by `./dts_custom` to
22
control the generated source pruio_custom-0A00.dts, or
23
24
-# execute the binary with root privileges by `sudo ./dts_custom` to
25
install the compiled overlay in /lib/firmware.
26
27
The overlay source remains in the current folder (file
28
pruio_custom-0A00.dts). Load the overlay by
29
30
~~~{.sh}
31
sudo su
32
echo pruio_custom > /sys/devices/bone_capemgr.*/slots
33
exit
34
~~~
35
36
(Or execute the `echo ...` command in your boot sequence. Or use
37
capemgr to load the overlay. See \ref SecPreconditions for further
38
information.)
39
40
Licence: GPLv3
41
42
Copyright 2014 by Thomas{ dOt ]Freiherr[ At ]gmx[ DoT }net
43
44
45
Compile by:
46
47
fbc -w all dts_custom.bas
48
49
\since 0.2
50
'/
51
52
53
#INCLUDE ONCE
"
pruiotools.bas
"
54
55
'''''''''''''''''''''''''''''''''''''''''''''''''''''''' adapt this code
56
57
'* The file name.
58
#DEFINE
FILE_NAME
"pruio_custom"
59
'* The version.
60
#DEFINE
VERS_NAME
"00A0"
61
'* The folder to place the compiled overlay binary.
62
'#DEFINE PATH_NAME "/lib/firmware"
63
#DEFINE
PATH_NAME
"./"
64
65
' create settings for all required pins here
66
M
(P8_07) =
CHR
(7 + _I_)
' example: pin 7 at header P8 in mode 7 as input with pulldown resistor
67
68
M
(P9_42) =
CHR
(0 + _I_)
69
''''''''''''''''''''''''''''''''''''''''''''''''''''''' end of adaptions
70
71
72
VAR
fnam
=
FILE_NAME
&
"-"
&
VERS_NAME
, _
'*< The file name (without path / suffix)
73
fnr
=
FREEFILE
'*< The file number.
74
IF OPEN
(
fnam
&
".dts"
FOR OUTPUT
AS
fnr
)
THEN
75
'IF OPEN CONS(FOR OUTPUT AS #fnr) THEN
76
'?"failed openig console"
77
?
"failed writing file: "
&
fnam
&
".dts"
78
ELSE
79
PRINT
#fnr, ALL_START;
80
81
FOR
i
AS LONG
= 0
TO UBOUND
(
M
)
82
VAR
x
=
IIF
(
LEN
(
M
(
i
)),
nameBall
(
i
), 0)
'*< The header pin name.
83
IF
x
THEN PRINT
#fnr, ENTRY_EXCL(*
x
);
84
NEXT
85
86
PRINT
#fnr, FRAG0_START;
87
PRINT
#fnr, !
"\n "
&
FILE_NAME
&
": "
&
FILE_NAME
&
"_pins"
_
88
&
" {pinctrl-single,pins = <"
;
89
90
FOR
i
AS LONG
= 0
TO UBOUND
(
M
)
91
IF LEN
(
M
(
i
))
THEN PRINT
#fnr, f0custom(
i
);
92
NEXT
93
94
PRINT
#fnr, !
"\n >;};"
;
95
PRINT
#fnr, FRAG0_END;
96
PRINT
#fnr, ALL_END;
97
CLOSE
#fnr
98
99
SHELL
(
"dtc -@ -I dts -O dtb -o "
& PATH_NAME &
"/"
&
fnam
&
".dtbo "
&
fnam
&
".dts"
)
100
END IF
101
src
config
dts_custom.bas
Generated on Sun Oct 26 2014 16:53:02 for libpruio by
1.8.6