The main source code of the library. More...
#include "pruio_prussdrv.bi"
#include "pruio.bi"
#include "pruio_pins.bi"
#include "pruio_pins_pocket.bi"
#include "pruio_pins_blue.bi"
#include "pruio_pins_sd.bi"
#include "pasm_init.bi"
#include "pasm_run.bi"
#include "dir.bi"
Go to the source code of this file.
Macros | |
#define | __PRUIO_COMPILING__ |
Tell the header pruio.bi that we won't include libpruio.so. | |
#define | PMUX_NAME /* "pruio-" */ |
The start of the pinmux-helper folder names in /sys/devices/ocp.*/. | |
#define | PMUX_ERRR /* 258 */ |
The constant number for no pinmux capability. | |
#define | ArrayBytes(_A_) /* (UBOUND(_A_) + 1) * SIZEOF(_A_(0)) */ |
Macro to calculate the total size of an array in bytes. | |
#define | BB_NAMES() |
Beaglebone pin name for CPU ball number. More... | |
#define | BLUE_NAMES() |
Beaglebone Blue connector pin name for CPU ball number. More... | |
#define | POCKET_NAMES() |
Pocketbeagle header pin name for CPU ball number. More... | |
Functions | |
FUNCTION_CDECL_ALIAS_AS_ANY_PTR | memcpy (BYVAL_AS_ANY_PTR, BYVAL_AS_ANY_PTR, BYVAL_AS_ULONG) |
Declaration for C runtime function memcpy(). | |
FUNCTION_CDECL_AS_ZSTRING_PTR | setPin_save (BYVAL_AS_Pruio__PTR, BYVAL_AS_UInt8, BYVAL_AS_UInt8) |
Set a new pin configuration (internal). More... | |
FUNCTION_CDECL_AS_ZSTRING_PTR | setPin_lkm_bb (BYVAL_AS_Pruio__PTR, BYVAL_AS_UInt8, BYVAL_AS_UInt8) |
Set a new pin configuration for BeagleBone boards(internal). More... | |
FUNCTION_CDECL_AS_ZSTRING_PTR | setPin_lkm (BYVAL_AS_Pruio__PTR, BYVAL_AS_UInt8, BYVAL_AS_UInt8) |
Set a new pin configuration for Pocket BeagleBone(internal). More... | |
FUNCTION_CDECL_AS_ZSTRING_PTR | setPin_dtbo (BYVAL_AS_Pruio__PTR, BYVAL_AS_UInt8, BYVAL_AS_UInt8) |
Pinmuxing for old style device tree multipins (internal). More... | |
FUNCTION_CDECL_AS_ZSTRING_PTR | setPin_nogo (BYVAL_AS_Pruio__PTR, BYVAL_AS_UInt8, BYVAL_AS_UInt8) |
Pinmuxing callback for setPin interface (internal). More... | |
The main source code of the library.
This is the main source code of the library. You may compile it by fbc -dylib pruio.bas
to get a small library file (small, because the C wrapper functions are not included as in the original version).
Definition in file pruio.bas.
#define BB_NAMES | ( | ) |
#define BLUE_NAMES | ( | ) |
#define POCKET_NAMES | ( | ) |
FUNCTION_CDECL_AS_ZSTRING_PTR setPin_dtbo | ( | BYVAL_AS_Pruio__PTR | Top, |
BYVAL_AS_UInt8 | Ball, | ||
BYVAL_AS_UInt8 | Mo | ||
) |
Pinmuxing for old style device tree multipins (internal).
Top | The PruIo instance. |
Ball | The CPU ball number (use macros from pruio_pins.bi). |
Mo | The new modus to set, or PRUIO_PIN_RESET to reset |
Like function setPin_lkm(), this function sets a new pin mode for a CPU ball. Therefor the SysFs files from the OCP pinmux helper are used. That means the pinmux capabilities are handled by the kernel. You have to load an overlay blob and export the pins, before you can set one of the prepared configurations.
The SysFs folder tree changed between kernel versions 3.8 and 4.x. This function handles either of the folder structures. When the desired pin (ball) isn't available in the overlay blob, an error message gets returned, containing the pin number (or CPU ball#) and the missing state.
Definition at line 818 of file pruio_prussdrv.bas.
FUNCTION_CDECL_AS_ZSTRING_PTR setPin_lkm | ( | BYVAL_AS_Pruio__PTR | Top, |
BYVAL_AS_UInt8 | Ball, | ||
BYVAL_AS_UInt8 | Mo | ||
) |
Set a new pin configuration for Pocket BeagleBone(internal).
Top | The toplevel PruIo instance. |
Ball | The CPU ball number (use macros from pruio_pins.bi). |
Mo | The new modus to set. |
Callback function for PruIo::setPin() interface to set a new pin (or CPU ball) configuration on PocketBeagleBone hardware, using the new style LKM (loadable kernel module) method.
Since the double pins at this hardware are connections between digital and analog pins, no special action is required regarding pinmuxing (as in for BeagleBone hardware).
It's used when the constructor PruIo::PruIo() finds the SysFs entry from the LKM, and has write access (needs administrator privileges = sudo ...
). Since
There're no restriction for pinmuxing. Each CPU ball in the range zero to PRUIO_AZ_BALL can get set to any mode. Even claimed pins or CPU balls can get set to defined or undefined modes. The function executes faster than device tree pinmuxing (no OPEN ... CLOSE
), boot-time is shorter (no overlay loading) and less memory is used.
Definition at line 665 of file pruio_prussdrv.bas.
FUNCTION_CDECL_AS_ZSTRING_PTR setPin_lkm_bb | ( | BYVAL_AS_Pruio__PTR | Top, |
BYVAL_AS_UInt8 | Ball, | ||
BYVAL_AS_UInt8 | Mo | ||
) |
Set a new pin configuration for BeagleBone boards(internal).
Top | The toplevel PruIo instance. |
Ball | The CPU ball number (use macros from pruio_pins.bi). |
Mo | The new modus to set. |
Callback function for PruIo::setPin() interface to set a new pin (or CPU ball) configuration on BeagleBone hardware (Black, BlackWireless, Green, White), using the new style LKM (loadable kernel module) method.
Since this hardware has some digital header pins with double CPU ball connections, both CPU balls have to be set. First, the unused CPU ball gets configured to gpio input mode without pull-up/pull-down resistor, before the other pin gets set to the desired mode.
Definition at line 700 of file pruio_prussdrv.bas.
FUNCTION_CDECL_AS_ZSTRING_PTR setPin_nogo | ( | BYVAL_AS_Pruio__PTR | Top, |
BYVAL_AS_UInt8 | Ball, | ||
BYVAL_AS_UInt8 | Mo | ||
) |
Pinmuxing callback for setPin interface (internal).
Top | The PruIo instance. |
Ball | The CPU ball number (use macros from pruio_pins.bi). |
Mo | The new modus to set, or PRUIO_PIN_RESET to reset |
This function is a dummy for the setPin interface in PruIo structure. It gets used when no pinmuxing capability was found on the system: neither a universal device tree overlay was loaded, nor the loadable kernel module is available (may be loaded, but no administrator privileges). The function does nothing, but returns an error message.
Definition at line 789 of file pruio_prussdrv.bas.
FUNCTION_CDECL_AS_ZSTRING_PTR setPin_save | ( | BYVAL_AS_Pruio__PTR | Top, |
BYVAL_AS_UInt8 | Ball, | ||
BYVAL_AS_UInt8 | Mo | ||
) |
Set a new pin configuration (internal).
Top | The PruIo instance. |
Ball | The CPU ball number (use macros from pruio_pins.bi). |
Mo | The new modus to set, or PRUIO_PIN_RESET to reset |
Callback function for the PruIo::setPin() interface. It's a wrapper around setPin_lkm() functions, that checks the pin claiming of the kernel first. Only mode changes for unclaimed pins (or CPU balls) get executed.
Claims from the kernel get fetched once by calling the function with an invalid Ball parameter (> PRUIO_AZ_BALL
). This gets executed by the constructor PruIo::PruIo(). The function doesn't notice changes in kernel claiming at runtime. You can re-fetch the claims when needed.
Definition at line 752 of file pruio_prussdrv.bas.