aboutsummaryrefslogtreecommitdiffstats
path: root/src/mraa.c
AgeCommit message (Collapse)Author
2024-01-23mraa: Use posix basenameKhem Raj
Musl has removed the declaration from string.h [1] which exposes the problem especially with clang-17+ compiler where implicit function declaration is flagged as error. Use posix basename and make a copy of string to operate on to emulate GNU basename behaviour. [1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7 Signed-off-by: Khem Raj <raj.khem@gmail.com>
2023-09-21platform: Add RISC-V architecture with VisionFiveDaniel Bovensiepen
Add RISC-V architecture and StarFive JH71x0-based boards VisionFive and VisionFive 2. Signed-off-by: Daniel Bovensiepen <oss@bovi.li> Signed-off-by: Zhu Jia Xing <jiaxing.zhu@siemens.com>
2020-09-15Added the mraa_strresult functionJefferson Lee
Signed-off-by: Jefferson Lee <jeffersonlee2000@gmail.com>
2020-01-06upxtreme: Add UP Xtreme supportMichael Campion
UP Xtreme is based on the Intel(R) Core(TM) i3/i5/i7 Whiskey Lake SoCs. The UP Xtreme presents one Raspberry Pi compatible HAT connector. This implementaion supports i2c, spi, uart, adc and gpio through the 40pin HAT connector. Gpio chardev capabilities have been disabled in this implementation. When gpio chardev capabilities are enabled an input becomes unreadable after an isr has been registered to the pin. See here for details: https://github.com/intel-iot-devkit/mraa/issues/937 Tested on UP Xtreme, with UP Board Linux kernel 5.0.0 Features tested: gpio, gpio interrupts, i2c, spi, adc and uart. Signed-off-by: Michael Campion <michael.campion@emutex.com>
2019-05-23spdx: add spdx tags to most filesThomas Ingleby
Large change that removes the duplicated MIT notice withe a spdx tag Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
2019-03-06clang-format: reapply to recently modified sourcesMihai Tudor Panu
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-03-06mraa:c Fix dereference of null pointerCosmin Popescu
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-03-06mraa.c: Fix memory leakCosmin Popescu
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-03-06mraa.c: Add fix for dereferencing of a null pointerCosmin Popescu
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-03-06mraa.c: Add fix for potential memory leakCosmin Popescu
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-08-15mraa: fix mraa_gpio_lookup functionManivannan Sadhasivam
1. Extend the lookup count to phy_pin_count to cover all physical pins exposed on the board 2. Ignore the non GPIO pins by checking for GPIO capability Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-06-26Platform_extender: FT4222 library refactorNoel Eck
Updates to make the FT4222 platform extender more usable. Previous implementation opened libft4222.so and loaded symbols as needed. This implementation removes dynamic loading of libft4222 in favor of creating a new shared libary which links against libft4222.so. The dynamic loading is now done in mraa.c. One C method is exposed in libmraa-platform-ft4222.so for finding/initializing an FT4222: mraa_platform_t mraa_usb_platform_extender(mraa_board_t* board); Mraa.c attempts to open this platform library and calls the mraa_usb_platform_extender method. If an ftdi4222 is connected, the user gets added IO from the extender. If no FT4222 device is connected, continue as normal. * Create a new platform library for the FT4222 * Expose only 1 C method from the library - mraa_usb_platform_extender * libmraa-platform-ft4222.so contains CXX code (as well as previous C code). All *allocs have been removed in favor of global C++ stl containers. * Previously, the FT4222 would only initialize correctly if 2 ftdi devices existed. Now, initialize FT4222 devices based on the device id. * Many fixes for various problems with the FT4222 * Added unit test for platform extender (minimal functionality w/o hw) * Updated to FindFtd4222.cmake module to handle standard arguments * Removed CMAKE_C_FLAGS addition of -DFTDID2XX and -DFTDI4222 since these are NOT used anywhere in source. * Building the FTDI4222 shim requires libft4222.h which requires ftd2xx.h. Updated CMakeLists.txt to require both when building the shim. Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-14mraa.c: Added pointer to pointer back to find_uartNoel Eck
Went a bit too far with the previous commit. Added pointer to pointer back to mraa_find_uart_bus_pci. Tested leaks against valgrind and verified dev_path gets set with gdb. Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-14mraa.c: Fixed memleak of device_path for IEI_TANKNoel Eck
Unfortunately the device_path char* is dynamically allocated and #defined and const char *'ed depending on how each platform provided the uart device paths which makes cleaning it up more complicated. Added a check for the IEI_TANK. Removed the char** (in favor of a char*) for mraa_find_uart_bus_pci.) Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-03-14UART: Fixing UART issues on UP2Abhishek Malik
Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
2018-03-14chardev: boards need to specify chardev support explicitly before runtime ↵Mihai Tudor Panu
check is performed Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-03-13api: Fixes for missing mraa methods.Noel Eck
This commit includes a set of small fixes flushed out from the google unit tests. * Fixed missing implementations of mraa_get_*_count methods. * Fix for NULL string * Fix for MOCK platform C++ define. * Switched (void) -> () function definitions for consistency. Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-03-05gpio: chardev interface / multiple gpio support for sysfsmihais
Signed-off-by: Mihai Stefanescu <mihai.t.gh.stefanescu@gmail.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2018-03-05gpio: Add gpio chardev interfaceMihai Stefanescu
Signed-off-by: Mihai Stefanescu <mihai.t.gh.stefanescu@gmail.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2018-02-07mraa.c: make mraa_gpio_lookup() return proper pin indexAlex Tereschenko
Pinmap field value is an OS pin number, not mraa pin index, so make the function return the proper one. Fixes #817. Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
2017-10-05Add support for MIPS-based boards Omega2 and Linkit Smart 7688Serge Vakulenko
Signed-off-by: Serge Vakulenko <vak@besm6.org> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-09-14grovepi: grovepi subplatform support via i2cMihai Tudor Panu
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-06-21mraa.c/x86.c: use exact match in strncmp() to avoid surprisesAlex Tereschenko
Closes #736. Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-05-29mraa.c: remove surplus variables, correct memory allocationsAlex Tereschenko
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-05-28mraa: add accessor functions to return counts of spi, pwm, gpio and adcsTapani Utriainen
Signed-off-by: Tapani Utriainen <tapani@technexion.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-05-28mraa: add a function that returns the number of uarts availableTapani Utriainen
Signed-off-by: Tapani Utriainen <tapani@technexion.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-05-17mraa.c: be more defensive and replace strcmp() with strncmp()Alex Tereschenko
Closes #731. Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
2017-05-16mraa.c: add a by-name lookup function also for UARTsTapani Utriainen
Signed-off-by: Tapani Utriainen <tapani@technexion.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-05-16mraa.c: make lookup functions more robust with null pointer checksTapani Utriainen
Signed-off-by: Tapani Utriainen <tapani@technexion.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-05-16mraa.c: fix style of lookup functionsTapani Utriainen
This patch has no changes in function. It fixes three style issues to be more readable and in line to the rest of the codebase: - return types are declared on a separate line - reversal of Yoda conditionals - initialize for loop variable inside loop declaration - Fix styling of pwm lookup doxygen Signed-off-by: Tapani Utriainen <tapani@technexion.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-04-24pio: Remove pio headers from MRAANoel Eck
The Native PIO API provides both the libraries and headers for use with the Android Things Peripheralanager client. This commit removes these from the MRAA repo in favor of the FindAndroidThings.cmake provided by the Native PIO API. Signed-off-by: Noel Eck <noel.eck@intel.com>
2017-04-24periphmraa: Create IndexLookup functions for GPIO, I2C, SPI, PWMVineela Tummalapalli
These lookups provide the MRAA index with the Pin/Bus name as input Signed-off-by: Vineela Tummalapalli <vineela.tummalapalli@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-04-24android-things: Possibly working gpioBrendan Le Foll
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-04-24mraa.c: Fix elif without statementBrendan Le Foll
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-04-24android-things: Peripheralmanager target buildBrendan Le Foll
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-04-24android-things: Prep for peripheralmanager supportBrendan Le Foll
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-04-06mraa.c: mraa_deinit make plat pointer NULL after freeing itBrendan Le Foll
This fixes #698 where an application will crash after calling mraa_deinit and later closing calling deinit again because of the gcc destructor argument introduced with cac8f7a Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-04-02mraa.c: Fix for various small memory leaksNoel Eck
In the process of using the mraa mock platform to identify memory leaks in UPM libraries. This commit fixes some non-critical places where memory was getting lost in mraa. Signed-off-by: Noel Eck <noel.eck@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2017-03-16mraa.c: Fix strsep crashSimo Kuusela
Variable 'dup' doesn't get freed correctly as the pointer to it changes after 'strsep' function is used. Also 'token' variable doesn't need to be freed as freeing the original 'dup' already frees the same memory. Signed-off-by: Simo Kuusela <simo.kuusela@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-11-04mraa.c: Fix another memleak in mraa_find_i2c_bus_pciBrendan Le Foll
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-11-04mraa.c: fix memleak in find_i2c_bus_pciBrendan Le Foll
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-11-02mraa.c: add LOG_NOTICE to checkout what i2c bus is added from pciBrendan Le Foll
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-11-02mraa.c: Use mraa_atoi instead of atoi in lockfile addingBrendan Le Foll
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-11-02mraa.c: Find i2c bus by pci idBrendan Le Foll
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-10-26imraa: split imraa up into imraa_io and imraa_lockBrendan Le Foll
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-10-26mraa.c: add error if adding a MRAA_GENERIC_FIRMATA subplat and not supportedBrendan Le Foll
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-10-11mraa.c: return MRAA_SUCCESS when trying to call mraa_add_subplatform twiceBrendan Le Foll
If we already have a subplatform present with the same type, return success when trying to add it again. We don't check that the tty is the same because that is hidden inside the t_firmata* structure but we should do at some point Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-10-11mraa.c: Remove unused variables in mraa_add_from_lockfileBrendan Le Foll
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-10-11mraa.c: Add MRAA_SUCCESS return to mraa_remove_subplatformBrendan Le Foll
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
2016-10-11mraa.c: Move firmata syslog message to useful locationBrendan Le Foll
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>