libpruio  0.6.8
Fast and easy Digital/Analog Input/Output for Beaglebones
pruiotools.bas File Reference

Common source code for the helper tools dts_custom.bas and dts_universal.bas. More...

Include dependency graph for pruiotools.bas:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PMUX_NAME   /* "pruio-" */
 The name of the pinmux folders in /sys/devices/ocp.* (must match the definition in pruio.bas).
 
#define ALL_START
 The start of the source file. More...
 
#define ENTRY_EXCL(_T_)   /* !"\n """ & _T_ & """," */
 An entry line for the exclusive-use = section.
 
#define ALL_END
 The end of the source file (pinmux setting). More...
 
#define FRAG0_START
 The start of fragment0 in the source file (pinmux settings). More...
 
#define FRAG0_END
 The end of fragment0 in the source file (pinmux settings). More...
 
#define FRAG1_START
 The start of fragment1 in the source file (pinmux_helper). More...
 
#define FRAG1_END
 The end of fragment1 in the source file (pinmux_helper). More...
 
#define CREATE()
 Macro creating the files.
 
#define GPIO_DEF
 The default settings for the GPIO modes. More...
 
#define PIN_DEL(_A_)   /* FOR i AS LONG = 0 TO UBOUND(_A_) : M(_A_(i)) = "" : NEXT */
 Macro to delete the pin configuration for a pin set array.
 

Typedefs

typedef UBYTE UInt8
 Type alias.
 

Enumerations

enum  PinModes {
  NP = &b001000 , PU = &b010000 , PD = &b000000 , RX = &b100000 ,
  _O_ = NP , _I_ = RX + PD , I_O = RX + NP , IOD = RX + NP ,
  TMRi = _I_ , TMRo = _O_ , CAPi = _I_ , CAPo = _O_ ,
  QEPi = IOD , QEPo = _O_ , PWMi = _I_ , PWMo = _O_
}
 Enumerators for pin modes. More...
 

Functions

FUNCTION_AS_STRING f0entry (BYVAL_AS_UBYTE I)
 Create lines for fragment@0 with all settings of a pin. More...
 
FUNCTION_AS_STRING f1entry (BYVAL_AS_UBYTE I)
 Create lines for fragment@0 with all settings of a pin. More...
 
FUNCTION_CDECL_AS_ZSTRING_PTR nameBall (BYVAL_AS_UBYTE Ball)
 Get header pin connected to CPU ball. More...
 

Variables

STRING M [109+1]
 The array to be filled with modus settings for all pins.
 
STRING USER_ADD_ON
 A variable to add user fragments (starting at fragment@3 {}), in order to enable subsystems.
 
LONG MULTI_FLAG = 0
 The flag for multiple settings.
 

Detailed Description

Common source code for the helper tools dts_custom.bas and dts_universal.bas.

This file contains common source code used by the device tree overlay helper tools dts_custom.bas and dts_universal.bas. Do not edit (experts only).

Licence: GPLv3

Copyright 2014-2023 by Thomas{ doT ]Freiherr[ At ]gmx[ DoT }net

Since
0.2

Definition in file pruiotools.bas.

Macro Definition Documentation

◆ ALL_END

#define ALL_END
Value:
/* _
!"\n fragment@2 {" _
!"\n target = <&pruss>;" _
!"\n __overlay__ {" _
!"\n status = ""okay"";"_
!"\n };" _
!"\n };" _
& USER_ADD_ON & _
!"\n };" */

The end of the source file (pinmux setting).

Definition at line 37 of file pruiotools.bas.

◆ ALL_START

#define ALL_START
Value:
/* _
"// dts file auto generated by pruio_config (don't edit)" _
!"\n/dts-v1/;" _
!"\n/plugin/;" _
!"\n" _
!"\n/ {" _
!"\n compatible = " & COMPATIBL & """ti,beaglebone"";" _
!"\n" _
!"\n // identification" _
!"\n board-name = """ & FILE_NAME & """;" _
!"\n manufacturer = ""TJF"";" _
!"\n part-number = ""PruIoBBB"";" _
!"\n version = """ & VERS_NAME & """;" _
!"\n" _
!"\n // state the resources this cape uses" _
!"\n exclusive-use =" */

The start of the source file.

Definition at line 31 of file pruiotools.bas.

◆ FRAG0_END

