Example: test execution speed of several methods to toggle a GPIO pin. More...
#include "BBB/pruio.bi"#include "BBB/pruio_pins.bi"
Go to the source code of this file.
Macros | |
| #define | C_IN /* P9_42 */ |
| The pin to use for CAP input. | |
| #define | GOUT /* P8_16 */ |
| The pin to use for GPIO output. | |
| #define | G_IN /* P8_14 */ |
| The pin to use for GPIO input. | |
| #define | FREQ(_N_) |
| Macro to measure the frequency and compute statistics. More... | |
| #define | DIRECT(_O_) |
| Macro to set output pin by fast direct PRU command (no error checking). More... | |
| #define | FUNC(_O_) |
| Macro to set output by normal GPIO function (for better readability). More... | |
Functions | |
| int | main () |
Variables | |
| VAR | io = NEW PruIo(PRUIO_DEF_ACTIVE, 0, 0, 0) |
| Create a PruIo structure, wakeup devices. | |
| CONST_ZSTRING_PTR | desc [...] |
| A text description for the tests. More... | |
| Float_t | f0 |
| Variable for measured frequency. | |
| Float_t | nf |
| The minimum frequencies. | |
| Float_t | xf |
| The maximum frequencies. | |
| Float_t | sf |
| The summe of measured frequencies (to compute avarage). | |
| UInt32 | n = 0 |
| The counter for test cycles. | |
| UInt32 | c = 3 |
| The number of cycles for each test. | |
| UInt32 | r1 = .BallGpio(G_IN) |
| Resulting input GPIO (index and bit number). | |
| UInt32 | g1 = r1 SHR 5 |
| Index of input GPIO. | |
| UInt32 | m1 = 1 SHL (r1 AND 31) |
| The bit number of input bit. | |
| UInt32 | r0 = .BallGpio(GOUT) |
| Resulting output GPIO (index and bit number). | |
| UInt32 | g0 = r0 SHR 5 |
| Index of output GPIO. | |
| UInt32 | m0 = 1 SHL (r0 AND 31) |
| Mask for output bit. | |
| UInt32 | cd = 0 |
| Register value for CLEARDATAOUT. | |
| UInt32 | sd = 0 |
| Register value for SETDATAOUT. | |
| UInt32 | ad = .Gpio->Conf(g0)->DeAd + &h100 |
| Subsystem adress. | |
| UInt32 | oe = .Gpio->Conf(g0)->OE |
| Output enable register. | |
Example: test execution speed of several methods to toggle a GPIO pin.
This file contains an example on measuring the execution speed of different controllers that toggles a GPIO output. It measures the frequency of the toggled output from open and closed loop controllers and computes their mimimum, avarage and maximum execution speed. Find a functional description in section performance.
The code performs 50 tests of each controller version and outputs the toggling frequencies in Hz at the end. The controllers are classified by
Licence: GPLv3, Copyright 2014-2023 by Thomas{ doT ]Freiherr[ At ]gmx[ DoT }net
Compile by: fbc -w all performance.bas
Definition in file performance.bas.
| #define DIRECT | ( | _O_ | ) |
Macro to set output pin by fast direct PRU command (no error checking).
Definition at line 47 of file performance.bas.
| #define FREQ | ( | _N_ | ) |
Macro to measure the frequency and compute statistics.
Definition at line 44 of file performance.bas.
| #define FUNC | ( | _O_ | ) |
Macro to set output by normal GPIO function (for better readability).
Definition at line 50 of file performance.bas.
| int main | ( | ) |
The main function.
Definition at line 183 of file performance.bas.

| CONST_ZSTRING_PTR desc[...] |
A text description for the tests.
Definition at line 76 of file performance.bas.