This example demonstrates use of the GPIO driver for input via GPIO pins.
Example directory in the SDK
The code of the example and build scripts are available at the following path:
/opt/KasperskyOS-Community-Edition-<platform>-<version>/examples/gpio_input
List of programs
Client – application configuring the GPIO pins to output mode and reading their values.DCM – system program that lets you dynamically create IPC channels.When you build an example for the target hardware platform, platform-specific drivers are automatically included in the solution:
BSP is a hardware platform support package (Board Support Package). Provides cross-platform configuration of peripherals for the Radxa ROCK 3A and Raspberry Pi 4 B.GPIO – GPIO support driver for the Radxa ROCK 3A and Raspberry Pi 4 B.PinCtrl – low-level pin multiplexing (pinmux) configuration driver for the Radxa ROCK 3A.Bcm2711MboxArmToVc – driver for working with the VideoCore (VC6) coprocessor via mailbox technology for Raspberry Pi 4 B.Initialization description
The solution initialization description file named init.yaml is generated during the solution build process based on the ./einit/src/init.yaml.in template. Macros in @INIT_*@ format contained in the template are automatically expanded in the resulting init.yaml file. For more details, refer to init.yaml.in template.
Security policy description
The security policy description files for a KasperskyOS-based solution are located in the ./einit/src directory.
The security.psl file contains description of the solution security policy. This file is a top-level file into which a portion of the solution security policy description in the form of the PSL file dynld.psl is included via the use declaration. (The declarations in the PSL files are annotated to explain the purpose of these declarations.) The dynld.psl file contains the part of the security policy description that is used when dynamically linking the solution components.
Resources
The ./resources/xdl/gpio_input directory contains the Client.edl file, which is the EDL description of the Client program.
Operating scenario
The Client program performs the following actions:
gpio0, gpio1, ... (the total number of open ports is defined in the GPIO_BANK_COUNT macro).ExceptionPinArr array as input pins with enabled internal pull-up to a logical zero (GPIO_DIR_IN | GPIO_PULL_MODE_DOWN).The total number of GPIO pins on the card is defined by the GPIO_PIN_NUM macro.
ExceptionPinArr – array of GPIO pin numbers that must be excluded from processing (for example, when used for a debug UART connection).
DELAY_S macro (the time is indicated in seconds).EXIT_SUCCESS code if there are no errors.Building and running the example
The CMake system, which is included with KasperskyOS Community Edition, is used to build and run the example.
For the gpio_input example to work correctly, you must supply 3.3 V (logical 1) to all GPIO pins except those specified in the ExceptionPinArr array.
See Building and running examples section.
Page top