#define FRAG0_END
Value:
/* _
!"\n };" _
!"\n };" */

The end of fragment0 in the source file (pinmux settings).

Definition at line 44 of file pruiotools.bas.

◆ FRAG0_START

#define FRAG0_START
Value:
/* _
!"\n ""pruss"";" _
!"\n" _
!"\n fragment@0 {" _
!"\n target = <&am33xx_pinmux>;" _
!"\n __overlay__ {" */

The start of fragment0 in the source file (pinmux settings).

Definition at line 41 of file pruiotools.bas.

◆ FRAG1_END

#define FRAG1_END
Value:
/* _
!"\n };" _
!"\n };" */

The end of fragment1 in the source file (pinmux_helper).

Definition at line 51 of file pruiotools.bas.

◆ FRAG1_START

#define FRAG1_START
Value:
/* _
!"\n fragment@1 {" _
!"\n target = <&ocp>;" _
!"\n __overlay__ {" */

The start of fragment1 in the source file (pinmux_helper).

Definition at line 48 of file pruiotools.bas.

◆ GPIO_DEF

#define GPIO_DEF
Value:
/* CHR( _
7 + RX + NP _ ' input, open (no resistor)
, 7 + RX + PU _ ' input, pullup resistor
, 7 + RX + PD _ ' input, pulldown resistor
, 7 + NP _ ' output (no resistor)
) */

The default settings for the GPIO modes.

Definition at line 79 of file pruiotools.bas.

Enumeration Type Documentation

◆ PinModes

enum PinModes

Enumerators for pin modes.

Enumerator
NP 

no resistor connected

PU 

pullup resistor connected

PD 

pulldown resistor connected

RX 

input receiver enabled

_O_ 

setting for an output pin.

_I_ 

setting for an input pin.

I_O 

setting for an in-/out-put pin.

IOD 

setting for an in-/out-put pin.

TMRi 

setting for a TIMER input pin.

TMRo 

setting for a TIMER output pin.

CAPi 

setting for a CAP input pin.

CAPo 

setting for a CAP output pin.

QEPi 

setting for a QEP input pin.

QEPo 

setting for a QEP output pin (sync).

PWMi 

setting for a PWM input pin (sync).

PWMo 

setting for a PWM output pin.

Definition at line 57 of file pruiotools.bas.

Function Documentation

◆ f0entry()

FUNCTION_AS_STRING f0entry ( BYVAL_AS_UBYTE  I)

Create lines for fragment@0 with all settings of a pin.

Parameters
IThe index (ball number) of the pin in global array M.
Returns
A string containing several lines with pin settings for fragment0.

This function creates a buch of lines used in fragment@0, declaring the DT-nodes for all the defined pinmux modes in array M(). In this fragment the pinmux modes get declared. Each nodes is named (and labeled) by the letter B and two hexadecimal numbers, concatenated by an underscore. The first number is the CPU ball number and the second is the pinmux mode. Ie. B6B_2F stands for CPU ball 6B (= P9_25) in modus 2F (= GPIO input, no resistor).

Definition at line 98 of file pruiotools.bas.

◆ f1entry()

FUNCTION_AS_STRING f1entry ( BYVAL_AS_UBYTE  I)

Create lines for fragment@0 with all settings of a pin.

Parameters
IThe index (ball number) of the pin in global array M.
Returns
A string containing an entry with pin settings for fragment1.

This function creates a buch of lines used in fragment@1, declaring the DT-nodes for all the defined pinmux modes in array M(). In this fragment the name entries for the status files in the sysfs get declared. Each pinmux mode is named by a hexadecimal number. The number represents the pinmux mode. Ie. x2F stands for modus 2F (= GPIO input, no resistor).

Definition at line 132 of file pruiotools.bas.

◆ nameBall()

FUNCTION_CDECL_AS_ZSTRING_PTR nameBall ( BYVAL_AS_UBYTE  Ball)

Get header pin connected to CPU ball.

Parameters
BallThe CPU ball number.
Returns
A string pointer (don't free it) on success (otherwise zero).
Since
0.2

This function creates a text description of the header pin connected to a CPU ball. The returned string is owned by this function and must not be freed.

When the CPU ball is not connected to a header pin, this function returns 0 (zero).

Definition at line 172 of file pruiotools.bas.

Here is the caller graph for this function: